Oracle 12C modify database character set method + modify client character set method:
Oracle 12C can modify the character set of PDB separately, which will be described later. This time, it adopts the method of modifying all the CDB:
First, query the database character set:
Select * from nls_database_parameters where parameter='NLS_CHARACTERSET'
Select * from nls_database_parameters
Select * from v$nls_parameters
Select userenv ('language') nls_lang from dual
Server character set modification
SQL > sqlplus / as sysdba;-Log in to the CDB library
SQL > shutdown immediate
SQL > startup mount
SQL > show parameter job_queue_processes;-remember the parameter value 4000. Finally, after changing the character set, you need to change these parameters to the original values.
SQL > show parameter aq_tm_processes;-remember the parameter value 1. Finally, after changing the character set, you need to change these parameters to the original values.
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
-- (alter database character set ZHS16GBK;-- modify the character set statement normally, but misuse the following statement when a hypersubset is reported)
ORA-12712: new character set must be a superset of old character set
An error indicates that the new character set must be a superset of the old character set, that is, the original character set is a subset of the new character set.
Use the Oracle internal command internal_use to skip using superset checking.
SQL > alter database character set INTERNAL_USE ZHS16GBK;-- change the local character set and skip supersubset detection
-- (SQL > alter system set cluster_database=FALSE scope=spfile sid='*';-- if it is a RAC execution, there may be an error. To execute this sentence, a single instance will not report an error, and there is no need to execute it. )
-SQL > ALTER DATABASE national CHARACTER SET INTERNAL ZHS16GBK;-- change the international character set. Sometimes it doesn't need to be changed, but not this time.
SQL > shutdown immediate
SQL > startup mount
-(SQL > alter system set cluster_database=TRUE scope=spfile sid='*';-- only RAC executes, if RAC executes the sentence at that location)
SQL > alter system set job_queue_processes=4000
SQL > alter system set aq_tm_processes=1
SQL > show parameter cluster_database
SQL > show parameter job_queue_processes
SQL > alter database open
Select * from nls_database_parameters where parameter='NLS_CHARACTERSET'
Select * from nls_database_parameters
Select * from v$nls_parameters
Select userenv ('language') nls_lang from dual
SIMPLIFIED CHINESE_CHINA.ZHS16GBK
Modify the client character set method:
Client character set modification
In .bash _ profile under / home/oracle and / root user directories
Add or modify export NLS_LANG= "AMERICAN_AMERICA.UTF8" statements
Closes the current ssh window.