search
HomeDatabaseMysql TutorialOracle 字符集修改(ORA-29275 )

今天有朋友数据库出现ORA-29275 部分多字节字符,对应的字段只能用to_char才能正常查询,感觉是字符集问题。询问之果然修改过字符

今天有朋友数据库出现ORA-29275 部分多字节字符,对应的字段只能用to_char才能正常查询,感觉是字符集问题。询问之果然修改过字符集。

他的修改方式:

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

查看数据库:

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

确实已经修改好了。但是这里:

ALTER DATABASE CHARACTER SET INTERNAL_USE ZHS16GBK;

是非常有问题的,这里跳过字符集子集检查,强制进行修改。

所以以后的数据将会出现问题。

那么我们使用exp/imp在导出的时候指定字符集进行转换呢?

引入一篇文章的部分段落:

9i之前的版本:在源数据库的字符集和export的session的NLS_LANG设置不同时,,所有数据的字符集(用户数据和字典数据)均会转换;

在import过程中,如果import session的NLS_LANG和export时不一致,将会将dmp中的字符集转换成import session的NLS_LANG设置成的字符集;

当import session的NLS_LANG和目标数据库的字符集不一致时,将会发生公import session的NLS_LANG字符集到目标数据库的字符集转换

9i及之后的版本:在源数据库的字符集和export的session的NLS_LANG设置不同时,只有字典数据会发生字符集转换,用户数据则和源数据库的字符集一致,而忽略NLS_LANG的设置;

在import过程中,如果import session的NLS_LANG和export时不一致,将会将dmp中的字符集转换成import session的NLS_LANG设置成的字符集;

当import session的NLS_LANG和目标数据库的字符集不一致时,将会发生公import session的NLS_LANG字符集到目标数据库的字符集转换

其实都没关系,不管你用什么办法转换,只要转换的字符集不是原字符集的超集都是有问题的:

所以我们在修改数据库字符集的时候,执行如下语句:

ALTER DATABASE CHARACTER SET ZHS16GBK

如果没有报:

SYS@zbdba>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

那说明可以修改。如果有以上错误,建议不要修改强制修改字符集

Oracle关于字符集的分析 

Oracle数据库字符集研究

本文永久更新链接地址:

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
3 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Atom editor mac version download

Atom editor mac version download

The most popular open source editor