Change Oracle Character Set: replace Character Set ZHS16GBK with UTF8

Source: Internet
Author: User
Change Oracle Character Set: replace Character Set ZHS16GBK with UTF8

Change Oracle Character Set: replace Character Set ZHS16GBK with UTF8

SQL> select name, value $ from props $ where name like '% NLS % ';

Name value $
------------------------------------------------------------
NLS_LANGUAGE AMERICAN
NLS_TERRITORY AMERICA
NLS_CURRENCY $
NLS_ISO_CURRENCY AMERICA
NLS_NUMERIC_CHARACTERS .,
NLS_CHARACTERSET ZHS16GBK
NLS_CALENDAR GREGORIAN
NLS_DATE_FORMAT DD-MON-RR
NLS_DATE_LANGUAGE AMERICAN
NLS_SORT BINARY
NLS_TIME_FORMAT HH. MI. SSXFF AM

Name value $
------------------------------------------------------------
NLS_TIMESTAMP_FORMAT DD-MON-RR HH. MI. SSXFF AM
NLS_TIME_TZ_FORMAT HH. MI. SSXFF AM TZR
NLS_TIMESTAMP_TZ_FORMAT DD-MON-RR HH. MI. SSXFF AM TZR
NLS_DUAL_CURRENCY $
NLS_COMP BINARY
NLS_LENGTH_SEMANTICS BYTE
NLS_NCHAR_CONV_EXCP FALSE
NLS_NCHAR_CHARACTERSET AL16UTF16
NLS_RDBMS_VERSION 10.2.0.1.0

20 rows selected.

NLS_CHARACTERSET is the database character set, and NLS_NCHAR_CHARACTERSET is the National Character Set
There are two types of structured data in Oracle, and VARCHAR2 stores data according to the database character set.
NVARCHAR2 stores data according to the national character set. Similarly, CHAR and NCHAR are the same. One is the database character, and the other is the national character set.


Converts character sets. The database should be in RESTRICTED mode.
First, determine whether the modified character set is a superset before modification. If it is not possible that the same code point corresponds to different characters, garbled characters may occur.

This error indicates that oracle only supports the transition from a subset to a superset.
So what method can be forced conversion?
This command will skip the subset and superset check. Of course, forced conversion may cause data corruption. Exercise caution when using this command !!
The following is an execution of the post with the help of eygle.

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

Total System Global Area 1845493760 bytes
Fixed Size 2021568 bytes
Variable Size 452986688 bytes
Database Buffers 1375731712 bytes
Redo Buffers 14753792 bytes
Database mounted.
SQL> alter session set SQL _trace = true;

Session altered.

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 INTERNAL_USE UTF8;

Database altered.

SQL> update props $ set VALUE $ = 'utf8' where

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.