暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

数据泵导入导出

原创 于天文 2021-01-06
526

1.创建数据泵目录

查看是否存在目录

select * from dba_directories;

create directory home as ‘/home/expdp’;

2.授权

grant read,write on directory home to scott;

数据字典dba_directories

3.导出

全库导出

expdp system/oracle compression=all full=y directory=home dumpfile=20161024full.dmp logfile=20161024.log

按表空间导出

expdp system/oracle compression=all tablespaces=users,example directory=home dumpfile=20161024tb.dmp logfile=20161024tb.log

按用户导出

expdp system/oracle compression=all schemas=hr,scott directory=home dumpfile=20161024us.dmp logfile=20161024us.log

按表导出

expdp system/oracle compression=all tables=scott.emp,hr.jobs directory=home dumpfile=20161024tbs.dmp logfile=20161024tabs.log

导出表中的行

expdp system/oracle compression=all tables=scott.emp,hr.jobs query=hr.employees:“where job_id=‘it_prog’ and salary >8000” ,scott.emp:“where sal>4500” directory=home dumpfile=201610241.dmp logfile=201610241.log

按flash_time或flashback_scn导出与闪回时间点查询相一致的的数据

expdp system/oracle compression=all flashback_time=“systimestamp - interval’10’ minute” tables=scott.emp,hr.jobs directory=home dumpfile=20161024tbs1.dmp logfile=20161024tabs1.log

导入

1.全库导入

impdp system/oracle full=y directory=home dumpfile=201610241.dmp logfile=20161024im.log;

2.表空间导入

impdp system/oracle tablespaces=example directory=home dumpfile=201610241.dmp logfile=20161024im.log;

3.用户导入

impdp system/oracle schemas=hr,scott directory=home dumpfile=201610241.dmp logfile=20161024im.log;

4.表导入

impdp syste/oracle tables=hr.employees,scott.test directory=home dumpfile=201610241.dmp logfile=20161024im.log;

5.按行导入

impdp system/oracle compression=all tables=scott.emp,hr.jobs query=hr.employees:“where job_id=‘it_prog’ and salary >8000” ,scott.emp:“where sal>4500” directory=home dumpfile=201610241.dmp logfile=201610241.log

6.remap_schema

impdp system/oracle schemas=hr directory=home dumpfile=201610241.dmp logfile=20161024im.log
remap_schema=hr:hr2(将hr用户的数据导入用户hr2)

「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论