问题由来,解决[Err] ORA-12899: 列 "XXXXX"."XXXXXXX"."XXXXX" 的值太大 (实际值: 48, 最大值: 40),
从公司数据库复制数据到本地数据库,出现如上错误,字段长度过长,但是公司数据库却没有问题,
原因:数据库的字符集不同导致的,
解决:修改本地数据库的字符集更改为ZHS16GBK
1,查看数据库的字符集 select * from v$nls_parameters;
公司是ZHS16GBK
本地是
2,修改本地oracle字符集为ZHS16GBK
1.cmd下,cd到oracle数据库软件的服务器端 如:D:\app\Administrator\product\11.2.0\dbhome_1\BIN
2.输入set ORACLE_SID=你想进入的数据库的那个sid
3.输入 sqlplus /nolog
4.将数据库启动到RESTRICTED模式下做字符集更改:
SQL> conn /as sysdba
Connected.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
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 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> select * from v$nls_parameters;
略
19 rows selected.
重启检查是否更改完成:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 236000356 bytes
Fixed Size 451684 bytes
Variable Size 201326592 bytes
Database Buffers 33554432 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.
SQL> select * from v$nls_parameters;
至此修改成功,
打开navicat 却报错 如下 ORA-29275:partial multibyte character
解决:把本地环境变量NLS_LANG的值改成所修改的字符集格式
重新打开navicat,,解决问题!