以前的学习笔记,共享一下
alter database character set zhs16gbk;
这是正确的修改字符集的语句,但是只能从子集向超集转换。
alter database character set internal_use zhs16gbk;
使用未公开的internal_use,可以在任意字符集之间转换,谨慎使用!!
在使用这个命令时,Oracle会跳过所有子集及超集的检查,在任意字符集之间进行强制转换
,所以,使用这个命令时必须十分小心
===============================================================================================
sys@TESTDB> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@TESTDB> startup mount;
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
Database mounted.
修改字符集不能有活动会话,必须在restrict模式下进行
sys@TESTDB> alter system enable restricted session;
System altered.
/*-------------------------------------
eygle的资料上,还执行了
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
在我的测试中,没使用也可以
sys@TESTDB> show parameters _processes
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes integer 0
db_writer_processes integer 1
gcs_server_processes integer 0
job_queue_processes integer 10
log_archive_max_processes integer 2
------------------------------------------*/
sys@TESTDB> alter database open;
Database altered.
sys@TESTDB> select * from nls_database_parameters where parameter = upper('nls_characterset');
PARAMETER VALUE
------------------------------ ----------------------------------------
NLS_CHARACTERSET AL32UTF8
使用internal_use
sys@TESTDB> alter database character set internal_use zhs16gbk;
Database altered.
sys@TESTDB> select * from nls_database_parameters where parameter = upper('nls_characterset');
PARAMETER VALUE
------------------------------ ----------------------------------------
NLS_CHARACTERSET ZHS16GBK
sys@TESTDB>
===============================================================================================