P. 1
DataPump Parameter DIRECTORY

DataPump Parameter DIRECTORY

|Views: 99|Likes:
Published by Mochamad Isa

More info:

Published by: Mochamad Isa on Feb 06, 2012
Copyright:Attribution Non-commercial


Read on Scribd mobile: iPhone, iPad and Android.
download as DOC, PDF, TXT or read online from Scribd
See more
See less





Subject: Export/Import DataPump Parameter DIRECTORY - How to Specify a Directory Doc ID: Note:266875.

1 Type: BULLETIN Last Revision Date: 06-JUL-2004 Status: PUBLISHED
PURPOSE ------This document describes how a directory can be specified that is used by the Oracle10g Export/Import DataPump utilities to write the dumpfile(s), logfile (if specified) and SQL file (if specified). SCOPE & APPLICATION ------------------For everyone who uses the Export DataPump (expdp) utility to export data from an Oracle10g database and the Import DataPump (impdp) utilities to import data into an Oracle10g database.

HOW TO SPECIFY A DIRECTORY IN ORACLE10G EXPORT/IMPORT DATAPUMP --------------------------------------------------------------

1. SERVER-BASED OR CLIENT-BASED ---------------------------The parameter DIRECTORY specifies the location to which Export DataPump or Import DataPump can write the dump file set, the log file, and the SQL file (Import DataPump only). As export DataPump and import DataPump are server-based, rather than client-based, the output files are accessed relative to server-based directory paths. Data Pump requires you to specify directory paths as directory objects. A directory object maps a name to a directory path on the file system. 2. HOW TO CREATE A DIRECTORY ------------------------To create a directory, you must have the DBA role or you must have been granted the CREATE ANY DIRECTORY privilege. Example (a DBA creates directories on the Windows platform and grants access to user scott): SQL> SQL> SQL> SQL> SQL> CONNECT system/manager CREATE OR REPLACE DIRECTORY my_dir as 'D:\expdp_out'; CREATE OR REPLACE DIRECTORY my_dir_log as 'D:\expdp_out\log'; GRANT read,write ON DIRECTORY my_dir TO scott; GRANT read,write ON DIRECTORY my_dir_log TO scott;

Example (a normal user with the CREATE ANY DIRECTORY privilege creates directories on the Unix platform - this user automatically has READ and WRITE privilege on that directory): SQL> CONNECT system/manager SQL> GRANT CREATE ANY DIRECTORY TO scott; SQL> CONNECT scott/tiger

line 475 invalid file operation 3.dmp NOLOGFILE=Y b.table_name(+)=d. Similarly. HOW TO QUERY THE AVAILABLE DIRECTORIES -------------------------------------To query on which directories you have privilege to read and write: SQL> SELECT FROM WHERE ORDER privilege. all_directories d t.UTL_FILE". If the directory is invalid. Rule 3: ------If a directory object is not specified.SQL> CREATE OR REPLACE DIRECTORY my_dir as '/usr/expdp_out'. Example to create the dump file in directory MY_DIR and the logfile in MY_DIR_LOG: expdp scott/tiger DIRECTORY=my_dir DUMPFILE=exp_scott.directory_name BY 2. the Oracle database requires permission from the operating system to read and write files in the directories.1. 5. You are not given direct access to those files outside of the Oracle database unless you have the appropriate operating system privileges. directory_name user_tab_privs t. Note that the CREATE DIRECTORY statement does not actually create the directory for you on disk. then the value of the environment .log c. 4. Rule 2: ------If a directory object is not specified for a file. a DataPump job will fail with: ORA-39002: ORA-39070: ORA-29283: ORA-06512: ORA-29283: invalid operation Unable to open the log file. then the directory object named by the DIRECTORY parameter is used. Rule 1: ------If a directory object is specified as part of the file specification. REQUIRED OPERATING SYSTEM PERMISSIONS ------------------------------------Note that READ or WRITE permission to a directory object only means that the Oracle database will read or write that file on your behalf. HOW DATAPUMP DETERMINES THE LOCATION FOR THE FILES -------------------------------------------------a.dmp LOGFILE=my_dir_log:exp_scott. Example to create the dumpfile in directory MY_DIR (no logfile is written): expdp scott/tiger DUMPFILE=my_dir:exp_scott. and if no directory object was named by the DIRECTORY parameter. then the location specified by that directory object is used. invalid file operation at "SYS. SQL> CREATE OR REPLACE DIRECTORY my_dir_log as '/usr/expdp_out/log'.

log SCHEMAS=scott Note that user SCOTT who isn't a privileged user. then Data Pump attempts to use the value of the default server-based directory object. The value assigned to this client-based environment variable must be the name of a server-based directory object.g. DATA_PUMP_DIR. uses who have the EXP_FULL_DATABASE role and IMP_FULL_DATABASE role).log Note that the interpretation of the name of the directory in the environment variable DATA_PUMP_DIR is case sensitive. . Rule 4: ------If none of the previous three conditions yields a directory object and you are a privileged user (i.variable. Do not confuse this with the client-based environment variable of the same name. is used. set the environment variable: C:\> set DATA_PUMP_DIR=MY_DIR C:\> expdp scott/tiger@my_db_alias DUMPFILE=exp_scott. DATA_PUMP_DIR. It is important to understand that Data Pump does not create the DATA_PUMP_DIR directory object.dmp LOGFILE=my_dir_log:exp_scott.: set DATA_PUMP_DIR=My_Dir) can give errors. Example to create the dump file in directory MY_DIR and the logfile in MY_DIR_LOG: On the client machine where expdp is started. ORA-39087: directory name My_Dir is invalid 4. cannot use this last condition. SQL> GRANT read. Specifying an incorrect value for the DATA_PUMP_DIR environment variable (e. such as: ORA-39002: invalid operation ORA-39070: Unable to open the log file. C:\> expdp system/manager@my_db_alias DUMPFILE=exp_scott.e. which must first be created on the server system.dmp LOGFILE=exp_scott. This default directory object must first be created by a DBA. Possible errors: ORA-39002: invalid operation ORA-39070: Unable to open the log file. write ON DIRECTORY data_pump_dir TO scott. it merely attempts to use its value when a privileged user has not provided a directory object using any of the mechanisms previously described. This environment variable is defined using operating system commands on the client system where the Data Pump Export and Import utilities are run. Example to create all files in the directory DATA_PUMP_DIR: First unset the environment variable DATA_PUMP_DIR that was set in the previous example: C:\> set DATA_PUMP_DIR= Then create a directory with the name DATA_PUMP_DIR SQL> CONNECT SYSTEM/MANAGER SQL> CREATE OR REPLACE DIRECTORY data_pump_dir AS 'D:\expdp_out'.

ORA-39145: directory object parameter must be specified and nonnull Solution for user SCOTT: as described in previous condition. user SCOTT can set the environment variable DATA_PUMP_DIR to MY_DIR: C:\> set DATA_PUMP_DIR=MY_DIR Or in this specific case where user SCOTT also has the read and write privilege on directory DATA_PUMP_DIR: C:\> set DATA_PUMP_DIR=DATA_PUMP_DIR .

You're Reading a Free Preview

/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->