您的位置:首页 > 数据库 > Oracle

oracle exp和imp的用法

2014-04-17 22:46 393 查看
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:





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

忽略还是会有警告





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

drop table scott.emp;

drop table scott.dept;

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



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: