1.导入表并验证:
04:54:48 SYS@ORA11GR2>grant connect,resource to jj identified by jj; Grant succeeded. 04:55:43 SYS@ORA11GR2>conn jj/jj
Connected. 2.[oracle@host03 datadump]$ impdp system/oracle directory=dir_dp dumpfile=emp30.dmp remap_schema=scott:jj Import: Release 11.2.0.4.0 - Production on Wed Dec 14 04:56:54 2016 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 "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** directory=dir_dp dumpfile=emp30.dmp remap_schema=scott:jj
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "JJ"."EMP" 8.25 KB 6 rows
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
ORA-39083: Object type REF_CONSTRAINT failed to create with error:
ORA-00942: table or view does not exist
Failing sql is:
ALTER TABLE "JJ"."EMP" ADD CONSTRAINT "FK_DEPTNO" FOREIGN KEY ("DEPTNO") REFERENCES "JJ"."DEPT" ("DEPTNO") ENABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_FULL_01" completed with 1 error(s) at Wed Dec 14 04:57:01 2016 elapsed 0 00:00:06 3.验证:d.
04:56:41 JJ@ORA11GR2>select tname from tab; TNAME
------------------------------
EMP
2.导入schema:
①删除用户
04:59:18 SYS@ORA11GR2>drop user scott cascade; User dropped.
②创建用户
05:00:32 SYS@ORA11GR2>create user scott identified by tiger; User created. 05:00:45 SYS@ORA11GR2>grant connect,resource to scott; Grant succeeded. ③[oracle@host03 datadump]$ impdp system/oracle directory=dir_dp dumpfile=scott_all_tab.dmp Import: Release 11.2.0.4.0 - Production on Wed Dec 14 05:04:51 2016 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 "SYSTEM"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SYSTEM"."SYS_IMPORT_FULL_01": system/******** directory=dir_dp dumpfile=scott_all_tab.dmp
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."S1_BASE" 5.914 KB 3 rows
. . imported "SCOTT"."SALGRADE" 5.859 KB 5 rows
. . imported "SCOTT"."BONUS" 0 KB 0 rows
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SYSTEM"."SYS_IMPORT_FULL_01" successfully completed at Wed Dec 14 05:04:55 2016 elapsed 0 00:00:03
④05:05:18 SCOTT@ORA11GR2>select tname from tab; TNAME
------------------------------
BONUS
S1_BASE
SALGRADE