Oracle中IMP导入数据时提示字符集不一致解决

生产环境中经常使用到Oracle的IMP导入和EXP导出来功能来达到数据迁移的目的,通常在源数据库和目标数据库中查询字符集是否致,

测试环境中导入IMP导入报错信息如下:

导入命令如下:

[oracle@localhost.localdomain:/soft]$imp scott/scott file=/soft/scott_v1.dmp log=/soft/scott_v1.log ignore=y full=y

Import: Release 11.2.0.4.0 - Production on Sun Oct 22 16:26:27 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.


Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Export file created by EXPORT:V11.02.00 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set --提示字符集不一致
. importing SCOTT's objects into SCOTT
. . importing table                        "BONUS"          0 rows imported
. . importing table                        "DEPT"
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_DEPT) violated--提示各种乱码问题
Column 1 10
Column 2 ǎ
Column 3
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_DEPT) violated
Column 1 20
Column 2 в
Column 3 ±±
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_DEPT) violated
Column 1 30
Column 2 к
Column 3
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_DEPT) violated
Column 1 40
Column 2
Column 3           0 rows imported
. . importing table                          "EMP"
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7369
Column 2 itpux01
Column 3 τ
Column 4 7902
Column 5 17-DEC-1980:00:00:00
Column 6 800
Column 7
Column 8 20
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7499
Column 2 itpux02
Column 3 к
Column 4 7698
Column 5 20-FEB-1981:00:00:00
Column 6 1600
Column 7 300
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7521
Column 2 itpux03
Column 3 к
Column 4 7698
Column 5 22-FEB-1981:00:00:00
Column 6 1250
Column 7 500
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7566
Column 2 itpux04
Column 3
Column 4 7839
Column 5 02-APR-1981:00:00:00
Column 6 2975
Column 7
Column 8 20
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7654
Column 2 itpux05
Column 3 к
Column 4 7698
Column 5 28-SEP-1981:00:00:00
Column 6 1250
Column 7 1400
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7698
Column 2 itpux06
Column 3
Column 4 7839
Column 5 01-MAY-1981:00:00:00
Column 6 2850
Column 7
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7782
Column 2 itpux07
Column 3
Column 4 7839
Column 5 09-JUN-1981:00:00:00
Column 6 2450
Column 7
Column 8 10
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7788
Column 2 itpux08
Column 3 ·
Column 4 7566
Column 5 19-APR-1987:00:00:00
Column 6 3000
Column 7
Column 8 20
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7839
Column 2 itpux09
Column 3
Column 4
Column 5 17-NOV-1981:00:00:00
Column 6 5000
Column 7
Column 8 10
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7844
Column 2 itpux10
Column 3 к
Column 4 7698
Column 5 08-SEP-1981:00:00:00
Column 6 1500
Column 7 0
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7876
Column 2 itpux11
Column 3 τ
Column 4 7788
Column 5 23-MAY-1987:00:00:00
Column 6 1100
Column 7
Column 8 20
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7900
Column 2 itpux12
Column 3 τ
Column 4 7698
Column 5 03-DEC-1981:00:00:00
Column 6 950
Column 7
Column 8 30
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7902
Column 2 itpux13
Column 3 ·
Column 4 7566
Column 5 03-DEC-1981:00:00:00
Column 6 3000
Column 7
Column 8 20
IMP-00019: row rejected due to ORACLE error 1
IMP-00003: ORACLE error 1 encountered
ORA-00001: unique constraint (SCOTT.PK_EMP) violated
Column 1 7934
Column 2 itpux14
Column 3 τ
Column 4 7782
Column 5 23-JAN-1982:00:00:00
Column 6 1300
Column 7
Column 8 10          0 rows imported
. . importing table                    "SALGRADE"          5 rows imported
About to enable constraints...
Import terminated successfully with warnings.

如何查询字符集

方法1:查询表(在知道源数据库和目标数据库):

select * from nls_database_parameters;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/c829acb42ea79837b97f97643c0d39a2.html