修改Oracle字符集为ZHS16GBK

修改Oracle字符集为ZHS16GBK

1、登录DBA用户

# 登录dba用户
sqlplus /nolog
SQL>connect sys/oracle as sysdba

2、查看当前字符集

# 查看当前字符集
SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER = 'NLS_CHARACTERSET';
SELECT USERENV('language') FROM DUAL;

3、关闭数据库,以mount方式打开

# 关闭数据库
shutdown immediate;

# 以mount打开
startup mount;

4、设置session

# 设置session
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;

5、启动数据库,修改字符集

# 启动数据库
SQL>alter database open;

# 修改字符集
ALTER DATABASE CHARACTER SET ZHS16GBK;

# 可能会遇到的错误:ORA-12712: new character set must be a superset of old character set

# 解决办法
ALTER DATABASE character set INTERNAL_USE ZHS16GBK;

6、重启,查看是否修改成功

# 关闭
shutdown immediate;

# 重启
startup;

# 查看当前字符集
SELECT * FROM V$NLS_PARAMETERS WHERE PARAMETER = 'NLS_CHARACTERSET';
SELECT USERENV('language') FROM DUAL;
posted @ 2020-08-24 12:37  张瑞丰  阅读(1834)  评论(0编辑  收藏  举报