expdp impdp中 exclude/include 的使用
exclude和include参数能够在使用expdp或impdp是对特定的对象或对象类型进行筛选或过滤。比如因工作的需要导出特定的表或不导出特定
的表、视图以及存储过程、索引、约束、授权统计信息等等。下面将给出expdp或impdp使用exclude和include参数的方法和示例。
一、exclude/include参数用法:
EXCLUDE=[object_type]:[name_clause],[object_type]:[name_clause] -->排出特定对象
INCLUDE=[object_type]:[name_clause],[object_type]:[name_clause] -->包含特定对象
object_type子句用于指定对象的类型,如table,sequence,view,procedure,package等等
name_clause子句可以为SQL表达式用于过滤特定的对象名字。它由SQL操作符以及对象名(可使用通配符)来过滤指定对象类型中的特定对象。
当未指定name_clause而仅仅指定object_type则所有该类型的对象都将被过滤或筛选。多个[object_type]:[name_clause]中间以逗号分割。
示例:
expdp <other_parameters> SCHEMAS=scott EXCLUDE=SEQUENCE,TABLE:"IN ('EMP','DEPT')"
impdp <other_parameters> SCHEMAS=scott INCLUDE=PACKAGE,FUNCTION,PROCEDURE,TABLE:"='EMP'"
二、常用的过滤SQL表达式
EXCLUDE=SEQUENCE,VIEW --过滤所有的SEQUENCE,VIEW
EXCLUDE=TABLE:"IN ('EMP','DEPT')" --过滤表对象EMP,DEPT
EXCLUDE=SEQUENCE,VIEW,TABLE:"IN ('EMP','DEPT')" --过滤所有的SEQUENCE,VIEW以及表对象EMP,DEPT
EXCLUDE=INDEX:"= 'INDX_NAME'" --过滤指定的索引对象INDX_NAME
INCLUDE=PROCEDURE:"LIKE 'PROC_U%'" --包含以PROC_U开头的所有存储过程(_ 符号代表任意单个字符)
INCLUDE=TABLE:"> 'E' " --包含大于字符E的所有表对象
其它常用操作符 NOT IN, NOT LIKE, <, != 等等
直接将过滤操作符封装到参数文件中,如下面的例子
Parameter file:exp_scott.par
DIRECTORY = dump_scott
DUMPFILE = exp_scott_%U.dmp
LOGFILE = exp_scott.log
SCHEMAS = scott
PARALLEL= 2
EXCLUDE = TABLE:"IN ('EMP', 'DEPT')"
expdp system/manager parfile=exp.par
==>Author: Robinson Cheng
==>Blog: http://blog.csdn.net/robinson_0612
==>MSN: robinson_0612@hotmail.com
==>QQ: 645746311
三、命令行下转义符的处理
Windows平台:
D:\> expdp system/manager DIRECTORY=my_dir DUMPFILE=exp_tab.dmp LOGFILE=exp_tab.log SCHEMAS=scott
INCLUDE=TABLE:\"IN ('EMP', 'DEPT')\"
在Windows平台下,需要对象双引号进行转义,使用转义符\
Unix平台:
在未使用parfile文件的情形下,所有的符号都需要进行转义,包括括号,双引号,单引号等
% expdp system/manager DIRECTORY=my_dir DUMPFILE=exp_tab.dmp LOGFILE=exp_tab.log SCHEMAS=scott
INCLUDE=TABLE:\"IN \'EMP\',\'DEP\'\"
四、exclude/include常见的错误
任意需要转义的字符如果未转义或转义错误,都会产生ORA错误。下面给出几种常见的ORA错误。
ORA-39001: invalid argument value
ORA-39071: Value for INCLUDE is badly formed.
ORA-00936: missing expression
ORA-39001: invalid argument value
ORA-39071: Value for EXCLUDE is badly formed.
ORA-00904: “DEPT”: invalid identifier
ORA-39001: invalid argument value
ORA-39041: Filter “INCLUDE” either identifies all object types or no object types.
ORA-39001: invalid argument value
ORA-39041: Filter “EXCLUDE” either identifies all object types or no object types
ORA-39001: invalid argument value
ORA-39038: Object path “USER” is not supported for TABLE jobs.
五、导出示例
-->导出不包含sequence,表EMP,DEPT的其它所有对象
[oracle@orasrv scott]$ expdp scott/tiger directory=dump_scott dumpfile=fliter_1.dmp log=fliter_1.log schemas=scott \
> exclude=sequence,table:\" in \'EMP\',\'DEPT\'\"
-->包含大于字符T的所有表对象
[oracle@orasrv ~]$ expdp scott/tiger directory=dump_scott dumpfile=tmp.dmp logfile=tmp.log include=table:\"\>\'T\'\"
...........
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 18.06 MB
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."TB_PARL" 7.020 MB 72598 rows
. . exported "SCOTT"."TT" 7.009 MB 72493 rows
. . exported "SCOTT"."XP":"P2" 5.398 KB 1 rows
Master table "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SCOTT.SYS_EXPORT_SCHEMA_01 is:
/home/oracle/dump/scott/tmp.dmp
Job "SCOTT"."SYS_EXPORT_SCHEMA_01" successfully completed at 14:24:55
-->仅仅导入表对象TT,如果存在则将其替换
[oracle@orasrv scott]$ impdp scott/tiger directory=dump_scott dumpfile=tmp.dmp logfile=tmp_imp.log \
> include=table:\" =\'TT\' \" table_exists_action=replace
.............
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Master table "SCOTT"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
Starting "SCOTT"."SYS_IMPORT_FULL_01": scott/******** directory=dump_scott dumpfile=tmp.dmp logfile=tmp_imp.log
include=table:" ='TT' " table_exists_action=replace
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
. . imported "SCOTT"."TT" 7.009 MB 72493 rows
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "SCOTT"."SYS_IMPORT_FULL_01" successfully completed at 14:59:32
-->下面是一个实际实际导出过程中的parfile参数,exclude参数用于排出所有包含BAK的表对象,以及一些索引对象,使用了in,like运算符
userid=goex_admin
directory=DB_DUMP_DIR
dumpfile=sybo2_full_%U.dmp
logfile=sybo2_full.log
exclude=table:"like '%BAK%'",index:" in ('PK_ACC_POS_CASH_PL_TBL_ARC_11','pk_acc_pos_cash_tbl_arc_11',
'PK_ACC_POS_STOCK_ARCH_TBL_11','I_ACC_POS_STOCK_TBL_ARC_DT','I_ACC_POS_CASH_PL_ARCH_TBL_DT') ",
table:"in ('ACC_POS_STOCK_TBL_ARC')"
filesize=5368709120
schemas=goex_admin
-->下面是一个使用query查询过滤的情形
-->该操作导出的schema为scott,表对象emp中deptno=20,以及dept表中deptno=20的记录被导出,这两个表中的其余记录被过滤
-->该操作除上述过滤以后的所有对象将被一一导出
expdp scott/tiger dumpfile=scott_filter.dmp logfile=scott_filter.log directory=DB_DUMP_DIR schemas=scott \
> query=scott.emp:'"where deptno=20"',scott.dept:'"where deptno=20"'
http://blog.csdn.net/liqfyiyi/article/details/7248911
expdp impdp中 exclude/include 的使用的更多相关文章
- Oracle expdp impdp中 exclude/include 的使用
exclude和include参数能够在使用expdp或impdp是对特定的对象或对象类型进行筛选或过滤.比如因工作的需要导出特定的表或不导出特定的表.视图以及存储过程.索引.约束.授权统计信息等等. ...
- 转://oracle Wallet在expdp/impdp中使用场景
oracle Wallet的使用(即内部加密技术TDE(Transparent Data Encryption )) 1. TDE是Oracle10gR2中推出的一个新功能,使用时要保证Oracle版 ...
- expdp,impdp,include,exclude
The examples below are based on:- the demo schema SCOTT that is created with script: $ORACLE_HOME/rd ...
- expdp/impdp 参数说明,中英对照
任意可以使用expdp/impdp的环境,都可以通过help=y看到帮助文档. 1.expdp参数说明 2.impdp参数说明 3.expdp参数说明(中文) 4.impdp参数说明(中文) 1.ex ...
- exp/imp 与 expdp/impdp 区别
在平常备库和数据库迁移的时候,当遇到大的数据库的时候在用exp的时候往往是需要好几个小时,耗费大量时间.oracle10g以后可以用expdp来导出数据库花费的时间要远小于exp花费的时间,而且文件也 ...
- expdp\impdp及exp\imp
数据泵文件 expdp介绍 EXPDP命令行选项1. ATTACH该选项用于在客户会话与已存在导出作用之间建立关联.语法如下ATTACH=[schema_name.]job_nameSchema_na ...
- Oracle基础 exp/imp和expdp/impdp的区别:
一.exp/imp和expdp/impdp在功能上的区别: 1.把用户usera的对象导入到userb emp/imp用法: formuser=usera touser=userb; empdp/im ...
- Oracle基础 (系统工具(export,import)) exp/imp和 (数据泵 (data pump))expdp/impdp的区别:
一.exp/imp和expdp/impdp在功能上的区别: 1.把用户usera的对象导入到userb emp/imp用法: formuser=usera touser=userb; empdp/im ...
- 数据泵expdp,impdp使用结
EXPDP,IMPDP远程导出,导入数据库到本地 1.本地建立导出用户hr_exp并全然删除机hr的用户 C:\Users\Administrator>sqlplus / as sysdba S ...
随机推荐
- 美团、点评、猫眼App下拉加载效果的源码分享
今天我准备拿大众点评.美团.猫眼电影三款App的实例来分享一下APICloud下拉加载这个模块的效果. 美团App下拉加载效果 以美团中的下拉酷似动画的萌萌着小人儿效果作为参考,来实现的一个加载模 ...
- 消息队列MQ
基本版本 Queue 代码: using System.Collections.Generic; using System.Linq; using System.Web; using System.W ...
- java万物皆对象
我们以Dom对象的形式 可以CRUD xml文件或xml字串(经流把xml文件读出转成字串) 我们以JsonObject对象的形式 可以CRUD json字串 还有正则表达式.ORM都是.
- Leetcode: Guess Number Higher or Lower
We are playing the Guess Game. The game is as follows: I pick a number from 1 to n. You have to gues ...
- set和map和pair 转自ACdreamers
set与map容器 分类: C/C++ 2013-08-25 19:21 560人阅读 评论(0) 收藏 ...
- 转:JAVA强制类型转换
object对象转换为String的一些总结 ----------------------------------------------------------------------------- ...
- 转:python webdriver API 之alert/confirm/prompt 处理
webdriver 中处理 JavaScript 所生成的 alert.confirm 以及 prompt 是很简单的.具体思路是使用switch_to.alert()方法定位到 alert/conf ...
- 01分数规划POJ3621(最优比例生成环)
Sightseeing Cows Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8218 Accepted: 2756 ...
- AngularJs Test demo &front end MVVM implementation conjecture and argue.
<!DOCTYPE html> <html> <head> <title></title> <meta charset="u ...
- BZOJ 1010 玩具装箱toy(四边形不等式优化DP)(HNOI 2008)
Description P教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京.他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中.P教授有编号为1... ...