C:\Documents and Settings\Owner>imp system/password fromuser=FROMUSER touser=TOUSER file=FILE PATH
drop user
SET LINESIZE 100
COLUMN spid FORMAT A10
COLUMN username FORMAT A10
COLUMN program FORMAT A45
SELECT s.inst_id,
s.sid,
s.serial#,
p.spid,
s.username,
s.program
FROM gv$session s
JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE s.type != ‘BACKGROUND’;
INST_ID SID SERIAL# SPID USERNAME PROGRAM
———- ———- ———- ———- ———- ———————————————
1 30 15 3859 TEST sqlplus@oel5-11gr2.localdomain (TNS V1-V3)
1 23 287 3834 SYS sqlplus@oel5-11gr2.localdomain (TNS V1-V3)
1 40 387 4663 oracle@oel5-11gr2.localdomain (J000)
1 38 125 4665 oracle@oel5-11gr2.localdomain (J001)
ALTER SYSTEM KILL SESSION ‘sid,serial#’ IMMEDIATE;
create user
C:\>sqlplus system/password
SQL> create user CLIENT_TEST identified by client_test_password;
SQL> grant connect, unlimited tablespace, resource to CLIENT_TEST;
SQL> exit
UCS-2 unicode to SQL Server
$link = mssql_connect('dbhost', 'username', 'password');
mssql_select_db('database', $link);
// sending data to database
$utf8 = 'some unicode UTF-8 data'; // some Greek text for example
$ucs2 = iconv('UTF-8', 'UCS-2LE', $utf8);
// converting UCS-2 string into "binary" hexadecimal form
$arr = unpack('H*hex', $ucs2);
$hex = "0x{$arr['hex']}";
// IMPORTANT!
// please note that value must be passed without apostrophes
// it should be "... values(0x0123456789ABCEF) ...", not "... values('0x0123456789ABCEF') ..."
mssql_query("insert into mytable (myfield) values ({$hex})", $link);
// retrieving data from database
// IMPORTANT!
// please note that "varbinary" expects number of bytes
// in this example it must be 200 (bytes), while size of field is 100 (UCS-2 chars)
$result = mssql_query("select convert(varbinary(200), myfield) from mytable", $link);
while (($row = mssql_fetch_array($result, MSSQL_BOTH)))
{
// we get data in UCS-2
// Encode it back to UTF-8
echo(iconv('UCS-2LE', 'UTF-8', $row['myfield']));
}
mssql_free_result($result);
mssql_close($link);