oracle的多个exclude,Oracle expdp 排除表参数

使用逻辑工具的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

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\'\)\"

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\'\)\"

排除表T1和T2后T3表被成功导出。

注意在Linux的bash下特殊字符的转义处理

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值