oracle修改字符集(WE8MSWIN1252 -->ZHS16GBK)

查看数据库当前字符集

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.WE8MSWIN1252

将数据库置于restricted mode下

SQL> alter system enable restricted session;

System altered.
置于restricted mode是为了防止数据库有新的非dba权限的连接,关于restricted mode请查看我的blog [http://blog.csdn.net/dbdoctor/article/details/51907531]

修改字符集到ZHS16GBK

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; 
ALTER DATABASE character set INTERNAL_USE ZHS16GBK
*
ERROR at line 1:
ORA-12721: operation cannot execute when other sessions are active
当前有连接处于active状态,kill掉session或者重启数据库。
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 4275781632 bytes
Fixed Size          2260088 bytes
Variable Size         922747784 bytes
Database Buffers     3338665984 bytes
Redo Buffers           12107776 bytes
Database mounted.

SQL> alter system enable restricted session;

System altered.

SQL> alter database open;

Database altered.

SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK; 

Database altered.

SQL> alter system disable restricted session;

System altered.

SQL> select userenv('language') from dual;

USERENV('LANGUAGE')
----------------------------------------------------
AMERICAN_AMERICA.ZHS16GBK
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值