View and modify the Oracle encoding format and modify the oracle encoding format
Zookeeper first checks the encoding of the oracle database
SQL> select * from nls_database_parameters where parameter = 'nls _ CHARACTERSET ';
PARAMETER
--------------------
VALUE
--------------------
NLS_CHARACTERSET
AL32UTF8
This is derived from props $, which indicates the character set of the database.
Oracle client Encoding
SQL> select * from nls_instance_parameters where parameter = 'nls _ LANGUAGE ';
PARAMETER
--------------------
VALUE
--------------------
NLS_LANGUAGE
SIMPLIFIED CHINESE
It is derived from v $ parameter, which indicates the character set setting of the client, which may be a parameter file, environment variable, or a registry session Character Set environment.
Select * from nls_session_parameters, which is derived from v $ nls_parameters. It indicates the session's own settings. It may be the session's environment variable or the alter session is completed. If the session has no special settings, it will be consistent with nls_instance_parameters.
Let's talk about how to modify the character set of oracle:
Currently, the character set of my database environment is AL32UTF8, so change it to ZHS16GBK
1. First, log on to conn/as sysdba.
2. Shut down the database shutdown immediate;
3. Call the database with a mount command and start up the mount command.
4. Set the session
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
SQL> ALTER SYSTEM SET JOB_QUEUE_PROCESSES = 0;
SQL> ALTER SYSTEM SET AQ_TM_PROCESSES = 0;
5. Start the database
Alter database open;
6. Modify Character Set
Alter database character set ZHS16GBK;
This may cause an error, prompting us that the new character set must be a superset of the old one. In this case, we can skip the superset check and make changes:
Alter database character set INTERNAL_USE ZHS16GBK;
This statement is enough. the help provided by TERNAL_USE will allow oracle to bypass the verification of the subset and superset. This statement is identical to the internal operation of the preceding statement.
7. Close and restart
SQL> shutdown immediate;
SQL> startup
Of course, it is best not to modify the character set easily, because this will have a direct impact on the database data. If it is a production environment, it may cause immeasurable losses.
How to change the Oracle encoding format
Utf8:
Alter database 'database' default character set utf8 COLLATE utf8_general_ci
Alter table 'data TABLE 'default character set utf8 COLLATE utf8_general_ci
Gbk (including gb2312 ):
Alter database 'database' default character set gbk COLLATE gbk_chinese_ci
Alter table 'data TABLE 'default character set gbk COLLATE gbk_chinese_ci
How to change the oracle character set encoding in Windows and Linux?
Select userenv ('language') from dual (client query)
----- View and change the oracle character set encoding in Windows
Open the registry -- HKEY_LOCAL_MACHINE \ SOFTWARE \ ORACLE \ HOMExx \ NLS_LANG
Modify the key value of NLS_LANG
# Common Chinese character sets
Set NLS_LANG = SIMPLIFIED CHINESE_CHINA.ZHS16GBK
# Common unicode character sets
Set NLS_LANG = american_america.AL32UTF8
----- View and change the oracle character set encoding in Linux
[Root @ OracleDB ~] # Cd/usr/local/oracle/
[Root @ OracleDB oracle] # env | grep NLS_LANG
NLS_LANG = american_america.zhs16gbk
[Root @ OracleDB oracle] # vi. bash_profile
# Make the bash_profile settings take effect