expdp数据库导出导入

1、从现有环境导出一份数据库文件:

[oracle@huydvm ~]$ expdp

Username: fm

Password: 1

导出的文件默认放在:

/home/oracle/app/admin/orcl/dpdump

2、将上面导出的文件拷贝到另一台机器还原文件所在目录下面;

3、使用sys as sysdba执行 install.sql 创建数据库用户等必要信息;

4、impdp命令:impdp fm/1 dumpfile=expdat.dmp full=y;

 

5、上面导出的文件在另外一个数据库中导入的时候报错如下:

[oracle@localhost dpdump]$ impdp fm/1 dumpfile=expdat20170805.dmp full=y;

 

Import: Release 11.2.0.4.0 - Production on Sat Aug 5 17:22:58 2017

 

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

 

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39006: internal error

ORA-39213: Metadata processing is not available

解决:

SQL> conn / as sysdba;

Connected.

SQL> execute  sys.dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.

[oracle@localhost dpdump]$ impdp fm/1 dumpfile=expdat20170805.dmp full=y transform=OID:N

6、查看oracle默认导出目录

SELECT directory_path FROM dba_directories WHERE directory_name = 'DATA_PUMP_DIR';

7、设置oracle导出目录

SQL> CREATE DIRECTORY dmpdir AS '/opt/oracle';

Directory created.

SQL> GRANT read, write ON DIRECTORY dmpdir TO scott;

Grant succeeded.

使用exp和imp进行特定用户数据库的导入和导出

1、从A数据库中把fm用户下的所有内容导入fm.dmp文件;

[fm@huydvm ~]$ exp fm/1@ois buffer=64000 file=./fm.dmp owner=fm

posted @ 2017-09-30 22:08  Mr.R123  阅读(227)  评论(0编辑  收藏  举报