• 欢迎访问搞代码网站,推荐使用最新版火狐浏览器和Chrome浏览器访问本网站!
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏搞代码吧

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

mysql 搞代码 4年前 (2022-01-09) 23次浏览 已收录 0个评论

首先创建导出目录: –更详细命令及参数,见:http://blog.gaodaima.com/haibusuanyun/article/details/12584727 BYS@ bys3create directory dir_dp as /home/oracle/; Directory created. BYS@ bys3grant read,write on directory dir_dp to public; Grant succ

首先创建导出目录: –更详细命令及参数,见:http://blog.gaodaima.com/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; –可以使用此语句验证配置。
##############################################

本文来源gao!%daima.com搞$代*!码$网9

#########

导出用户某个表测试:

只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


搞代码网(gaodaima.com)提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请说明详细缘由并提供版权或权益证明然后发送到邮箱[email protected],我们会在看到邮件的第一时间内为您处理,或直接联系QQ:872152909。本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:使用EXPDP/IMPDP导入导出表中数据/元数据测试

喜欢 (0)
[搞代码]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址