千家信息网

Oracle12c DB字符集ZHS16GBK改为AL32UTF8

发表于:2025-01-21 作者:千家信息网编辑
千家信息网最后更新 2025年01月21日,一、查看字符集SQL> select * from v$version;BANNER
千家信息网最后更新 2025年01月21日Oracle12c DB字符集ZHS16GBK改为AL32UTF8

一、查看字符集

SQL> select * from v$version;BANNER                                                                               CON_ID-------------------------------------------------------------------------------- ----------Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production              0PL/SQL Release 12.1.0.2.0 - Production                                                    0CORE    12.1.0.2.0      Production                                                                0TNS for Linux: Version 12.1.0.2.0 - Production                                            0NLSRTL Version 12.1.0.2.0 - Production                                                    0SQL> select userenv('language') from dual;USERENV('LANGUAGE')----------------------------------------------------AMERICAN_AMERICA.ZHS16GBKSQL> SQL> select * from v$nls_parameters;PARAMETER                      VALUE                              CON_ID------------------------------ ------------------------------ ----------NLS_LANGUAGE                   AMERICAN                                0NLS_TERRITORY                  AMERICA                                 0NLS_CURRENCY                   $                                       0NLS_ISO_CURRENCY               AMERICA                                 0NLS_NUMERIC_CHARACTERS         .,                                      0NLS_CALENDAR                   GREGORIAN                               0NLS_DATE_FORMAT                DD-MON-YYYY HH24:MI:SS                  0NLS_DATE_LANGUAGE              AMERICAN                                0NLS_CHARACTERSET               ZHS16GBK                                0NLS_SORT                       BINARY                                  0NLS_TIME_FORMAT                HH.MI.SSXFF AM                          0PARAMETER                      VALUE                              CON_ID------------------------------ ------------------------------ ----------NLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AM                0NLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZR                      0NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZR            0NLS_DUAL_CURRENCY              $                                       0NLS_NCHAR_CHARACTERSET         AL16UTF16                               0NLS_COMP                       BINARY                                  0NLS_LENGTH_SEMANTICS           BYTE                                    0NLS_NCHAR_CONV_EXCP            FALSE                                   019 rows selected.SQL> SQL> select * from nls_database_parameters;PARAMETER                      VALUE------------------------------ ------------------------------NLS_RDBMS_VERSION              12.1.0.2.0NLS_NCHAR_CONV_EXCP            FALSENLS_LENGTH_SEMANTICS           BYTENLS_COMP                       BINARYNLS_DUAL_CURRENCY              $NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZRNLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZRNLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AMNLS_TIME_FORMAT                HH.MI.SSXFF AMNLS_SORT                       BINARYNLS_DATE_LANGUAGE              AMERICANPARAMETER                      VALUE------------------------------ ------------------------------NLS_DATE_FORMAT                DD-MON-RRNLS_CALENDAR                   GREGORIANNLS_NUMERIC_CHARACTERS         .,NLS_NCHAR_CHARACTERSET         AL16UTF16NLS_CHARACTERSET               ZHS16GBKNLS_ISO_CURRENCY               AMERICANLS_CURRENCY                   $NLS_TERRITORY                  AMERICANLS_LANGUAGE                   AMERICAN20 rows selected.

二、修改字符集

SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup mount;ORACLE instance started.Total System Global Area 1778384896 bytesFixed Size                  2925408 bytesVariable Size            1627393184 bytesDatabase Buffers          134217728 bytesRedo Buffers               13848576 bytesDatabase mounted.SQL> alter session set sql_trace=true; Session 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 INTERNAL_USE AL32UTF8;Database altered.SQL> shutdown immediate;Database closed.Database dismounted.ORACLE instance shut down.SQL> startup ORACLE instance started.Total System Global Area 1778384896 bytesFixed Size                  2925408 bytesVariable Size            1627393184 bytesDatabase Buffers          134217728 bytesRedo Buffers               13848576 bytesDatabase mounted.Database opened.SQL> select * from nls_database_parameters;PARAMETER                      VALUE------------------------------ ------------------------------NLS_RDBMS_VERSION              12.1.0.2.0NLS_NCHAR_CONV_EXCP            FALSENLS_LENGTH_SEMANTICS           BYTENLS_COMP                       BINARYNLS_DUAL_CURRENCY              $NLS_TIMESTAMP_TZ_FORMAT        DD-MON-RR HH.MI.SSXFF AM TZRNLS_TIME_TZ_FORMAT             HH.MI.SSXFF AM TZRNLS_TIMESTAMP_FORMAT           DD-MON-RR HH.MI.SSXFF AMNLS_TIME_FORMAT                HH.MI.SSXFF AMNLS_SORT                       BINARYNLS_DATE_LANGUAGE              AMERICANPARAMETER                      VALUE------------------------------ ------------------------------NLS_DATE_FORMAT                DD-MON-RRNLS_CALENDAR                   GREGORIANNLS_NUMERIC_CHARACTERS         .,NLS_NCHAR_CHARACTERSET         AL16UTF16NLS_CHARACTERSET               AL32UTF8NLS_ISO_CURRENCY               AMERICANLS_CURRENCY                   $NLS_TERRITORY                  AMERICANLS_LANGUAGE                   AMERICAN20 rows selected.
0