#查看更改前字符集

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


USERENV('LANGUAGE')

--------------------------------------------------------------------------------

AMERICAN_AMERICA.AL32UTF8

#关闭数据库

SQL> shutdown immediate;

Database closed.

Database dismounted.

ORACLE instance shut down.

#启动到mount阶段

SQL> startup mount;

ORACLE instance started.


Total System Global Area 3221222464 bytes

Fixed Size                  8901696 bytes

Variable Size            1744830464 bytes

Database Buffers         1459617792 bytes

Redo Buffers                7872512 bytes

Database mounted.

#将数据库处于restricted模式下

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> select * from v$nls_parameters;


PARAMETER                      VALUE                    CON_ID

------------------------------ -------------------- ----------

NLS_LANGUAGE                   AMERICAN                      0

NLS_TERRITORY                  AMERICA                       0

NLS_CURRENCY                   $                             0

NLS_ISO_CURRENCY               AMERICA                       0

NLS_NUMERIC_CHARACTERS         .,                            0

NLS_CALENDAR                   GREGORIAN                     0

NLS_DATE_FORMAT                DD-MON-RR                     0

NLS_DATE_LANGUAGE              AMERICAN                      0

NLS_CHARACTERSET               ZHS16GBK                      0

NLS_SORT                       BINARY                        0

NLS_TIME_FORMAT                HH.MI.SSXFF AM                0


PARAMETER                      VALUE                    CON_ID

------------------------------ -------------------- ----------

NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXF          0

                               F AM


NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR            0

NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXF          0

                               F AM TZR


NLS_DUAL_CURRENCY              $                             0

NLS_NCHAR_CHARACTERSET         AL16UTF16                     0

NLS_COMP                       BINARY                        0

NLS_LENGTH_SEMANTICS           BYTE                          0


PARAMETER                      VALUE                    CON_ID

------------------------------ -------------------- ----------

NLS_NCHAR_CONV_EXCP            FALSE                         0


19 rows selected.


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


USERENV('LANGUAGE')

----------------------------------------------------

AMERICAN_AMERICA.ZHS16GBK