导入导出sql语句

--expdp 导出
create directory dpdata1 as 'D:\test\dump';--创建目录
grant read,write on directory dpdata1 to scott;--赋予权限
select * from dba_directories;--查询目录
--要在C盘创建test\dump文件夹
--按用户导出
expdp riskdm/riskdm@RISKDM directory=XMLDIR  dumpfile=riskdm1204.dmp schemas=riskdm logfile=riskdm1204.log
--按表名导出
expdp scott/scott directory=dpdata2 dumpfile=tables.dmp logfile=tables.log tables=dept,emp
--按查询条件导出
expdp scott/scott directory=dpdata2 dumpfile=tables.dmp logfile=tables.log tables=emp query='where deptno=20'
--导出表空间
expdp system/manager directory=dpdata2 dumpfile=tablespace.dmp tablespace=temp,example
--导出数据库
expdp riskdm/riskdm@RISKDM directory=XMLDIR dumpfile=riskdm.dmp logfile=riskdm.log full=y
--查看正在运行的expdp
SELECT * FROM Dba_Datapump_Jobs 
expdp riskdm/riskdm@RISKDM attach=SYS_EXPORT_FULL_01
stop_job--停止该进程
kill—job--杀死该进程


--impdp 导入
--导入到指定用户下
impdp riskdm/riskdm@RISKDMTEST directory=dpdata2 dumpfile=riskdm0222.dmp schemas=riskdm
--导入表
impdp scott/scott directory=dpdata2 dumpfile=tables.dmp tables=scott.dept remap_schema=scott:system
--导入表空间
impdp system/manager directory=dpdata2 dumpfile=tablespace.dmp tablespace=example
--导入数据库
impdp riskdm/riskdm@orcl directory=DUMP_DIR dumpfile=riskdm1204.dmp full=y




exp导出
1) 将数据库orcl完全导出
exp riskdm/riskdm@RISKDM file=d:\orcl.dmp full=y
2) 将数据库中system用户的表导出
exp system/manager@orcl file=d:\system_bak.dmp owner=system
3) 将数据库中表table1,table2导出
exp system/manager@orcl file=d:\table_bak.dmp tables=(table1,table2)
4) 将数据库中的表customer中的字段mobile以"139"开头的数据导出
exp system/manager@orcl file=d:\mobile_bak.dmp tables=customer query=\"where mobile like '139%' \"
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值