数据泵技术expdp/impdp

1.建立 directory

手工创建database目录

create or replace directory dir as '/data/oracle'

查询有哪些directory 

select directory_name,directory_path from dba_directories;

赋权

grant read,write on directory dir to user;

2.1数据泵导表

 expdp help=y

expdp scott/tiger directory=dir dumpfile=expdp_scott1.dmp tables=emp,dept

2.2导入 scott 的表

drop table emp purge;
drop table dept purge;
impdp help=y

impdp scott/tiger directory=dir dumpfile=expdp_scott1.dmp

3.1导出 scott emp1 数据,但不导出结构

expdp scott/tiger directory=dir dumpfile=expdp_scott1.dmp tables=emp1 content=data_only reuse_dumpfiles=y

3.2导入 Scott 的表数据,只导入数据

truncate table emp1;

impdp scott/tiger directory=dir dumpfile=expdp_scott1.dmp

 4.1导出表中部分行

expdp scott/tiger directory=dir dumpfile=expdp_emp.dmp tables=emp query="'where deptno = 10'"

4.2导入为其他表名

 impdp scott/tiger directory=dir dumpfile=expdp_emp.dmp remap_table=emp:emp10

5.1数据泵导用户

expdp system/oracle directory=dir dumpfile=scott.dmp schemas=scott

5.2将对象导入其他用户名

impdp system/oracle directory=dir dumpfile=scott.dmp remap_schema=scott:test

6.数据泵可传输表空间

6.1检查自包含
EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('TBS1', TRUE);
SELECT * FROM TRANSPORT_SET_VIOLATIONS;
当前表空间中的对象不依赖该表空间之外的对象
例如:有 TEST 表空间,里面有个表叫 T1,如果在 T1 上建个索引叫 T1_idx,而这个索引建在 USERS
表空间上,由于 T1_idx 索引是依赖 T1 表的,
那么,TEST 表空间是自包含的,可以迁移,但会甩掉 T1_idx 索引,USERS 表空间不是自包含
的,不符合迁移条件。
6.2表空间只读
alter tablespace tbs1 read only;
6.3导出表空间
expdp system/oracle directory=dir dumpfile=expdp_tbs1.dmp transport_tablespaces=tbs1

6.4scp 到目标端

 scp expdp_tbs1.dmp ip:/data/oracle/dir
scp /u01/app/oracle/oradata/PROD/tbs1.dfb ip:/u01/app/oracle/oradata/EMREP/
6.5目标端创建对应用户
grant connect,resource to damon identified by oracle;
6.6目标端 导入
impdp system/oracle directory=dir dumpfile=expdp_tbs1.dmp TRANSPORT_DATAFILES=/u01/app/oracle/oradata/EMREP/tbs1.dfb
6.7两端 read wirte
alter tablespace tbs1 read write;

select tablespace_name,status from dba_tablespaces;

  • 4
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

柠檬不酸z

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值