linux下如何修改oracle11的现有字符集

首先查看字符集。解决乱码的方法就是使两端的字符集统一。
服务端select * from nls_database_parameters
客户端select userenv('language') from dual

这里只介绍WE8ISO8859P1->ZHS16GBK的步骤方法:
检查当前的字符集为WE8ISO8859P1:
首先在linux下进入sqlplus------------sqlplus "/as sysdba"
SQL> select * from v$nls_parameters;
PARAMETER                                                        VALUE
---------------------------------------------------------------- ---------------
NLS_LANGUAGE                                                     AMERICAN
NLS_TERRITORY                                                    AMERICA
NLS_CURRENCY                                                     $
NLS_ISO_CURRENCY                                                 AMERICA
NLS_NUMERIC_CHARACTERS                                           .,
NLS_CALENDAR                                                     GREGORIAN
NLS_DATE_FORMAT                                                  DD-MON-RR
NLS_DATE_LANGUAGE                                                AMERICAN
NLS_CHARACTERSET                                                 WE8ISO8859P1
NLS_SORT                                                         BINARY
NLS_TIME_FORMAT                                                  HH.MI.SSXFF AM

PARAMETER                                                        VALUE
---------------------------------------------------------------- ---------------
NLS_TIMESTAMP_FORMAT                                             DD-MON-RR HH.MI
NLS_TIME_TZ_FORMAT                                               HH.MI.SSXFF AM
NLS_TIMESTAMP_TZ_FORMAT                                          DD-MON-RR HH.MI
NLS_DUAL_CURRENCY                                                $
NLS_NCHAR_CHARACTERSET                                           UTF8
NLS_COMP                                                         BINARY
NLS_LENGTH_SEMANTICS                                             BYTE
NLS_NCHAR_CONV_EXCP                                              FALSE

19 rows selected.

SQL>

将数据库启动:
SQL> startup

ORACLE instance started.

Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
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 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;

Database altered.

SQL> select * from v$nls_parameters;查看一下

19 rows selected.

 

SQL> shutdown;
SQL> startup
ORACLE instance started.

Total System Global Area  236000356 bytes
Fixed Size                   451684 bytes
Variable Size             201326592 bytes
Database Buffers           33554432 bytes
Redo Buffers                 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$nls_parameters;大功告成,查看一下吧

你可能感兴趣的:(linux下如何修改oracle11的现有字符集)