Oracle 12c中文乱码,修改字符集的方法

在windows 7 64位上安装Oracle 12c没有设定字符集,采用的是操作系统默认字符集:WE8MSWIN1252,将字符集修改为:ZHS16GBK。由于过程不可逆,首先需要备份数据库。
1.数据库全备

2.查询当前字符集
SQL> select * from nls_database_parameters where parameter='NLS_CHARACTERSET';
PARAMETER                                VALUE
---------------------------------------- ----------------------------------------
NLS_CHARACTERSET                         WE8ISO8859P1

 3.关闭数据库

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

 4.启动数据库到mount状态

SQL> startup mount
ORACLE instance started.
Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size             100666448 bytes
Database Buffers          100663296 bytes
Redo Buffers                2924544 bytes
Database mounted.

 5.限制session

SQL> alter system enable restricted session;
System altered.
6.查询相关参数并修改
SQL> show parameter job_queue_processes;  
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes                  integer     10

SQL> show parameter aq_tm_processes; 
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
aq_tm_processes                      integer     0

SQL> alter system set job_queue_processes=0;
System altered.
7.打开数据库
SQL> alter database open;
Database altered.
8.修改字符集
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
出现错误提示,新字符集必须是老字符集的超集,也就原来字符集是新字符集的子集,可以再Oracle官方文档上查询字符集包含关系。下面使用Oracle内部命令internal_use,跳过超集检查,生产环境不建议使用此方法。
SQL> alter database character set internal_use ZHS16GBK;          
Database altered.
9.查询当前字符集
SQL> select * from nls_database_parameters where parameter='NLS_CHARACTERSET';
PARAMETER                                VALUE
---------------------------------------- ----------------------------------------
NLS_CHARACTERSET                         ZHS16GBK
10.关闭数据库
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
11.启动数据库到mount状态
SQL> startup mount
ORACLE instance started.
Total System Global Area  205520896 bytes
Fixed Size                  1266608 bytes
Variable Size             100666448 bytes
Database Buffers          100663296 bytes
Redo Buffers                2924544 bytes
Database mounted.
12.将相关参数改回原来值
SQL> alter system set job_queue_processes=10;
System altered.
13.打开数据库
SQL> alter database open;
Database altered.

 

转载于:https://www.cnblogs.com/siyunianhua/p/4004327.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值