公司安裝個 oracle 12c 測試環境,準備把線上的庫匯出來測試效能,結果把測試庫的字元集選了 AL32UTF8 ,一看線上是 ZHS16GBK,還是保持一致吧,遂記錄 AL32UTF8 改 ZHS16GBK 字元集過程:
首先最重要的事:備份。備份資料。別忘記備份資料。
C:\Windows\system32>sqlplus /nologSQL*Plus: Release 12.1.0.2.0 Production on 星期二 2月 27 10:59:23 2018Copyright (c) 1982, 2014, Oracle. All rights reserved.SQL> conn / as sysdba已串連。SQL> select userenv('language') from dual;USERENV('LANGUAGE')--------------------------------------------------------------------------------SIMPLIFIED CHINESE_CHINA.AL32UTF8SQL> shutdown immediate資料庫已經關閉。已經卸載資料庫。ORACLE 常式已經關閉。SQL> STARTUP MOUNT EXCLUSIVE;ORACLE 常式已經啟動。Total System Global Area 2533359616 bytesFixed Size 3835256 bytesVariable Size 738200200 bytesDatabase Buffers 1778384896 bytesRedo Buffers 12939264 bytes資料庫裝載完畢。SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;系統已更改。SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES=0;系統已更改。SQL> ALTER SYSTEM SET AQ_TM_PROCESSES=0;系統已更改。SQL> ALTER DATABASE OPEN;資料庫已更改。SQL> ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;資料庫已更改。SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE AL16UTF16;資料庫已更改。SQL> SHUTDOWN IMMEDIATE資料庫已經關閉。已經卸載資料庫。ORACLE 常式已經關閉。SQL> STARTUPORACLE 常式已經啟動。Total System Global Area 2533359616 bytesFixed Size 3835256 bytesVariable Size 738200200 bytesDatabase Buffers 1778384896 bytesRedo Buffers 12939264 bytes資料庫裝載完畢。資料庫已經開啟。SQL> select userenv('language') from dual;USERENV('LANGUAGE')----------------------------------------------------SIMPLIFIED CHINESE_CHINA.ZHS16GBKSQL> col parameter format a32;SQL> col value format a32;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 AMERICAN已選擇 20 行。SQL>
oracle 12c 將 AL32UTF8 字元集修改為 ZHS16GBK 完成。