ITeye博客

oracle 使用expdp、impdp 备份和恢复数据

xiaojiit · 2012-12-09 18:02 · oracle · 数据库 · Markdown

1、还原经常使用exp、imp 备份和还原数据,但这样对 表空间有要求,即:导出前使用的什么表空间,导入时,必须采用相同的表空间,不利于不同数据库之间的备份和恢复。使用expdp、impdp则可以避免此问题

 

2、expdb、impdb使用“目录”,需要先创建目录。

3、创建目录 :

     用system用户登陆,

     create or replace directory exp_dir as 'D:/tmp';

       grant read,write on directory exp_dir to scott;

 

4、进入oracle的BIN目录

    备份: expdp.exe scott/123456 schemas=scott directory=exp_dir dumpfile=scott.dmp logfile=expscott.log 

    备份完成之后,scott.dmp和expscott.log将存放在D:/tmp文件夹中

 

    恢复:先把由expdb备份出来的文件,放入D:/tmp中

                然后进 impdp.exe scott/123456 schemas=scott directory=exp_dir dumpfile=scott.dmp

 

5、删除目录:

      drop directory exp_dir;

 

 

6、如果两端的数据库版本不一至,可在导入导出命令加 version=10.2.0.1.0 ,指定导出的版本。

      如: expdp.exe scott/123456 schemas=scott directory=exp_dir dumpfile=scott.dmp logfile=expscott.log version=10.2.0.1.0

                impdp.exe scott/123456 schemas=scott directory=exp_dir dumpfile=scott.dmp version=10.2.0.1.0

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。