网站建设资讯

NEWS

网站建设资讯

数据泵导出文件更换名称,对导入操作无影响

问题描述: expdp 导出 dmp文件 ,但是导出操作时,dmp文件命名有误。 mv将导出后的dmp文件重命名。这样对 impdp 操作会有什么影响呢?
结论:  只要命令敲对,文件名写正确,impdp操作不受影响



一、模拟开始

      scott用户下的表

点击(此处)折叠或打开

目前创新互联公司已为上千多家的企业提供了网站建设、域名、网站空间、网站托管、服务器托管、企业网站设计、石龙网站维护等服务,公司将坚持客户导向、应用为本的策略,正道将秉承"和谐、参与、激情"的文化,与客户和合作伙伴齐心协力一起成长,共同发展。

  1. SQL> conn scott/tiger
  2. Connected.
  3. SQL>
  4. SQL> select count(*) from tab;

  5.   COUNT(*)
  6. ----------
  7.      4

  8. SQL> select * from tab;

  9. TNAME             TABTYPE    CLUSTERID
  10. ------------------------------ ------- ----------
  11. BONUS             TABLE
  12. DEPT             TABLE
  13. EMP             TABLE
  14. SALGRADE         TABLE
  新建用户liuyaya下的表

点击(此处)折叠或打开

  1. SQL> conn / as sysdba
  2. Connected.
  3. SQL>
  4. SQL>
  5. SQL> create user liuyaya identified by oracle account unlock;


  6. User created.

  7. SQL> SQL>
  8. SQL>
  9. SQL>
  10. SQL> grant connect,resource to liuyaya;

  11. Grant succeeded.

  12. SQL>
  13. SQL> conn liuyaya/oracle
  14. Connected.
  15. SQL> select count(1) from tab;

  16.   COUNT(1)
  17. ----------
  18.      0
   数据泵导出scott用户下的表

点击(此处)折叠或打开

  1. SQL> conn sys/oracle as sysdba
  2. Connected.
  3. SQL> create or replace directory expdp_dir_scott01 as '/soft';

  4. Directory created.

  5. SQL> grant read,write on directory expdp_dir_scott01 to scott;

  6. Grant succeeded.

  7. SQL> exit


点击(此处)折叠或打开

  1. [oracle@redhat6 ~]$ expdp scott/tiger directory=expdp_dir_scott01 schemas=scott datafile=scott01.dmp logfile=scott01.log parallel=2;
  2. LRM-00101: unknown parameter name 'datafile'

  3. [oracle@redhat6 ~]$ expdp scott/tiger directory=expdp_dir_scott01 schemas=scott dumpfile=scott01.dmp logfile=scott01.log parallel=2;

  4. Export: Release 11.2.0.4.0 - Production on Thu Jun 21 19:15:52 2018

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

  6. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  7. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  8. Starting "SCOTT"."SYS_EXPORT_SCHEMA_01": scott/******** directory=expdp_dir_scott01 schemas=scott dumpfile=scott01.dmp logfile=scott01.log parallel=2
  9. Estimate in progress using BLOCKS method...
  10. Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
  11. Total estimation using BLOCKS method: 192 KB
  12. . . exported "SCOTT"."DEPT" 5.929 KB 4 rows
  13. Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
  14. . . exported "SCOTT"."EMP" 8.562 KB 14 rows
  15. . . exported "SCOTT"."SALGRADE" 5.859 KB 5 rows
  16. . . exported "SCOTT"."BONUS" 0 KB 0 rows
  17. Processing object type SCHEMA_EXPORT/TABLE/TABLE
  18. Processing object type SCHEMA_EXPORT/TABLE/COMMENT
  19. Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
  20. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
  21. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
  22. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
  23. Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
  24. Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
  25. ******************************************************************************
  26. Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
  27.   /soft/scott01.dmp
  28. Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at Thu Jun 21 19:16:13 2018 elapsed 0 00:00:20
   修改dumpfile文件名


点击(此处)折叠或打开

  1. [oracle@redhat6 ~]$ cd /soft
  2. [oracle@redhat6 soft]$ ls
  3. database scott01.dmp scott01.log zjgd_back
  4. [oracle@redhat6 soft]$ mv scott01.dmp liuyaya.dmp
  5. [oracle@redhat6 soft]$ ls
  6. database liuyaya.dmp scott01.log zjgd_back

导入到新建用户liuyaya

点击(此处)折叠或打开

  1. [oracle@redhat6 soft]$ impdp \'/ as sysdba\' directory=expdp_dir_scott01 dumpfile=liuyaya.dmp remap_schema=scott:liuyaya logfile=liuyaya.log parallel=2

  2. Import: Release 11.2.0.4.0 - Production on Thu Jun 21 20:18:01 2018

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

  4. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
  5. With the Partitioning, OLAP, Data Mining and Real Application Testing options
  6. Master table "SYS"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
  7. Starting "SYS"."SYS_IMPORT_FULL_01": "/******** AS SYSDBA" directory=expdp_dir_scott01 dumpfile=liuyaya.dmp remap_schema=scott:liuyaya logfile=liuyaya.log parallel=2
  8. Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
  9. Processing object type SCHEMA_EXPORT/TABLE/TABLE
  10. Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
  11. . . imported "LIUYAYA"."DEPT" 5.929 KB 4 rows
  12. . . imported "LIUYAYA"."EMP" 8.562 KB 14 rows
  13. . . imported "LIUYAYA"."SALGRADE" 5.859 KB 5 rows
  14. . . imported "LIUYAYA"."BONUS" 0 KB 0 rows
  15. Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
  16. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
  17. Processing object type SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
  18. Processing object type SCHEMA_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
  19. Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
  20. Job "SYS"."SYS_IMPORT_FULL_01" successfully completed at Thu Jun 21 20:18:05 2018 elapsed 0 00:00:02

  21. [oracle@redhat6 soft]$ sqlplus liuyaya/oracle

  22. SQL*Plus: Release 11.2.0.4.0 Production on Thu Jun 21 20:18:18 2018

  23. Copyright (c) 1982, 2013, Oracle. All rights reserved.


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

  27. SQL> select * from tab;

  28. TNAME             TABTYPE    CLUSTERID
  29. ------------------------------ ------- ----------
  30. BONUS             TABLE
  31. DEPT             TABLE
  32. EMP             TABLE
  33. SALGRADE         TABLE

二、 总结

将改了名字的dmp文件顺利导入到其他schema下,证明
    
数据库导出文件可以改名字,对导入操作无影响







新闻标题:数据泵导出文件更换名称,对导入操作无影响
链接分享:http://njwzjz.com/article/ihichd.html