2015-03-16 13 views
7

Tôi đang sử dụng impdp để nhập bản sao lưu. Nhưng tôi muốn thay đổi dumpfile thư mục mặc định.Làm thế nào để thay đổi thư mục dumpfile trong impdp?

$ impdp system/[email protected]$ORACLE_SID schemas=USER_SCHEMA dumpfile=mydumpfile.dmp logfile=impdpmydumpfile.log 

Import: Release 11.2.0.3.0 - Production on Mon Mar 16 09:32:05 2015 

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

Connected to: Oracle Database 11g Release 11.2.0.3.0 - 64bit Production 
ORA-39001: invalid argument value 
ORA-39000: bad dump file specification 
ORA-31640: unable to open dump file "/u01/app/oracle/admin/mydatabase/dpdump/mydumpfile.dmp" for read 
ORA-27037: unable to obtain file status 
Linux-x86_64 Error: 2: No such file or directory 
Additional information: 3 

Trả lời

11

Với the directory parameter:

impdp system/[email protected]$ORACLE_SID schemas=USER_SCHEMA directory=MY_DIR \ 
    dumpfile=mydumpfile.dmp logfile=impdpmydumpfile.log 

Các default directoryDATA_PUMP_DIR, mà có lẽ đó là thiết lập để /u01/app/oracle/admin/mydatabase/dpdump trên hệ thống của bạn.

Để sử dụng thư mục khác bạn (hoặc DBA) sẽ phải create a new directory object trong cơ sở dữ liệu, trỏ đến thư mục hệ điều hành có thể nhìn thấy của Oracle mà bạn đưa tệp vào và gán đặc quyền cho người dùng đang nhập.

4

sử dụng tùy chọn DIRECTORY.

Tài liệu ở đây: http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_import.htm#SUTIL907

DIRECTORY 

    Default: DATA_PUMP_DIR 

    Purpose 

    Specifies the default location in which the import job can find the dump file set and where it should create log and SQL files. 

    Syntax and Description 

    DIRECTORY=directory_object 
    The directory_object is the name of a database directory object (not the file path of an actual directory). Upon installation, privileged users have access to a default directory object named DATA_PUMP_DIR. Users with access to the default DATA_PUMP_DIR directory object do not need to use the DIRECTORY parameter at all. 

    A directory object specified on the DUMPFILE, LOGFILE, or SQLFILE parameter overrides any directory object that you specify for the DIRECTORY parameter. You must have Read access to the directory used for the dump file set and Write access to the directory used to create the log and SQL files. 

    Example 

    The following is an example of using the DIRECTORY parameter. You can create the expfull.dmp dump file used in this example by running the example provided for the Export FULL parameter. See "FULL". 

    > impdp hr DIRECTORY=dpump_dir1 DUMPFILE=expfull.dmp 
    LOGFILE=dpump_dir2:expfull.log 
    This command results in the import job looking for the expfull.dmp dump file in the directory pointed to by the dpump_dir1 directory object. The dpump_dir2 directory object specified on the LOGFILE parameter overrides the DIRECTORY parameter so that the log file is written to dpump_dir2. 
3

Tôi muốn thay đổi tệp kết xuất thư mục mặc định.

Bạn có thể tạo một thư mục mới và cung cấp cho nó đòi hỏi đặc quyền, ví dụ:

SQL> CREATE DIRECTORY dmpdir AS '/opt/oracle'; 
Directory created. 

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

Để sử dụng thư mục mới được tạo ra, bạn chỉ có thể thêm nó như một tham số:

DIRECTORY=dmpdir 

Oracle đã giới thiệu một thư mục mặc định từ 10g R2, được gọi là DATA_PUMP_DIR, có thể được sử dụng. Để kiểm tra vị trí, bạn có thể nhìn vào dba_directories:

SQL> select DIRECTORY_NAME, DIRECTORY_PATH from dba_directories where DIRECTORY_NAME = 'DATA_PUMP_DIR'; 

DIRECTORY_NAME  DIRECTORY_PATH 
-------------------- -------------------------------------------------- 
DATA_PUMP_DIR  C:\app\Lalit/admin/orcl/dpdump/ 

SQL> 
0

Bạn có thể sử dụng lệnh sau để cập nhật đường dẫn thư mục DỮ LIỆU BƠM,

create or replace directory DATA_PUMP_DIR as '/u01/app/oracle/admin/MYDB/dpdump/'; 

Đối với tôi sửa chữa đường dẫn dữ liệu được yêu cầu như tôi đã khôi phục cơ sở dữ liệu của tôi từ sản xuất đến môi trường thử nghiệm.

Có thể sử dụng cùng một lệnh để tạo DATA PUMP DIRECTORYnamepath mới.

Các vấn đề liên quan