使用逻辑工具的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下特殊字符的转义处理
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10957369/viewspace-1481081/
,如需转载,请注明出处,否则将追究法律责任。