exp/imp与expdp/impdp的用法区别


1:把用户usera的对象导到用户userb,用法区别在于fromuser=usera touser=userb ,remap_schema='usera':'usera' 。例如

imp system/passwd fromuser=usera touser=userb file=/oracle/exp.dmp log=/oracle/exp.log;
impdp system/passwd directory=expdp dumpfile=expdp.dmp remap_schema='usera':'userb' logfile=/oracle/exp.log;

2:更换表空间,用exp/imp的时候,要想更改表所在的表空间,需要手工去处理一下,
如alter table xxx move tablespace_new之类的操作。
用impdp只要用remap_tablespace='tabspace_old':'tablespace_new'

3:当指定一些表的时候,使用exp/imp 时,tables的用法是 tables=('table1','table2','table3')。
expdp/impdp的用法是tables='table1','table2','table3'

4:
是否要导出数据行
exp (ROWS=Y 导出数据行,ROWS=N 不导出数据行)
expdp content(ALL:对象+导出数据行,DATA_ONLY:只导出对象,METADATA_ONLY:只导出数据的记录)

A: exp/imp的使用 (服务器端和客户端都可以执行。并且备份文件可以在客户端产生。)


exp user/password@servicename file=dump.dmp
imp user/password@servicename fromuser=fuser touser=tuser file=dump.dmp


2: expdp/impdp的使用 (服务器端和客户端都可以执行。 备份文件只能存在服务器里面 。)

I:在使用expdp导出时在Oracle需要定义目录变量,在导出的时候需要制定这个变量。如果可以,你可以为每个用户都建立一个单独的备份目录。
SQL>create directory dmpdir_user1 as '/home/oracle/backup';
SQL>grant read,write on directory dmpdir_user1 to user1;
对了,操作系统内必须创建这个目录。在SQL命令行下,并不会产生这个目录的。
[oracle@kook ~]$ mkdir backup
如果你没有制定这个目录的话,默认exp导出存放的目录是$HOME/rdbms/log里面。至少我的是这样。很奇怪,为什么在这里。

II:执行导出导入命令
expdp user1/password@servicename schemas=user1 directory=dmpdir_user1 dumpfile=user1.dmp
impdp user2/password@servicename directory=dmpdir_user1 dumpfile=user1.dmp remap_schema=user1:user2 remap_tablespace=user1ts:user2ts
使用expdp/impdp最大的好处可以让我转换表空间。而exp/imp这个是不支持的。处理起来非常麻烦。



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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值