Oracle使用数据泵 (expdp/impdp)实施迁移(4)

wKiom1j-BcTBdrw6AADuhBW6_ic811.png

wKiom1j-BcWgPIqNAAC1naQULSM083.png

1. 首先需要创建Directory

wKioL1j-Bd7CmKbRAAAuV3gdiRI802.png

wKiom1j-Bd-gEvXbAAAXp8PFbe0744.png

2. 使用impdp导入用户数据 2.1 导入scott用户的元数据,且不包含统计信息;

[oracle@seiang ~]$ impdp system directory=imp_wjq dumpfile=scott_meta.dmplogfile=imp_scott_meta.log

Import: Release 12.2.0.1.0 - Production on Mon Apr 24 15:26:30 2017

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

Password:

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0- 64bit Production

Master table "SYSTEM"."SYS_IMPORT_FULL_01"successfully loaded/unloaded

Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** directory=imp_wjqdumpfile=scott_meta.dmp logfile=imp_scott_meta.log

Processing object type SCHEMA_EXPORT/USER

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

Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT

Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT

Job "SYSTEM"."SYS_IMPORT_FULL_01" successfullycompleted at Mon Apr 24 15:27:15 2017 elapsed 0 00:00:20

2.2 导入scott用户的数据;

只有在2.1导入元数据后才可以导入数据。

[oracle@seiang ~]$ impdp system directory=imp_wjq dumpfile=scott_data.dmplogfile=imp_scott_data.log

Import: Release 12.2.0.1.0 - Production on Mon Apr 24 15:29:27 2017

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

Password:

Connected to: Oracle Database 12c Enterprise Edition Release12.2.0.1.0 - 64bit Production

Master table "SYSTEM"."SYS_IMPORT_FULL_01"successfully loaded/unloaded

Starting "SYSTEM"."SYS_IMPORT_FULL_01":  system/******** directory=imp_wjqdumpfile=scott_data.dmp logfile=imp_scott_data.log

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "SCOTT"."DEPT"                              5.929 KB      4 rows

. . imported "SCOTT"."EMP"                              8.562 KB      14 rows

. . imported "SCOTT"."SALGRADE"                          5.859 KB      5 rows

. . imported "SCOTT"."BONUS"                                0 KB      0 rows

Job "SYSTEM"."SYS_IMPORT_FULL_01" successfullycompleted at Mon Apr 24 15:29:44 2017 elapsed 0 00:00:12

2.3 只导入scott用户下的emp表及数据;

[oracle@seiang ~]$ impdp scott directory=imp_wjq tables=empdumpfile=scott_emp_dept.dmp logfile=imp_scott_emp.log

Import: Release 12.2.0.1.0 - Production on Mon Apr 24 15:40:56 2017

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

Password:

Connected to: Oracle Database 12c Enterprise Edition Release12.2.0.1.0 - 64bit Production

ORA-39002:invalid operation

ORA-39070:Unable to open the log file.

ORA-39087:directory name IMP_WJQ is invalid

 

因为在导入的时候没有给imp_wjq目录赋予read和write的权限,所以会出现上面的错误,下面就给imp_wjq目录授权:

 

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

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