溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

數(shù)據(jù)泵導(dǎo)出文件更換名稱,對(duì)導(dǎo)入操作無(wú)影響

發(fā)布時(shí)間:2020-08-11 18:18:03 來(lái)源:ITPUB博客 閱讀:261 作者:劉錫亞 欄目:關(guān)系型數(shù)據(jù)庫(kù)
問(wèn)題描述: expdp 導(dǎo)出 dmp文件 ,但是導(dǎo)出操作時(shí),dmp文件命名有誤。 mv將導(dǎo)出后的dmp文件重命名。這樣對(duì) impdp 操作會(huì)有什么影響呢?
結(jié)論:  只要命令敲對(duì),文件名寫正確,impdp操作不受影響



一、模擬開始

      scott用戶下的表

點(diǎn)擊(此處)折疊或打開

  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下的表

點(diǎn)擊(此處)折疊或打開

  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
   數(shù)據(jù)泵導(dǎo)出scott用戶下的表

點(diǎn)擊(此處)折疊或打開

  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


點(diǎn)擊(此處)折疊或打開

  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文件名


點(diǎn)擊(此處)折疊或打開

  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

導(dǎo)入到新建用戶liuyaya

點(diǎn)擊(此處)折疊或打開

  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

二、 總結(jié)

將改了名字的dmp文件順利導(dǎo)入到其他schema下,證明

    
數(shù)據(jù)庫(kù)導(dǎo)出文件可以改名字,對(duì)導(dǎo)入操作無(wú)影響







向AI問(wèn)一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI