如何修改Oracle數據庫字符集

SELECT DISTINCT (NLS_CHARSET_NAME(CHARSETID)) CHARACTERSET,
                DECODE(TYPE#,
                       1,
                       DECODE(CHARSETFORM,
                              1,
                              'VARCHAR2',
                              2,
                              'NVARCHAR2',
                              'UNKOWN'),
                       9,
                       DECODE(CHARSETFORM,
                              1,
                              'VARCHAR',
                              2,
                              'NCHAR VARYING',
                              'UNKOWN'),
                       96,
                       DECODE(CHARSETFORM, 1, 'CHAR', 2, 'NCHAR', 'UNKOWN'),
                       112,
                       DECODE(CHARSETFORM, 1, 'CLOB', 2, 'NCLOB', 'UNKOWN')) TYPES_USED_IN
  FROM SYS.COL$
 WHERE CHARSETFORM IN (1, 2)
   AND TYPE# IN (1, 9, 96, 112);

修改sys.props$表中的NLS_CHARACTERSET,NLS_NCHAR_CHARACTERSET的值為UTF8。


SHUTDOWN IMMEDIATE;
STARTUP MOUNT;
ALTER SYSTEM ENABLE RESTRICTED SESSION;
ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;
ALTER SYSTEM SET AQ_TM_PROCESSES=0;
ALTER DATABASE OPEN;


COL VALUE NEW_VALUE CHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_CHARACTERSET';
COL VALUE NEW_VALUE NCHARSET
SELECT VALUE FROM NLS_DATABASE_PARAMETERS WHERE PARAMETER='NLS_NCHAR_CHARACTERSET';

ALTER DATABASE CHARACTER SET INTERNAL_USE &CHARSET;
ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE &NCHARSET;


SHUTDOWN IMMEDIATE;
STARTUP;

SHUTDOWN IMMEDIATE;
STARTUP;

posted @ 2007-08-31 14:11  jimeper  阅读(557)  评论(0编辑  收藏  举报