如何查找数据泵 dmp 文件的模式名称?

Sha*_*ehr 8 oracle oracle-11g-r2 datapump impdp

我获得了一个 DMP 数据泵导出文件,可以导入到我的本地 Oracle 实例中。我试过运行这个命令行:

impdp full=Y 目录=DATA_PUMP_DIR dumpfile=MyDumpFile.dmp logfile=import.log

我收到错误:

ORA-31655: 没有为作业选择数据或元数据对象

ORA-39154: 来自外部模式的对象已从导入中删除

并且不会导入任何数据。

从我在谷歌上搜索到的,一个可能的原因是我需要指定remap_schama. 但我不知道 dmp 文件中架构的名称是什么。有什么简单的方法可以查到吗?

编辑:我没有找到解决这个问题,但我没有找到一个解决办法......我就找到了谁做的DMP的家伙,并且了模式名出来了。remap_schema根据他的定义指定,Hey Presto!

Phi*_*lᵀᴹ 9

使用sqlfile=参数impdp生成包含转储中所有 DDL/DML 的文件。

例如:

[oracle@oel61 ~]$ impdp phil/phil directory=oracledmp dumpfile=phil.dmp logfile=phil.log sqlfile=philddl.txt

Import: Release 11.2.0.2.0 - Production on Wed Mar 13 15:15:03 2013

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

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options
Master table "PHIL"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "PHIL"."SYS_SQL_FILE_FULL_01":  phil/******** directory=oracledmp dumpfile=phil.dmp logfile=phil.log sqlfile=philddl.txt 
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "PHIL"."SYS_SQL_FILE_FULL_01" successfully completed at 15:15:05

[oracle@oel61 ~]$ 
Run Code Online (Sandbox Code Playgroud)

CREATE USER在文件中查找DDL 语句应该会显示执行导入所需的模式。

例如,从我的测试转储:

-- new object type path: SCHEMA_EXPORT/USER
-- CONNECT SYSTEM
 CREATE USER "PHIL" IDENTIFIED BY VALUES 'S:924B2E756404611021428644B4DF06A4A7BAB886837FCCFA510151E0FC44;181446AE258EE2F6'
      DEFAULT TABLESPACE "PHILDATA"
      TEMPORARY TABLESPACE "TEMP";
-- new object type path: SCHEMA_EXPORT/SYSTEM_GRANT
GRANT UNLIMITED TABLESPACE TO "PHIL";
GRANT CREATE SESSION TO "PHIL";
-- new object type path: SCHEMA_EXPORT/ROLE_GRANT
 GRANT "DBA" TO "PHIL";
-- new object type path: SCHEMA_EXPORT/DEFAULT_ROLE
 ALTER USER "PHIL" DEFAULT ROLE ALL;
Run Code Online (Sandbox Code Playgroud)

唯一的缺点是如果 .dmp 文件很大,则生成的 SQL 转储会很大。

  • 这是用户名和密码.... (2认同)
  • 我的答案将适用于 full=y 和具有适当权限的用户(或使用“/ as sysdba”登录)。 (2认同)