使用EXPDP/IMPDP导入导出表中数据/元数据测试

首先创建导出目录:  --更详细命令及参数,见:http://blog.csdn.net/haibusuanyun/article/details/12584727
BYS@ bys3>create directory dir_dp as '/home/oracle/';
Directory created.
BYS@ bys3>grant read,write on directory dir_dp to public;
Grant succeeded.
col privilege for a15
col directory_name for a15
col directory_path for a30
SELECT privilege, directory_name, DIRECTORY_PATH FROM user_tab_privs t, all_directories d  WHERE t.table_name(+) = d.directory_name ORDER BY 2, 1;    --可以使用此语句验证配置。
#######################################################

导出用户某个表测试:

只BYS用户下表定义不导出数据:
expdp bys/bys tables=bys.test1 directory=dir_dp dumpfile=bys1.dmp logfile=bys1.log content=metadata_only
只BYS用户下数据不导出表定义:
expdp bys/bys tables=bys.test1  directory=dir_dp dumpfile=bys2.dmp logfile=bys2.log content=data_only
导出BYS用户下所有对象--content不写,默认是ALL.
expdp bys/bys tables=bys.test1  directory=dir_dp file=bys3.dmp logfile=bys3.log
####################################################

导出整个用户下对象测试:

导出整个用户下对象的元数据:
expdp bys/bys schemas=bys  directory=dir_dp file=bys4.dmp logfile=bys4.log content=metadata_only
导出整个用户下的对象
expdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys5.log
####################################################

导入用户某个表测试:

1.删除整个表,
drop table test1 purge;
导入整个表含数据:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp3.log
导入表定义
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp2.log content=metadata_only
导入表中数据:
impdp bys/bys tables=test1 directory=dir_dp dumpfile=bys3.dmp logfile=impdp1.log content=data_only

导入用户下所有对象测试:

删除BYS用户下所有表--不删除用户
BYS@ bys3>select * from cat;
no rows selected
##
只导入用户下对象的元数据
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys6.log content=metadata_only
只导入用户下对象的数据
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys7.log content=data_only
导入用户下所有对象及数据:  --不写content=,默认就是ALL
impdp bys/bys schemas=bys  directory=dir_dp file=bys5.dmp logfile=bys8.log

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值