ITPub博客

首页 > Linux操作系统 > Linux操作系统 > CHANGING THE DATABASE OR NATIONAL CHARACTER SET

CHANGING THE DATABASE OR NATIONAL CHARACTER SET

原创 Linux操作系统 作者:Kenniu 时间:2019-02-12 09:03:04 0 删除 编辑

CHANGING THE DATABASE OR NATIONAL CHARACTER SET
================================================

In Oracle7 it is possible to update the "SYS.PROPS$" table to change the
database character set. The method is unsupported but it is externally
published (see ). It is used by Oracle Installer to install
seed databases.

This method is not legal in Oracle8 because character set information is
stored in many other places in the Data Dictionary besides SYS.PROPS$, for
example with each table column, PL/SQL argument, etc.

In Oracle8 there is another way of changing the database or national character
set. The method uses two commands, which are documented in the Oracle8i
National Language Support Guide:

ALTER DATABASE [] CHARACTER SET
ALTER DATABASE [] NATIONAL CHARACTER SET

The database name is optional. The character set name should be specified
without quotes, for example:

ALTER DATABASE CHARACTER SET WE8ISO8859P1

To change the database character set perform the following steps. Not all
of these steps are absolutely necessary, but they are highly recommended:

SVRMGR> SHUTDOWN IMMEDIATE; -- or NORMAL



SVRMGR> STARTUP MOUNT;
SVRMGR> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SVRMGR> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SVRMGR> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SVRMGR> ALTER DATABASE OPEN;
SVRMGR> ALTER DATABASE CHARACTER SET ;
SVRMGR> SHUTDOWN IMMEDIATE; -- OR NORMAL
SVRMGR> STARTUP;

To change the national character set replace the ALTER DATABASE CHARACTER
SET command with ALTER DATABASE NATIONAL CHARACTER SET. You can issue both
commands together if you wish.

The ALTER DATABASE [NATIONAL] CHARACTER SET command will return:

ORA-01679: database must be mounted EXCLUSIVE and not open to activate

- if you do not enable restricted session
- if you startup the instance in PARALLEL/SHARED mode
- if you do not set the number of queue processes to 0
- if you do not set the number of AQ time manager processes to 0
- if anybody is logged in apart from you.

This error message is misleading. The command requires the database to be
open but only one session, the one executing the command, is allowed.

The above method will only work if the old character set is US7ASCII (or if
you change the character set to itself). If the old character set is neither
US7ASCII nor equal to the new character set, the ALTER DATABASE [NATIONAL]
CHARACTER SET command will return:

- in Oracle 8.1.5 and above:

ORA-12712: new character set must be a superset of old character set

- in Oracle 8.0.5 and 8.0.6:

ORA-12710: new character set must be a superset of old character set

- in Oracle 8.0.3 and 8.0.4:

ORA-24329: invalid character set identifier

**************************** INTERNAL_USE ********************************

In Oracle 8.1 an undocumented option INTERNAL_USE has been added to
the ALTER DATABASE [NATIONAL] CHARACTER SET command:

ALTER DATABASE []
[NATIONAL] CHARACTER SET INTERNAL_USE

If included in the statement this option will switch the character set
verification off allowing any database character set to be changed.

*** Improper use of the option can lead to corruption of the database. ***


- in Oracle 9i

If Based on SOP do change character , the below error be thrown as
"ORA-01679: database must be mounted EXCLUSIVE and not open to activate "

The right sequence should be as:

SVRMGR> STARTUP NOMOUNT

SVRMGR> ALTER SYSTEM MOUNT EXCLUSIVE ;
SVRMGR> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SVRMGR> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
SVRMGR> ALTER SYSTEM SET AQ_TM_PROCESSES=0;
SVRMGR> ALTER DATABASE OPEN;
SVRMGR> ALTER DATABASE CHARACTER SET INTERNAL_USE ;
SVRMGR> SHUTDOWN IMMEDIATE; -- OR NORMAL
SVRMGR> STARTUP;


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30193/viewspace-90013/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 挑水別忘了挖井
请登录后发表评论 登录
全部评论

注册时间:2002-11-29

  • 博文量
    54
  • 访问量
    37586