Modifying the Oracle Character set

Source: Internet
Author: User

Data import times ORA-12899 error, that is, the length of the inserted data exceeds the set length of the field, the actual length is not long, because of the different Oracle character set, the length of the Chinese characters caused by different. Chinese in the ZHS16GBK accounted for 2 bytes, in UTF-8 accounted for 3 bytes, so the Chinese character import UTF-8 character Set database is very easy to appear field length is not enough, the solution is to increase the length of the field, there is to modify the character set.

If there is already a lot of data in the system, it is recommended to modify the field length because the characters in the original database table are garbled when the character set is modified. If you have to modify the character set, you must first export the data until the character set is modified and then re-imported.

The method of viewing the character set can be used with PL/SQL DEVELOP---->reports---->DBA---->nls Database Parameters, as shown:

As shown, the character set is UTF-8, and the method for modifying the character set is as follows:

Modify the database character set to: ZHS16GBK

Start-run->cmd, input sqlplus system/[email protected] as SYSDBA
If the database server is now started, execute the SHUTDOWN IMMEDIATE command to shut down the database server.
Then execute the following command:
Sql>shutdown Immediate
Sql>startup MOUNT
Sql>alter SYSTEM ENABLE RESTRICTED SESSION;
Sql>alter SYSTEM SET job_queue_processes=0;
Sql>alter SYSTEM SET aq_tm_processes=0;
Sql>alter DATABASE OPEN;
Sql>alter DATABASE CHARACTER SET ZHS16GBK;
ERROR at line 1:ora-12721:operation cannot execute if other sessions is active
If the above error occurs, use the following method to modify, using Internal_use can skip the check of the superset:
Sql>alter DATABASE CHARACTER SET internal_use ZHS16GBK;
Sql>shutdown IMMEDIATE
Sql>startup

At this point, the character set has been modified, then the character set, the result is as follows:

Modifying the Oracle Character set

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.