File Allocation in Data Pump Job
Data Pump jobs manage the following types of files :
>> Dump files to contain the data and metadata that is being moved.
>> Log files to record the messages associated with an operation.
>> SQL files to record the output of a SQLFILE operation. A SQLFILE operation is started using the Data Pump Import SQLFILE parameter and results in all the SQL DDL that Import would be executing based on other parameters, being written to a SQL file.
>> Files specified by the DATA_FILES parameter during a transportable import.
Specifying Files and Adding Additional Dump Files :
For export operations, you can specify dump files at the time the job is defined, and also at a later time during the operation. For example, if you discover that space is running low during an export operation, then you can add additional dump files by using the Data Pump Export ADD_FILE command in interactive mode.
For import operations, all dump files must be specified at the time the job is defined.
Log files and SQL files overwrite previously existing files. For dump files, you can use the Export REUSE_DUMPFILES parameter to specify whether to overwrite a preexisting dump file.
Default Locations for Dump, Log, and SQL Files :
SQL query to see the path definition for DATA_PUMP_DIR:
SQL> set line 100
SQL> col DIRECTORY_NAME for a15
SQL> col DIRECTORY_PATH for a45
SQL> SELECT directory_name, directory_path FROM dba_directories WHERE directory_name='DATA_PUMP_DIR';
DIRECTORY_NAME DIRECTORY_PATH
--------------- ---------------------------------------------
DATA_PUMP_DIR /d01/oracle/DEV/db/tech_st/11.1.0/rdbms/log/
SQL statement that creates a directory object named dpump_dir1 that is mapped to a directory located at /usr/apps/datafiles.
SQL> CREATE DIRECTORY dpump_dir1 AS '/usr/apps/datafiles';
Directory created.
The Oracle database to read and write files on behalf of user hr in the directory named by dpump_dir1, the DBA must execute the following command:
SQL> GRANT READ, WRITE ON DIRECTORY dpump_dir1 TO hr;
Verify Directory is created or not:
SQL> SELECT directory_name, directory_path FROM dba_directories;
DIRECTORY_NAME DIRECTORY_PATH
------------------------- --------------------------------------------------
DPUMP_DIR1 /usr/apps/datafiles
DATA_PUMP_DIR /d01/oracle/DEV/db/tech_st/11.1.0/rdbms/log/
ORACLE_OCM_CONFIG_DIR /d01/oracle/DEV/db/tech_st/11.1.0/ccr/state
Here, we can see that DPUMP_DIR1 is created.
If you are not a privileged user, then access to the DATA_PUMP_DIR directory object must have previously been granted to you by a DBA.
Do not confuse the default DATA_PUMP_DIR directory object with the client-based environment variable of the same name.
Using Directory Objects When Oracle Automatic Storage Management Is Enabled :
If you use Data Pump Export or Import with Oracle Automatic Storage Management (Oracle ASM) enabled, then you must define the directory object used for the dump file so that the Oracle ASM disk group name is used (instead of an operating system directory path). A separate directory object, which points to an operating system directory path, should be used for the log file.
For example, you would create a directory object for the Oracle ASM dump file as follows:
SQL> CREATE or REPLACE DIRECTORY dpump_dir as '+DATAFILES/';
Then you would create a separate directory object for the log file:
SQL> CREATE or REPLACE DIRECTORY dpump_log as '/homedir/user1/';
To enable user hr to have access to these directory objects, you would assign the necessary privileges, for example:
SQL> GRANT READ, WRITE ON DIRECTORY dpump_dir TO hr;
SQL> GRANT READ, WRITE ON DIRECTORY dpump_log TO hr;
You would then use the following Data Pump Export command (you will be prompted for a password):
$ expdp hr DIRECTORY=dpump_dir DUMPFILE=hr.dmp LOGFILE=dpump_log:hr.log
No comments:
Post a Comment