oracle修改CHARACTERSET

[oracle@vm10-84-32-2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 11 19:53:38 2020

Copyright (c) 1982, 2013, Oracle. All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> spool 2017_12_08.txt
SQL> set line 4000
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')--------------------------------------------------------------------------------------------------------AMERICAN_AMERICA.AL32UTF8
 
SQL> select * from v$nls_parameters;
PARAMETER VALUE-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------NLS_LANGUAGE AMERICANNLS_TERRITORY AMERICANLS_CURRENCY $NLS_ISO_CURRENCY AMERICANLS_NUMERIC_CHARACTERS .,NLS_CALENDAR GREGORIANNLS_DATE_FORMAT DD-MON-RRNLS_DATE_LANGUAGE AMERICANNLS_CHARACTERSET AL32UTF8NLS_SORT BINARYNLS_TIME_FORMAT HH.MI.SSXFF AM
PARAMETER VALUE-------------------------------------------------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------------------------------------------------NLS_TIMESTAMP_FORMAT DD-MON-RR HH.MI.SSXFF AMNLS_TIME_TZ_FORMAT HH.MI.SSXFF AM TZRNLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH.MI.SSXFF AM TZRNLS_DUAL_CURRENCY $NLS_NCHAR_CHARACTERSET AL16UTF16NLS_COMP BINARYNLS_LENGTH_SEMANTICS BYTENLS_NCHAR_CONV_EXCP FALSE
19 rows selected.
SQL>

SQL> shutdown immediate
数据库已经关闭。已经卸载数据库。ORACLE 例程已经关闭。SQL> startup mountORACLE 例程已经启动。
Total System Global Area 3373858816 bytesFixed Size 2180424 bytesVariable Size 1946159800 bytesDatabase Buffers 1409286144 bytesRedo Buffers 16232448 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 utf8;
alter database character set utf8
*
ERROR at line 1:
ORA-12712: new character set must be a superset of old character set


SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE UTF8;

Database altered.

SQL> alter database character set internal_convert utf8;

Database altered.

SQL> ALTER DATABASE NATIONAL CHARACTER SET INTERNAL_USE UTF8;

Database altered.

SQL> alter database character set  utf8;

Database altered.

SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup
ORACLE 例程已经启动。

Total System Global Area 3373858816 bytes
Fixed Size 2180424 bytes
Variable Size 1946159800 bytes
Database Buffers 1409286144 bytes
Redo Buffers 16232448 bytes
数据库装载完毕。
数据库已经打开。
SQL> select userenv('language') from dual;

USERENV('LANGUAGE')--------------------------------------------------------------------------------------------------------AMERICAN_AMERICA.UTF8

vi .bash_profile

[oracle@vm10-84-32-2 ~]$ whoami
oracle
[oracle@vm10-84-32-2 ~]$ vi .bash_profile添加以下语句
#export NLS_LANG=AMERICAN_AMERICA.ZHS16GBKexport NLS_LANG="SIMPLIFIED CHINESE_CHINA".AL32UTF8

posted @ 2021-04-29 17:36  leihongnu  阅读(775)  评论(0编辑  收藏  举报