from:http://blog.csdn.net/chid/article/details/6166506
Linux under Change Oracle client Character set and service-side character set
1.Linux under Change Oracle the client character set, which sets the environment variable " Nls_lang " the value
To view the client character set, execute under Terminal:
Echo $NLS _lang
To modify the client character set:
sudo gedit/etc/environment
Add the following to the environment file:
nls_lang= "Simplified Chinese_china. ZHS16GBK "
Export Nls_lang
Restart the operating system.
2. Modify The character set of the Oracle server.
To view the service-side character set:
Select Userenv (' language ') from dual;
Modify the service-side character set, under Terminal execution:
$ORACLE _home/bin/sqlplus/nolog
Enter Sqlplus command line
Sql>conn/as Sysdba;
1 ) . Close the database
Sql>shutdown IMMEDIATE;
2 ) . Boot to Mount
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET job_queue_processes=0;
ALTER SYSTEM SET aq_tm_processes=0;
ALTER DATABASE OPEN;
ALTER DATABASE CHARACTER SET internal_use ZHS16GBK;
--The following line of statements may cause errors to be ignored
ALTER DATABASE National CHARACTER SET INTERNAL ZHS16GBK;
SHUTDOWN IMMEDIATE;
STARTUP;
3. modifying the dmp file Character Set
The 2nd 3rd byte of the DMP file records the character set information, so directly modifying the contents of the 2nd 3rd byte of the dmp file can ' cheat ' the Oracle check. This is done theoretically only from subset to superset can be modified, but in many cases there is no subset and superset of the situation can also be modified, we commonly used some character sets, such as Us7ascii, WE8ISO8859P1, zhs16cgb231280, ZHS16GBK basic can be changed. Because the change is only the DMP file, so the impact is not small.
The specific modification method is more, the simplest is to modify the DMP file's 2nd and 3rd bytes directly with UltraEdit. For example, to change the character set of the DMP file to ZHS16GBK, you can use the following SQL to isolate the 16 code corresponding to that character set:
Sql> Select To_char (nls_charset_id (' ZHS16GBK '), ' XXXX ') from dual;
0354
Then change the DMP file 2, 3 bytes to 0354.
Oracle provides standard functions for converting character set names and IDs:
Sql> Select nls_charset_id (' ZHS16GBK ') from dual;
nls_charset_id (' ZHS16GBK ')
--------------------------
852
1 row selected.
Sql> Select Nls_charset_name (852) from dual;
Nls_char
--------
Zhs16gbk
1 row selected.
Decimal Conversion Hex:
Sql> Select To_char (' 852 ', ' xxxx ') from dual;
To_ch
-----
354
Change Oracle client Character set and service-side character set under Linux