取了个 dmp 文件,导入报错了,原因是 dmp 文件是通过 expdp 方法导出的,只能通过 impdp 方法导入才行。
C:\Users\Administrator>imp ncc_qt/1@orcl file=f:\ncc0303.dmp
报错信息如下:
IMP-00038: Could not convert to environment character set's handle
IMP-00000: Import terminated unsuccessfully
impdp 导入功能演示: 先登录 oracle 库。
C:\Users\Administrator>sqlplus ncc_qt/1@orcl
SQL*Plus: Release 11.2.0.4.0 Production on Tue Jun 2 15:38:00 2020
Copyright (c) 1982, 2013, Oracle. 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
然后创建一个 directory,路径指向 dmp 文件所在的位置。 然后 quit 退出来。
SQL> create directory dmp_site as 'f:';
Directory created.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64
bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
dumpfile 直接对应 dmp 名即可。 remap_schema=A:B 命令可以用来把原来 A shema 表的数据导入到 B 表中。
C:\Users\Administrator>impdp ncc_qt/1@orcl directory=dmp_site dumpfile=ncc0303.d
mp remap_schema=ncc0303:ncc_qt
Import: Release 11.2.0.4.0 - Production on Tue Jun 2 16:20:18 2020
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
Master table "NCC_QT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "NCC_QT"."SYS_IMPORT_FULL_01": ncc_qt/********@orcl directory=dmp_site
dumpfile=ncc0303.dmp remap_schema=ncc0303:ncc_qt
Processing object type SCHEMA_EXPORT/USER
ORA-31684: Object type USER:"NCC_QT" already exists
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
... 省略导入过程
. . imported "NCC_QT"."ZDP_1000000000JJR1" 0 KB 0 rows
. . imported "NCC_QT"."ZDP_1000000000JJR3" 0 KB 0 rows
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/INDEX/FUNCTIONAL_INDEX/INDEX
Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/FUNCTIONAL_INDEX/IND
EX_STATISTICS
Processing object type SCHEMA_EXPORT/VIEW/VIEW
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "NCC_QT"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Tue Jun 2 16:35:1
2 2020 elapsed 0 00:14:54