ORACLE11g-RAC修改实例的字符集
系统:centos7.3
数据库版本:oracle11.2.4
数据库上有多个实例:进入自己的实例:export ORACLE_SID=DYRKZYK1
查看字符集:
sqlplus / as sysdba select userenv('language') from dual; USERENV('LANGUAGE') ---------------------------------------- AMERICAN_AMERICA.ZHS16GBK
具体操作步骤:目的:将该实例字符集ZHS16GBK装换为AL32UTF8
1、关闭RAC其中一个节点:
[root@rac1 ~]find / -name crsctl [root@rac1 ~]/u01/grid/11g/bin/crsctl stop cluster
2、在另一个节点查看oracle启动参数:
SQL>show parameter spfile; NAME TYPE VALUE ------------------------------------ --------------------------------- spfile string +RKDG/scrkdys/spfilescrkdys.ora
若VALUE为空,表示用pfile参数启动,即修改为spfile参数启动:
注意(我这儿已经是spfile了,如果不是就根据pfile创建spfile
SQL>CREATE SPFILE FROM PFILE; SQL>shutdown immediate; SQL>startup;
然后重启执行命令)
3、执行命令关闭集群模式:
SQL>alter system set cluster_database=false scope=spfile; 关闭数据库: SQL>shutdown immediate; SQL>startup mount;
4、修改参数设置字符集为AL32UTF8
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 character set INTERNAL_USE AL32UTF8; Database altered.
5、将集群还原成集群模式
SQL> alter system set cluster_database=true scope=spfile; SQL> shutdown immediate; SQL>startup;
6、启动另外一个节点并验证
[root@rac1 ~]#/u01/grid/11g/bin/crsctl start cluster 查看字符集: SQL>select userenv('language') from dual; USERENV('LANGUAGE') ------------------------------------------------ AMERICAN_AMERICA.AL32UTF8
7、修改完后,要恢复一些参数(不修复对导入有影响会直接报错)
SQL>startup mount; SQL> ALTER SYSTEM DISABLE RESTRICTED SESSION; System altered. SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=1; System altered. SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=1; System altered. SQL> alter database open; Database altered.
做一个决定,并不难,难的是付诸行动,并且坚持到底。