Oracle迁移时遇到的ORA-02374,ORA-12899,ORA-02372

ORA-02374: conversion error loading table"PW_SAC".“DM_QW12”
ORA-12899: value too large for columnRUNNING_CODE (actual: 82, maximum: 80)
ORA-02372: data for row:RUNNING_CODE0X’BDE2D4AAC0EFD0A1D1A7D7DBBACFB7BFD6C1C1FABDF2C9CCC3’

故障分析:
源数据库字符集: al32utf8
目标端数据库字符集:zhsgbk16

zhsgbk16 和 utf8 对数据编码之后,存储格式不同,对于中文来讲,gbk存放一个汉字占用2个字节,utf8存放一个汉字占用3个字节,这样就会导致,比方说:原先GBK字符编码的数据库中的某张表中,存放中文的字段:colum001的类型是varchar 长度为200 ,并且该字段的大多数行的现有数据长度基本上在180个字节,那么该表导入UTF8编码的数据库中时,该字段原先存储的大多数180个字节的汉字,就需要180*3/2=270个字节左右的字符长度才能正常存放;而此时在执行impdp导入操作的时候,表结构是不会改变的,也就是原先的字段定义colum001的长度还是保持着200,因此在导入的时候,就会报错,出现上述错误信息。

处理方式:
第一种:重新导出,导入 ,我没有选择

第二种:如果不想改变目标端数据库的字符集,那么修改源数据库字符集(更改数据库字符集的操作不建议使用),然后执行重新导出操作,详细的步骤如下

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

Total System Global Area 2.0200E+10 bytes
Fixed Size		   19247928 bytes
Variable Size		 5033168072 bytes
Database Buffers	 1.5099E+10 bytes
Redo Buffers		   47857664 bytes
SQL> alter database mount exclusive;

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

Database altered.

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

Total System Global Area 2.0200E+10 bytes
Fixed Size		   19247928 bytes
Variable Size		 5033168072 bytes
Database Buffers	 1.5099E+10 bytes
Redo Buffers		   47857664 bytes
Database mounted.
Database opened.

你可能感兴趣的:(oracle,oracle,三朝看客,数据库)