How to modify the character set of an Oracle Database

Source: Internet
Author: User

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 --

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.