日期:2014-05-16  浏览次数:20418 次

Oracle修改字符集编码

方案一:
sqlplus "/ as sysdba"
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP RESTRICT;
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;? 【ALTER DATABASE CHARACTER SET INTERNAL_USE AL32UTF8;】
SQL> STARTUP FORCE;

方案二:
sqlplus "/ as sysdba"
SQL> SHUTDOWN IMMEDIATE
SQL> ALTER DATABASE OPEN;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;?? 【AL32UTF8】
SQL> SHUTDOWN IMMEDIATE
SQL> STARTUP
shi? 12:00:33
好。。


方案三:【最成功的】
[oracle@bgi-DB-Test admin]$ lsnrctl stop
sqlplus "/ as sysdba"
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP RESTRICT;
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK; [AL32UTF8]
[oracle@bgi-DB-Test admin]$ lsnrctl start
SQL> STARTUP FORCE;
方案一二 不行的原因就是 没有先关闭监听服务 lsnrctl stop!!1

?


陈小伟? 12:01:18
D:\app\chan\product\11.2.0\client_1\network\admin


SELECT parameter, VALUE
FROM nls_database_parameters
WHERE parameter IN ('NLS_CHARACTERSET', 'NLS_NCHAR_CHARACTERSET')

这个可以查看修改后的编码:

PARAMETER????????????????????? VALUE
----------------------------------------
NLS_CHARACTERSET?????????????? AL32UTF8
NLS_NCHAR_CHARACTERSET???????? AL16UTF16

?

修改成为UTF8的编码之后,应该和上面的显示结果一样。

J2EE开发,推荐使用UTF8编码!

?

?