When the EXPDP tool is used, its dump file can only be stored in the OS directory corresponding to the DIRECTORY object, rather than directly specifying the OS DIRECTORY where the dump file is located. Therefore, the EXPDP tool is used.
When the EXPDP tool is used, its dump file can only be stored in the OS directory corresponding to the DIRECTORY object, rather than directly specifying the OS DIRECTORY where the dump file is located. Therefore, the EXPDP tool is used.
Use expdp
When the EXPDP tool is used, its dump file can only be stored in the OS directory corresponding to the DIRECTORY object, rather than directly specifying the OS DIRECTORY where the dump file is located. Therefore, when using the EXPDP tool, you must first create a DIRECTORY object and grant the database user the permission to use the DIRECTORY object.
First, you must create DIRECTORY:
SQL> conn/as sysdba
SQL> CREATE OR REPLACE DIRECTORY directory_name AS 'Directory _ path ';
You can also change the OS path of directory.
SQL> GRANT read, write ON DIRECTORY directory_name TOusername;
Query directory
SQL> select * from dba_directories;
SQL> select * from all_directories;
Delete directory
SQL> drop directory directory_name;
Expdp Option
1. ATTACH
This option is used to establish an association between a customer session and an existing export role. The syntax is as follows:
ATTACH = [schema_name.] job_name
Schema_name is used to specify the scheme name, And job_name is used to specify the export job name. Note: If the ATTACH option is used, no other options can be specified in the command line except the connection string and ATTACH options. The example is as follows:
Expdp username/password ATTACH = username. job_name
2. CONTENT
This option is used to specify the content to be exported. The default value is ALL. The syntax is as follows:
CONTENT = {ALL | DATA_ONLY | METADATA_ONLY}
When CONTENT is set to ALL, the object definition and ALL its data will be exported; if it is DATA_ONLY, only the object data will be exported; if it is METADATA_ONLY, only the object definition will be exported, as shown in the following example:
Expdp username/password DIRECTORY = directory_name DUMPFILE = dumpfile_name CONTENT = METADATA_ONLY
3. DIRECTORY
Specifies the directory where the dump and log files are located. Syntax:
DIRECTORY = directory_object
Directory_object is used to specify the DIRECTORY object name. Note that the DIRECTORY object is an object created using the create directory statement, rather than the OS DIRECTORY. The example is as follows:
Expdp username/password DIRECTORY = directory_name DUMPFILE = dumpfile_name
Create a directory:
Create directory directory_name as '/Oracle/dump ';
Query the subdirectories created:
SELECT * FROM dba_directories;
4. DUMPFILE
Specifies the name of the dump file. The default name is expdat. dmp. The syntax is as follows:
DUMPFILE = [directory_object:] file_name [,…]
Directory_object is used to specify the DIRECTORY object name, And file_name is used to specify the dump file name. Note that if directory_object is not specified, the export tool automatically uses the DIRECTORY object specified by the DIRECTORY option, as shown in the following example:
Expdp username/password DIRECTORY = directory_name DUMPFILE = directory_name: dumpfile_name
5. ESTIMATE
Specifies the method to estimate the disk space occupied by the exported table. The default value is BLOCKS. The syntax is as follows:
EXTIMATE = {BLOCKS | STATISTICS}
When it is set to BLOCKS, oracle estimates the space occupied by the object based on the number of data BLOCKS occupied by the target object multiplied by the data block size. When it is set to STATISTICS, it estimates the space occupied by the object based on the recent statistical value, example:
Expdp scott/tiger TABLES = emp ESTIMATE = statistics directory = dumpDUMPFILE = a. dump
Generally, when the default value (blocks) is used, the estimated file size in the log is larger than that in the actual expdp file, and the actual size will be the same when statistics is used.
6. EXTIMATE_ONLY
Specify whether to estimate only the disk space occupied by the Export job. The default value is N. The syntax is as follows:
EXTIMATE_ONLY = {Y | N}
When it is set to Y, the export function only estimates the disk space occupied by the object, and does not execute the export job. When it is N, it not only estimates the disk space occupied by the object, the export operation is also executed, for example:
Expdp username/password ESTIMATE_ONLY = y NOLOGFILE = y
,