Environment:
OS: Red Hat Linux As 5
DB: Oracle 10.2.0.4
Generally, the character set is selected during installation. to modify the character set of the database, we recommend that you recreate the database (EXP/EXPDP export before importing ), although Oracle official documentation also says how to modify character sets, this is not the method recommended by Orale. the following describes how to modify character sets in Oracle official documents.
1. view the current database Character Set
Select * from nls_database_parameters
Where parameter = 'nls _ CHARACTERSET ';
-----------------------------------
PARAMETER VALUE
NLS_CHARACTERSET WE8ISO8859P1
The character set WE8ISO8859P1 does not support Chinese characters.
2. Change the character set to the Chinese Character Set ZHS16GBK
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP MOUNT;
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 264244292 bytes
Database Buffers 465567744 bytes
Redo Buffers 2969600 bytes
Database mounted.
SQL> ALTER SYSTEM ENABLE RESTRICTED SESSION;
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
SQL> ALTER DATABASE character set INTERNAL_USE ZHS16GBK;
Database altered.
SQL> SHUTDOWN IMMEDIATE;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 734003200 bytes
Fixed Size 1221564 bytes
Variable Size 264244292 bytes
Database Buffers 465567744 bytes
Redo Buffers 2969600 bytes
Database mounted.
Database opened.
In this way, the character set of the database is changed from WE8ISO8859P1 to ZHS16GBK. If the original character set contains Chinese characters, garbled characters are displayed, but the new Chinese Character Set is displayed normally.
-- The End --