http://blog.csdn.net/apple_7898/article/details/7618371
oracle
测试数据库的NLS_NCHAR_CHARACTERSET和正式环境不一致,需要由UTF8修改为AL16UTF16。
1、停数据库
SQL> alter system checkpoint;
System altered.
SQL> alter system switch logfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
2、启动数据库
SQL> STARTUP MOUNT EXCLUSIVE;
ORACLE instance started.
Total System Global Area 838860800 bytes
Fixed Size 2024536 bytes
Variable Size 192940968 bytes
Database Buffers 637534208 bytes
Redo Buffers 6361088 bytes
Database mounted.
SQL> alter system enable restricted session;
System altered.
SQL> alter system set job_queue_processes=0;
System altered.
SQL> alter system set aq_tm_processes=0;
System altered.
SQL> alter database open;
Database altered.
SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16;
Database altered.
注意:
1)这样修改会影响数据库中定义了Nclob、NVARCHAR2等大字段的表,会出现乱码。需要重新导入表,当然在修改前要备份相关表。
2)如果没有大对象,在使用过程中进行语言转换没有什么影响,(切记设定的字符集必须是ORACLE支持,不然不能start)
若直接运行
ALTER DATABASE NATIONAL CHARACTER SET AL16UTF16;
也可以,但是可能会出现‘ORA-12717: Cannot ALTER DATABASE NATIONAL CHARACTER SET when
NCLOB data exists’ 这样的提示信息
报错信息如下:
Wed May 30 16:25:58 2012
alter database national character set AL16UTF16
Wed May 30 16:25:58 2012
XDB.XDB$NMSPC_ID (NMSPCURI) - NVARCHAR2 populated
ORA-12717 signalled during: alter database national character set AL16UTF16...
3、在停数据库时hang住了,没有办法只有直接abort了再startup。
SQL> shutdown immediate;
ORA-03113: end-of-file on communication channel
SQL> exit
SQL> connect /as sysdba
Connected to an idle instance.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit