1.oracle server端字符集查询
SQL>conn /as sysdba
SQL>shutdown immediate;
SQL>startup mount
SQL>ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL>ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SQL>ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SQL>alter database open;
SQL>ALTER DATABASE CHARACTER SET ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
SQL>ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
SQL>select * from v$nls_parameters;
SQL>shutdown immediate;
SQL>startup
SQL>select * from v$nls_parameters;
我们看到这个过程和之前ALTER DATABASE CHARACTER SET操作的内部过程是完全相同的,也就是说INTERNAL_USE提供的帮助就是使Oracle数据库绕过了子集与超集的校验
2.oracle client端字符集修改
在 /home/oracle与 /root用户目录下的.bash_profile中添加或修改 export NLS_LANG="AMERICAN_AMERICA.UTF8" 语句
SHUTDOWN IMMEDIATE;
STARTUP MOUNT EXCLUSIVE;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;
ALTER DATABASE NATIONAL CHARACTER SET UTF8;
SHUTDOWN IMMEDIATE;
STARTUP;
可能会出现ORA-12717:CANNOT ALTER DATABASE NATIONAL CHARACTER SET WHEN NCLOBDATAEXISTS, 解决这个问题的方法