oracle更改数据库字符集编码!
一.准备修改。首先必须用sys连接。
1.修改sys密码.用其他dba权限的账户登陆后输入:alter user sys identified by 新密码;
2.连接刚刚修改的sys(要在登陆状态下),CONNECT SYS/密码 as sysdba;
二.开始修改:
[oracle@pdc oracle]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jun 6 08:45:34 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP nomount;
ORACLE instance started.
SQL> ALTER DATABASE mount exclusive;
Database altered.
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 UTF8;
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set
提示我们的字符集:新字符集必须为旧字符集的超集,这时我们可以跳过超集的检查做更改(UTF8可以根据需要更改,如ZHS16GBK
):
SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE UTF8;
Database altered. 注意:如果没有大对象,在使用过程中进行语言转换没有什么影响,具体过程如下(切记设定的字符集必须是ORACLE支持,不然不能start)