Oracle is modified to be encoded as GBK.

Keywords: Database SQL Oracle encoding

Because of importing the database file a few days ago, it has been unsuccessful to import, because when I install oracle, my code chooses UTF-8, and a text is stored in 3 bytes, which leads to a lot of data confusion and the length of the field. Modify the code after GBK to solve the problem. The following is a summary of commands when modifying encoding.

First of all, it is recommended to modify the encoding of plsql, modify the environment variables, right-click on my computer to click properties, and then enter the advanced system settings.

NLS_LANG
SIMPLIFIED CHINESE_CHINA.ZHS16GBK

Next, open the cmd black window: execute in turn.

SQL> set ORACLE_SID=The one you want to enter the database sid,Mine is orcl
SQL> sqlplus /nolog

SQL> conn /as sysdba
Connected. 

SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 

SQL> startup mount
Total System Global Area  236000356 bytes 
Fixed Size                   451684 bytes 
Variable Size             201326592 bytes 
Database Buffers           33554432 bytes 
Redo Buffers                 667648 bytes 
Database mounted.

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 ZHS16GBK;
ALTER DATABASE CHARACTER SET ZHS16GBK 
* 
ERROR at line 1: 
ORA-12712: new character set must be a superset of old character set
//Hint our character set: The new character set must be a superset of the old character set, at which time we can skip the checking of the superset to make changes:

SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
Database altered.

SQL> select * from v$nls_parameters;
//slightly 
19 rows selected. 

SQL> shutdown immediate; 
Database closed. 
Database dismounted. 
ORACLE instance shut down. 

SQL> startup
ORACLE instance started. 
Total System Global Area  236000356 bytes 
Fixed Size                   451684 bytes 
Variable Size             201326592 bytes 
Database Buffers           33554432 bytes 
Redo Buffers                 667648 bytes 
Database mounted. 
Database opened. 

 

Posted by Dinosoles on Tue, 01 Oct 2019 02:41:28 -0700