oracle exp和imp的用法

exp是导出的意思,imp是导入的意思。

以下都是我使用xshell连接redhat5.5中oracle11g R2测试结果

首先需要切换到oracle账号,su – oracle

exp system/oracle@orcl file=/home/oracle/backup/full.dmp full=y

全部导出,使用system账号,后面oracle为密码,orcl是实例名称,full是全备的意思

exp system/oracle@orcl file=/home/oracle/bakup/scotthr.dmp owner=scott,hr

导出owner为scott和hr的duixiang

exp scott/tiger@orcl file=/home/oracle/backup/deptemp.dmp tables=dept,emp

导出scott的dept和emp两张表

使用sys账号导出时,需要使用转义字符,因为sys 必需要加as sysdba

exp \”sys/oracle@orcl as sysdba\” file=/home/oracle/backup/testsys.dmp owner=dept,emp

 

把scott.dept和scott.emp导入

imp scott/tiger@orcl file=/home/oracle/backup/deptemp.dmp

这样会失败,following statement failed because the object already exists:

image

imp scott/tiger@orcl file=/home/oracle/backup/deptemp.dmp ignore=y

忽略还是会有警告

image

直接把scott.dept和scott.emp删除,再重新还原应该就没有问题了,试试吧:

drop table scott.emp;

drop table scott.dept;

imp scott/tiger@orcl file=/home/oracle/backup/deptemp.dmp

image

转载于:https://www.cnblogs.com/cnmarkao/p/3672121.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值