Oracle 客户端 使用 expdp/impdp 示例 说明
?
一.客戶端使用expdp/impdp說明
?
有關(guān)Oracle expdp/impdp 命令之前也整理了一些文檔,鏈接如下:
exp/imp 與 expdp/impdp 對比 及使用中的一些優(yōu)化事項(xiàng)
http://blog.csdn.net/tianlesoftware/article/details/6093973
?
Oracle 10g Data Pump Expdp/Impdp 詳解
http://blog.csdn.net/tianlesoftware/article/details/4674224
?
Oracle expdp/impdp 使用示例
http://blog.csdn.net/tianlesoftware/article/details/6260138
?
Oracle expdp/impdp 從高版本 到 低版本 示例
http://blog.csdn.net/tianlesoftware/article/details/6533421
?
?????? 此篇文章主要說明一個(gè)觀點(diǎn):可以客戶端使用expdp/impdp 命令。網(wǎng)上的很多文章都說expdp/impdp 是服務(wù)端命令,只能在服務(wù)端使用。實(shí)際上這種說法有一定的問題,先看官網(wǎng)的一段文字說明:
?
http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_overview.htm#SUTIL801
?
Oracle Data Pump is made up of three distinct parts:
(1)The command-lineclients,?expdp?and?impdp
(2)The?DBMS_DATAPUMP?PL/SQLpackage (also known as the Data Pump API)
(3)The?DBMS_METADATA?PL/SQLpackage (also known as the Metadata API)
?
The Data Pumpclients,?expdp?and?impdp, invoke the Data Pump Export utilityand Data Pump Import utility, respectively.
--Data Pump 客戶端(exdp/impdp)調(diào)用Data Pump Export/import工具。
The?expdp?and?impdp?clientsuse the procedures provided in the?DBMS_DATAPUMP?PL/SQL package toexecute export and import commands, using the parameters entered at the commandline. These parameters enable the exporting and importing of data and metadatafor a complete database or for subsets of a database.
--expdp/impdp 客戶端使用DBMS_DATAPUMP 包來執(zhí)行導(dǎo)出導(dǎo)入操作。
When metadata ismoved, Data Pump uses functionality provided bythe?DBMS_METADATA?PL/SQL package. The?DBMS_METADATA?packageprovides a centralized facility for the extraction, manipulation, andre-creation of dictionary metadata.
The?DBMS_DATAPUMP?and?DBMS_METADATA?PL/SQLpackages can be used independently of the Data Pump clients.
?
? All Data Pump Export and Import processing,including the reading and writing of dump files, is done on the system (server)selected by the specified database connect string.?
--所有的dump 文件都會(huì)保存在server 上指定的目錄里。
This means thatfor unprivileged users, the database administrator (DBA) must create directoryobjects for the Data Pump files that are read and written on that server filesystem.?
?
以上的文字總結(jié)如下:
?????? DataPump 客戶端命令(expdp/impdp)會(huì)調(diào)用DBMS_DATAPUMP?PL/SQLpackage 和DBMS_METADATA?PL/SQL包,這2個(gè)包是在server 上的,我們在客戶端上執(zhí)行expdp/impdp。 但是所生成的dump 文件還是存在與server 上指定的directory上。
?????? 因此,并不是網(wǎng)上傳說的,expdp/impdp 只能在服務(wù)端使用。
?
?
二.客戶端使用expdp/impdp示例
?
服務(wù)端版本:
SQL> select * from v$version;
?
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise EditionRelease 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
CORE???11.2.0.3.0????? Production
TNS for Linux: Version 11.2.0.3.0 -Production
NLSRTL Version 11.2.0.3.0 - Production
?
在服務(wù)端創(chuàng)建directory:
SQL> create directory backup as'/u01/backup';
Directory created.
?
SQL> grant read,write on directory backupto dave;
Grant succeeded.
?
在客戶端的tnsnames.ora里配置如下:
DG =
?(DESCRIPTION =
???(ADDRESS_LIST =
?????(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.11)(PORT = 1521))
??? )
???(CONNECT_DATA =
?????(SID = dg)
?????(SERVER = DEDICATED)
??? )
? )
?
在安裝server 版本的windows 平臺(tái)執(zhí)行expdp命令:
C:\Users\Administrator.DavidDai>expdp dave/dave@dg directory=backup dumpfile=dave.dmp logfile=dave.log schemas=dave
?
Export: Release11.2.0.1.0 - Production on Thu Dec 15 16:41:56 2011
--注意使用的是11g的expdp
?
Copyright (c) 1982, 2009, Oracle and/or itsaffiliates.? All rights reserved.
?
Connected to: Oracle Database 11gEnterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Miningand Real Application Testing options
Starting"DAVE"."SYS_EXPORT_SCHEMA_01":? dave/********@dg directory=backupdumpfile=dave.dmp logfile=dave.log schemas=dave
Estimate in progress using BLOCKS method...
Processing object typeSCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object typeSCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object typeSCHEMA_EXPORT/TABLE/TABLE
Processing object typeSCHEMA_EXPORT/TABLE/COMMENT
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/INDEX
Processing object typeSCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object typeSCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
. . exported"DAVE"."DAVE"?????????????????????????????? 6.539 KB????? 31 rows
Master table"DAVE"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for DAVE.SYS_EXPORT_SCHEMA_01is:
?/u01/backup/dave.dmp
Job"DAVE"."SYS_EXPORT_SCHEMA_01" successfully completed at16:44:11
?
成功導(dǎo)出。我們查看一下/u01/backup 目錄:
[root@DG1 u01]# cd /u01/backup/
[root@DG1 backup]# ll
total 168
-rw-r----- 1 oracle oinstall 163840 Dec 1516:44 dave.dmp
-rw-r--r-- 1 oracle oinstall?? 1322 Dec 15 16:44 dave.log
?
--清空目錄,為下次expdp 準(zhǔn)備:
[root@DG1 backup]# rm -rf *
?
?
切換到只安裝了oracle 10g的客戶端的機(jī)器上執(zhí)行expdp:
C:\Users\Administrator>expdp dave/dave@dg directory=backup dumpfile=dave.dmp logfile=dave.log schemas=dave
Export: Release10.2.0.3.0 - Production on 星期四, 15 12月, 2011 16:56:09
--注意expdp 版本:
Copyright (c) 2003, 2005, Oracle.? All rights reserved.
連接到: OracleDatabase 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Produc
tion
With the Partitioning, OLAP, Data Miningand Real Application Testing options
啟動(dòng)"DAVE"."SYS_EXPORT_SCHEMA_01":? dave/********@dg directory=backup dumpfile=
dave.dmp logfile=dave.log schemas=dave
正在使用 BLOCKS 方法進(jìn)行估計(jì)...
處理對象類型SCHEMA_EXPORT/TABLE/TABLE_DATA
使用 BLOCKS 方法的總估計(jì): 64 KB
處理對象類型SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
處理對象類型SCHEMA_EXPORT/TABLE/TABLE
處理對象類型SCHEMA_EXPORT/TABLE/COMMENT
處理對象類型SCHEMA_EXPORT/TABLE/INDEX/INDEX
處理對象類型 SCHEMA_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
處理對象類型SCHEMA_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
. . 導(dǎo)出了 "DAVE"."DAVE"?????????????????????????????? 6.539 KB????? 31 行
已成功加載/卸載了主表"DAVE"."SYS_EXPORT_SCHEMA_01"
******************************************************************************
DAVE.SYS_EXPORT_SCHEMA_01 的轉(zhuǎn)儲(chǔ)文件集為:
?/u01/backup/dave.dmp
作業(yè)"DAVE"."SYS_EXPORT_SCHEMA_01" 已于 16:57:58 成功完成
?
查看備份文件:
[root@DG1 backup]# ll -h
total 168K
-rw-r----- 1 oracle oinstall 160K Dec 1516:57 dave.dmp
-rw-r--r-- 1 oracle oinstall 1.2K Dec 1516:57 dave.log
?
?
至此,我們有了一個(gè)用10g的expdp 導(dǎo)出了11g的Oracledump文件。現(xiàn)在我們用11g的impdp 導(dǎo)入該dump:
?
C:\Users\Administrator.DavidDai>impdp dave/dave@dg directory=backup dumpfile=dave.dmp logfile=imp.log schemas=davetable_exists_action=replace
?
Import: Release 11.2.0.1.0 - Production on Thu Dec 15 17:28:43 2011
?
Copyright (c) 1982, 2009, Oracle and/or its affiliates.? All rights reserved.
?
Connected to: Oracle Database 11g Enterprise Edition Release11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real ApplicationTesting options
Master table "DAVE"."SYS_IMPORT_SCHEMA_01"successfully loaded/unloaded
Starting "DAVE"."SYS_IMPORT_SCHEMA_01":? dave/********@dg directory=backupdumpfile=dave.dmp logfile=imp.log schemas=dave table_exists_action=replace
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 "DAVE"."DAVE"?????????????????????????????? 6.539 KB????? 31 rows
Job "DAVE"."SYS_IMPORT_SCHEMA_01" successfullycompleted at 17:29:03
?
導(dǎo)入成功。 這個(gè)說明expdp 從低到高的兼容性是沒有問題,如果從高到低,在expdp時(shí)就需要執(zhí)行version 參數(shù)。 這個(gè)在之前的鏈接有說明。
?
小結(jié):
?????? Expdp/impdp可以在客戶端使用,使用時(shí)用@指定service Name 就可以了。
?
?
?
?
?
?
-------------------------------------------------------------------------------------------------------
版權(quán)所有,文章允許轉(zhuǎn)載,但必須以鏈接方式注明源地址,否則追究法律責(zé)任!
Blog:???? http://blog.csdn.net/tianlesoftware
Weibo: http://weibo.com/tianlesoftware
Email: ? tianlesoftware@gmail.com
Skype: tianlesoftware
?
-------加群需要在備注說明Oracle表空間和數(shù)據(jù)文件的關(guān)系,否則拒絕申請----
DBA1 群:62697716(滿);?? DBA2 群:62697977(滿)??DBA3 群:62697850(滿)??
DBA 超級群:63306533(滿);? DBA4 群:83829929? ?DBA5群: 142216823
DBA6 群:158654907? ??DBA7 群:172855474 ?
轉(zhuǎn)載于:https://www.cnblogs.com/spring3mvc/archive/2011/12/15/2414480.html
總結(jié)
以上是生活随笔為你收集整理的Oracle 客户端 使用 expdp/impdp 示例 说明的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 将 GridView 中的内容导出到 E
- 下一篇: Android_动态壁纸介绍