今天有朋友数据库出现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数据库字符集研究
本文永久更新链接地址:

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

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

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

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

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

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

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]

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

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
The most popular open source editor
