如何从 dmp 文件和日志文件导入 Oracle 数据库?

如何从转储文件创建数据库?我的系统上没有具有相同结构的现有数据库,因此它必须具有完整的作业、事件、表等。

我把转储和日志文件放在 E: drive 中

我试过进口公用事业

E:/>impdp system/tiger@oratest FILE=WB_PROD_FULL_20MAY11.dmp

但是我错误地认为

invalid argument value
bad dump file specification
unable to open dump file "E:\app\admin\oratest\dpdump\WB_PROD_F
ULL_20MAY11.dmp" for read
unable to open file
unable to open file
(OS 2) The system cannot find the file specified.

当我看到文件资源管理器中的 dMP 文件(来自 Linux 服务器)显示为 Crash dump 文件

我不明白我怎样才能解决这个问题。请帮我解决这个问题。

我是甲骨文的新手。

553826 次浏览

数据库是如何导出的?

  • 如果它是使用 exp导出的,并且导出了一个完整的模式,那么

    1. 创建用户:

      create user <username> identified by <password> default tablespace <tablespacename> quota unlimited on <tablespacename>;
      
    2. Grant the rights:

      grant connect, create session, imp_full_database to <username>;
      
    3. Start the import with imp:

      imp <username>/<password>@<hostname> file=<filename>.dmp log=<filename>.log full=y;
      
  • If it was exported using expdp, then start the import with impdp:

    impdp <username>/<password> directory=<directoryname> dumpfile=<filename>.dmp logfile=<filename>.log full=y;
    

Looking at the error log, it seems you have not specified the directory, so Oracle tries to find the dmp file in the default directory (i.e., E:\app\Vensi\admin\oratest\dpdump\).

Either move the export file to the above path or create a directory object to pointing to the path where the dmp file is present and pass the object name to the impdp command above.

所有这些和平的代码都放入 * . bat 文件并一次运行:

在 oracle.crate _ drop _ user.sql 文件中创建用户的代码

drop user "USER" cascade;
DROP TABLESPACE "USER";


CREATE TABLESPACE USER DATAFILE 'D:\ORA_DATA\ORA10\USER.ORA' SIZE 10M REUSE
AUTOEXTEND
ON NEXT  5M  EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT  AUTO
/


CREATE  TEMPORARY TABLESPACE "USER_TEMP" TEMPFILE
'D:\ORA_DATA\ORA10\USER_TEMP.ORA' SIZE 10M REUSE AUTOEXTEND
ON NEXT  5M  EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 1M
/


CREATE USER "USER"  PROFILE "DEFAULT"
IDENTIFIED BY "user_password" DEFAULT TABLESPACE "USER"
TEMPORARY TABLESPACE "USER_TEMP"
/


alter user USER quota unlimited on "USER";


GRANT CREATE PROCEDURE TO "USER";
GRANT CREATE PUBLIC SYNONYM TO "USER";
GRANT CREATE SEQUENCE TO "USER";
GRANT CREATE SNAPSHOT TO "USER";
GRANT CREATE SYNONYM TO "USER";
GRANT CREATE TABLE TO "USER";
GRANT CREATE TRIGGER TO "USER";
GRANT CREATE VIEW TO "USER";
GRANT "CONNECT" TO "USER";
GRANT SELECT ANY DICTIONARY to "USER";
GRANT CREATE TYPE TO "USER";

创建 import. bat 文件,并将下面的代码行放入其中:

SQLPLUS SYSTEM/systempassword@ORA_alias @"crate_drop_user.SQL"
IMP SYSTEM/systempassword@ORA_alias FILE=user.DMP FROMUSER=user TOUSER=user GRANTS=Y log =user.log

如果要从一个用户导入到另一个用户,请小心。例如,如果您有一个名为 user1的用户,并且您将导入到 user2,那么您可能会丢失所有的授权,因此您必须重新创建它。

祝你好运,伊凡

如果您正在使用来自@sathyajith-bhat 响应的 走吧命令示例:

impdp <username>/<password> directory=<directoryname> dumpfile=<filename>.dmp logfile=<filename>.log full=y;

您将需要使用强制参数 目录,并按以下方式创建和授予它:

CREATE OR REPLACE DIRECTORY DMP_DIR AS 'c:\Users\USER\Downloads';
GRANT READ, WRITE ON DIRECTORY DMP_DIR TO {USER};

或使用已定义的:

select * from DBA_DIRECTORIES;

我的 ORACLE Express 11g R2默认名为 DATA _ PUMP _ DIR(位于{ inst _ dir } app ORACLE/admin/xe/dpdump/) ,您仍然需要为您的用户授予它。