使用EXPDP工具的 EXCLUDE選項過濾掉不關心的資料庫物件
【EXPDP】使用EXPDP工具的 EXCLUDE選項過濾掉不關心的資料庫物件
使用邏輯工具的EXCLUDE選項可以指定那類不被匯出,EXPDP工具的前身EXP如果想要完成同樣的任務非常的困難。我們以部分表為例看一下這個帶給我們的便利。如果在命令列中完成備份,特殊字元的轉義需要特別注意(我這裡使用的是Linux作業系統)。
1.EXPDP幫助中的描述資訊
ora10g@secDB /expdp$ expdp -help
……
EXCLUDE Exclude specific object types, e.g. EXCLUDE=TABLE:EMP.
……
2.建立directory資料庫物件,並將讀寫許可權授予sec使用者
sys@ora10g> create or replace directory dump_dir as '/expdp';
Directory created.
sys@ora10g> grant read,write on directory dump_dir to sec;
Grant succeeded.
3.確認作業系統資訊
ora10g@secDB /expdp$ uname -a
Linux secDB 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST x86_64 x86_64 x86_64 GNU/Linux
4.在sec使用者下建立幾張表用於後續的
建立三張表T1、T2和T3,每張表中初始化一條資料
sec@ora10g> create table t1 (x int);
sec@ora10g> insert into t1 values (1);
sec@ora10g> create table t2 (x int);
sec@ora10g> insert into t2 values (2);
sec@ora10g> create table t3 (x int);
sec@ora10g> insert into t3 values (3);
sec@ora10g> commit;
5.為了與後面的比較,先全使用者匯出
ora10g@secDB /expdp$ rm -f sec.dmp sec.log
ora10g@secDB /expdp$ expdp sec/sec directory=dump_dir dumpfile=sec.dmp logfile=sec.log
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 08 March, 2010 9:59:25
Copyright (c) 2003, , Oracle. All rights reserved.
Connected to: Oracle Database Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** directory=dump_dir dumpfile=sec.dmp logfile=sec.log
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 192 KB
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/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."T1" 4.914 KB 1 rows
. . exported "SEC"."T2" 4.914 KB 1 rows
. . exported "SEC"."T3" 4.914 KB 1 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 09:59:32
6.排除T1表進行備份
ora10g@secDB /expdp$ rm -f sec.dmp sec.log
ora10g@secDB /expdp$ expdp sec/sec directory=dump_dir dumpfile=sec.dmp logfile=sec.log EXCLUDE=TABLE:\"IN\(\'T1\'\)\"
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 08 March, 2010 10:02:03
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** directory=dump_dir dumpfile=sec.dmp logfile=sec.log EXCLUDE=TABLE:"IN('T1')"
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 128 KB
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/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."T2" 4.914 KB 1 rows
. . exported "SEC"."T3" 4.914 KB 1 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:02:10
排除表T1後T2和T3表被成功匯出。
7.排除多張表進行備份
以排除表T1和T2兩張表為例進行演示
ora10g@secDB /expdp$ rm -f sec.dmp sec.log
ora10g@secDB /expdp$ expdp sec/sec directory=dump_dir dumpfile=sec.dmp logfile=sec.log EXCLUDE=TABLE:\"IN\(\'T1\',\'T2\'\)\"
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 08 March, 2010 10:03:17
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": sec/******** directory=dump_dir dumpfile=sec.dmp logfile=sec.log EXCLUDE=TABLE:"IN('T1','T2')"
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
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/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."T3" 4.914 KB 1 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:03:24
排除表T1和T2後T3表被成功匯出。
注意在Linux的bash下特殊字元的轉義處理
8.使用PARFILE引數規避不同作業系統中特殊字元的轉義
為了規避不同作業系統上特殊字元轉義帶來的麻煩,我們可以使用PARFILE引數規避一下這個難題。
ora10g@secDB /expdp$ vi sec.par
userid=sec/sec
directory=dump_dir
dumpfile=sec.dmp
logfile=sec.log
EXCLUDE=TABLE:"IN('T1','T2')"
~
~
ora10g@secDB /expdp$ rm -f sec.dmp sec.log
ora10g@secDB /expdp$ expdp parfile=sec.par
Export: Release 10.2.0.3.0 - 64bit Production on Monday, 08 March, 2010 10:10:28
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options
Starting "SEC"."SYS_EXPORT_SCHEMA_01": parfile=sec.par
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
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/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
. . exported "SEC"."T3" 4.914 KB 1 rows
Master table "SEC"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_SCHEMA_01 is:
/expdp/sec.dmp
Job "SEC"."SYS_EXPORT_SCHEMA_01" successfully completed at 10:10:35
在完成特殊條件匯出時,推薦將需要的所有引數統一寫到引數檔案中
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/27042095/viewspace-734833/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【EXPDP】使用EXPDP工具的 EXCLUDE選項過濾掉不關心的資料庫物件資料庫物件
- expdp中使用include或者exclude匯出資料
- 關於 Oracle 10g EXPDP 的 EXCLUDE 引數Oracle 10g
- 【expdp】10g資料泵expdp工具選項詳解及應用示例
- 資料泵 EXPDP 匯出工具的使用
- 關於資料過濾的設計
- 【故障處理】通過重建資料庫物件解決因EXPDP/IMPDP工具損壞無法使用問題資料庫物件
- 使用資料泵工具expdp工具匯出資料
- Oracle資料庫的邏輯備份工具-expdp資料泵Oracle資料庫
- 使用SQL Server過濾資料的方法SQLServer
- 單例項資料庫expdp遷移到RAC庫單例資料庫
- 關於開啟資料庫時的resetlogs選項資料庫
- 請關掉你的資料庫連線!並且請使用資料庫連線池資料庫
- expdp exclude/include 命令出錯
- oracle資料庫的impdp,expdpOracle資料庫
- mysql完整備份時過濾掉某些庫MySql
- EXPDP/IMPDP工具的使用
- Expdp,impdp工具的使用
- 使用expdp、impdp遷移資料庫資料庫
- 3分鐘短文:Laravel的“南天門”,過濾掉七七八八的資料Laravel
- 關於dcat-admin 資料庫過濾查詢資料庫
- 使用MySQL之過濾資料MySql
- tcpdump過濾資料包,結果不對?TCP
- 轉:EXP 資料庫資料 QUERY 選項使用問題資料庫
- 使用jquery篩選和過濾陣列程式碼例項jQuery陣列
- expdp exclude大量表可以使用子查詢實現
- 例項,資料庫,資料字典與資料庫建立的關係資料庫
- WAD通過行選擇過濾另一個ITEM的資料
- 使用資料泵(expdp、impdp)遷移資料庫流程資料庫
- Mybatis的<if>標籤的坑,0會被過濾掉?MyBatis
- 能關掉經痛的Livia智慧穿戴 媽媽再也不擔心了
- 單例項資料庫工具轉化多例項資料庫單例資料庫
- 中興資料庫的決心資料庫
- DBeaverEE for Mac——資料庫管理的首 選工具Mac資料庫
- 如何過濾掉 PHP 陣列中的空值?PHP陣列
- Oracle 資料庫例項啟動關閉過程Oracle資料庫
- oracle資料庫的關閉過程Oracle資料庫
- 【EXPDP】使用expdp的QUERY引數限定備份資料的範圍