CentOS7.6.1810下使用impdp导入数据

481 阅读1分钟

1、创建用户并授权

[oracle@hadoop ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 22:22:56 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> CREATE USER ASGARD IDENTIFIED BY 123456;

User created.

SQL> GRANT CONNECT, DBA TO ASGARD;

Grant succeeded.

SQL> COMMIT;

Commit complete.

SQL> exit

2、创建目录

SQL> CREATE  OR REPLACE DIRECTORY DB_BAK AS '/opt/dbbak';

Directory created.

3、在CentOS中对目录进行授权

chown -R oracle:oinstall /opt/dbbak

4、将expdp导出的数据文件,使用impdp命令导入

impdp ASGARD/123456@ORCL DIRECTORY=DB_BAK DUMPFILE=ASGARD.DMP LOGFILE=ASGARD.LOG

5、附录:一些导入时遇到过的小错误 (1)UDI-12543: operation generated ORACLE error 12543

UDI-12543: operation generated ORACLE error 12543
ORA-12543: TNS:destination host unreachable

啥原因忘了,链接时在SID前加上IP即可

impdp ASGARD/Ab123456@10.5.25.22/orcl DIRECTORY=DB_BAK DUMPFILE=ASGARD.DMP LOGFILE=ASGARD.LOG

(2)ORA-39006: internal error

ORA-39006: internal error
ORA-39213: Metadata processing is not available

数据泵无法使用元数据API

[oracle@hadoop ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Mon Sep 30 22:41:37 2019

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn sys/Ab123456 as sysdba
Connected.
SQL> exec dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.

SQL> exit

(3)ORA-39002: invalid operation

ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation

目前遇到过两种原因:一种是未将CentOS中的目录对oracle这个用户授权,一种是映射目录时写错了。总之就是访问不了映射的这个目录。可以查看目录映射,是否正确,再进行授权即可。

SQL> select * from dba_directories;