Oracle Data Pump technology enables very high-speed movement of data and metadata from one database to another.
Use a text editor, such as Notepad, to view or print this file. NOTE: You cannot export or print a list of the files that are contained in a folder in Windows Explorer. How to Print a File List in Outlook Outlook contains file-management abilities, as well as e-mail message, calendar, and contact management.
This chapter discusses the following topics:
Data Pump Components
Oracle Data Pump is made up of three distinct parts:
The Data Pump clients,
expdp and impdp , invoke the Data Pump Export utility and Data Pump Import utility, respectively. They provide a user interface that closely resembles the original Export (exp ) and Import (imp ) utilities.
Note:
Dump files generated by the Data Pump Export utility are not compatible with dump files generated by the original Export utility. Therefore, files generated by the original Export (exp ) utility cannot be imported with the Data Pump Import (impdp ) utility.
In most cases, Oracle recommends that you use the Data Pump Export and Import utilities. They provide enhanced data movement performance in comparison to the original Export and Import utilities.
See Chapter 20, 'Original Export and Import' for information about situations in which you should still use the original Export and Import utilities.
The
expdp and impdp clients use the procedures provided in the DBMS_DATAPUMP PL/SQL package to execute export and import commands, using the parameters entered at the command-line. These parameters enable the exporting and importing of data and metadata for a complete database or for subsets of a database.
When metadata is moved, Data Pump uses functionality provided by the
DBMS_METADATA PL/SQL package. The DBMS_METADATA package provides a centralized facility for the extraction, manipulation, and resubmission of dictionary metadata.
The
DBMS_DATAPUMP and DBMS_METADATA PL/SQL packages can be used independently of the Data Pump clients.
Note:
All Data Pump Export and Import processing, including the reading and writing of dump files, is done on the system (server) selected by the specified database connect string. This means that, for nonprivileged users, the database administrator (DBA) must create directory objects for the Data Pump files that are read and written on that server file system. For privileged users, a default directory object is available. See Default Locations for Dump, Log, and SQL Files for more information about directory objects.
Note:
Data Pump Export and Import are not supported on physical or logical standby databases except for initial table instantiation on a logical standby.
See Also:
Oracle Database PL/SQL Packages and Types Reference for descriptions of the DBMS_DATAPUMP and DBMS_METADATA packages
How Does Data Pump Move Data?
Data Pump uses four mechanisms for moving data in and out of databases. They are as follows, in order of decreasing speed:
Note:
Data Pump will not load tables with disabled unique indexes. If the data needs to be loaded into the table, the indexes must be either dropped or reenabled.
Note:
There are a few situations in which Data Pump will not be able to load data into a table using either direct path or external tables. This occurs when there are conflicting table attributes. For example, a conflict occurs if a table contains a column of datatype LONG (which requires the direct path access method) but also has a condition that prevents use of direct path access. In such cases, an ORA-39242 error message is generated. To work around this, prior to import, create the table with a LOB column instead of a LONG column. You can then perform the import and use the TABLE_EXISTS_ACTION parameter with a value of either APPEND or TRUNCATE .
The following sections briefly explain how and when each of these data movement mechanisms is used.
Using Data File Copying to Move Data
The fastest method of moving data is to copy the database data files to the target database without interpreting or altering the data. With this method, Data Pump Export is used to unload only structural information (metadata) into the dump file. This method is used in the following situations:
When an export operation uses data file copying, the corresponding import job always also uses data file copying. During the ensuing import operation, you will be loading both the data files and the export dump file.
When data is moved by using data file copying, the character sets must be identical on both the source and target databases. Therefore, in addition to copying the data, you may need to prepare it by using the Recovery Manager (RMAN)
CONVERT command to perform some data conversions. You can generally do this at either the source or target database.
See Also:
Using Direct Path to Move Data
After data file copying, direct path is the fastest method of moving data. In this method, the SQL layer of the database is bypassed and rows are moved to and from the dump file with only minimal interpretation. Data Pump automatically uses the direct path method for loading and unloading data when the structure of a table allows it. Note that if the table has any columns of datatype
LONG , then direct path must be used.
The following sections describe situations in which direct path cannot be used for loading and unloading.
Situations in Which Direct Path Load Is Not Used
If any of the following conditions exist for a table, Data Pump uses external tables rather than direct path to load the data for that table:
Situations in Which Direct Path Unload Is Not Used
If any of the following conditions exist for a table, Data Pump uses the external table method to unload data, rather than direct path:
Using External Tables to Move Data
When data file copying is not selected and the data cannot be moved using direct path, the external table mechanism is used. The external table mechanism creates an external table that maps to the dump file data for the database table. The SQL engine is then used to move the data. If possible, the
APPEND hint is used on import to speed the copying of the data into the database. The representation of data for direct path data and external table data is the same in a dump file. Therefore, Data Pump might use the direct path mechanism at export time, but use external tables when the data is imported into the target database. Similarly, Data Pump might use external tables for the export, but use direct path for the import.
In particular, Data Pump uses external tables in the following situations:
Note:
When Data Pump uses external tables as the data access mechanism, it uses the ORACLE_DATAPUMP access driver. However, it is important to understand that the files that Data Pump creates when it uses external tables are
CREATE TABLE ... ORGANIZATION EXTERNAL statement. One of the reasons for this is that a manually created external table unloads only data (no metadata), whereas Data Pump maintains both data and metadata information for all objects involved.
See Also:
Chapter 14, 'The ORACLE_DATAPUMP Access Driver'
When the Export
NETWORK_LINK parameter is used to specify a network link for an export operation, a variant of the external tables method is used. In this case, data is selected from across the specified network link and inserted into the dump file using an external table.
See Also:
Using Network Link Import to Move Data
When the Import
NETWORK_LINK parameter is used to specify a network link for an import operation, SQL is directly used to move the data using an INSERT SELECT statement. The SELECT clause retrieves the data from the remote database over the network link. The INSERT clause uses SQL to insert the data into the target database. There are no dump files involved.
When you perform an export over a database link, the data from the source database instance is written to dump files on the connected database instance. The source database can be a read-only database.
Because the link can identify a remotely networked database, the terms database link and network link are used interchangeably.
Because reading over a network is generally slower than reading from a disk, network link is the slowest of the four access methods used by Data Pump and may be undesirable for very large jobs.
Supported Link Types
The following types of database links are supported for use with Data Pump Export and Import:
Unsupported Link Types
The database link type, Current User, is not supported for use with Data Pump Export or Import:
See Also:
What Happens During Execution of a Data Pump Job?
Data Pump jobs use a master table, a master process, and worker processes to perform the work and keep track of progress.
Coordination of a Job
For every Data Pump Export job and Data Pump Import job, a master process is created. The master process controls the entire job, including communicating with the clients, creating and controlling a pool of worker processes, and performing logging operations.
Tracking Progress Within a Job
While the data and metadata are being transferred, a master table is used to track the progress within a job. The master table is implemented as a user table within the database. The specific function of the master table for export and import jobs is as follows:
The master table is created in the schema of the current user performing the export or import operation. Therefore, that user must have the
CREATE TABLE system privilege and a sufficient tablespace quota for creation of the master table. The name of the master table is the same as the name of the job that created it. Therefore, you cannot explicitly give a Data Pump job the same name as a preexisting table or view.
For all operations, the information in the master table is used to restart a job.
The master table is either retained or dropped, depending on the circumstances, as follows:
See Also:
JOB_NAME for more information about how job names are formed.
Filtering Data and Metadata During a Job
Within the master table, specific objects are assigned attributes such as name or owning schema. Objects also belong to a class of objects (such as
TABLE , INDEX, or DIRECTORY ). The class of an object is called its object type. You can use the EXCLUDE and INCLUDE parameters to restrict the types of objects that are exported and imported. The objects can be based upon the name of the object or the name of the schema that owns the object. You can also specify
MESSAGE - a formatted status message of the form:
File Allocation
Data Pump jobs manage the following types of files:
An understanding of how Data Pump allocates and handles these files will help you to use Export and Import to their fullest advantage.
Specifying Files and Adding Additional Dump Files
For export operations, you can specify dump files at the time the job is defined, as well as at a later time during the operation. For example, if you discover that space is running low during an export operation, 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 will overwrite previously existing files. For dump files, you can use the Export
REUSE_DUMPFILES parameter to specify whether or not to overwrite a preexisting dump file.
Default Locations for Dump, Log, and SQL Files
Because Data Pump is server-based, rather than client-based, dump files, log files, and SQL 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.
For example, the following SQL statement creates a directory object named
dpump_dir1 that is mapped to a directory located at /usr/apps/datafiles.
The reason that a directory object is required is to ensure data security and integrity. For example:
On Unix and Windows NT systems, a default directory object,
DATA_PUMP_DIR , is created at database creation or whenever the database dictionary is upgraded. By default, it is available only to privileged users.
If you are not a privileged user, before you can run Data Pump Export or Data Pump Import, a directory object must be created by a database administrator (DBA) or by any user with the
CREATE ANY DIRECTORY privilege.
After a directory is created, the user creating the directory object needs to grant
READ or WRITE permission on the directory to other users. For example, to allow 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:
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. You are not given direct access to those files outside of the Oracle database unless you have the appropriate operating system privileges. Similarly, the Oracle database requires permission from the operating system to read and write files in the directories.
Data Pump Export and Import use the following order of precedence to determine a file's location:
Using Directory Objects When Automatic Storage Management Is Enabled
If you use Data Pump Export or Import with Automatic Storage Management (ASM) enabled, you must define the directory object used for the dump file so that the 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 ASM dump file as follows:
Then you would create a separate directory object for the log file:
To enable user
hr to have access to these directory objects, you would assign the necessary privileges, for example:
You would then use the following Data Pump Export command (you will be prompted for a password):
See Also:
Setting Parallelism
For export and import operations, the parallelism setting (specified with the
PARALLEL parameter) should be less than or equal to the number of dump files in the dump file set. If there are not enough dump files, the performance will not be optimal because multiple threads of execution will be trying to access the same dump file.
The
PARALLEL parameter is valid only in the Enterprise Edition of Oracle Database.
Using Substitution Variables
Instead of, or in addition to, listing specific filenames, you can use the
DUMPFILE parameter during export operations to specify multiple dump files, by using a substitution variable (%U ) in the filename. This is called a dump file template. The new dump files are created as they are needed, beginning with 01 for %U , then using 02 , 03 , and so on. Enough dump files are created to allow all processes specified by the current setting of the PARALLEL parameter to be active. If one of the dump files becomes full because its size has reached the maximum size specified by the FILESIZE parameter, it is closed, and a new dump file (with a new generated name) is created to take its place.
If multiple dump file templates are provided, they are used to generate dump files in a round-robin fashion. For example, if
expa%U , expb%U, and expc%U were all specified for a job having a parallelism of 6, the initial dump files created would be expa01 .dmp , expb01 .dmp , expc01 .dmp , expa02 .dmp , expb02 .dmp , and expc02 .dmp .
For import and SQLFILE operations, if dump file specifications
expa%U , expb%U, and expc%U are specified, then the operation will begin by attempting to open the dump files expa01 .dmp , expb01 .dmp , and expc01 .dmp . It is possible for the master table to span multiple dump files, so until all pieces of the master table are found, dump files continue to be opened by incrementing the substitution variable and looking up the new filenames (for example, expa02 .dmp , expb02 .dmp , and expc02 .dmp ). If a dump file does not exist, the operation stops incrementing the substitution variable for the dump file specification that was in error. For example, if expb01 .dmp and expb02 .dmp are found but expb03 .dmp is not found, then no more files are searched for using the expb%U specification. Once the entire master table is found, it is used to determine whether all dump files in the dump file set have been located.
Moving Data Between Different Database Versions
Because most Data Pump operations are performed on the server side, if you are using any version of the database other than
COMPATIBLE , you must provide the server with specific version information. Otherwise, errors may occur. To specify version information, use the VERSION parameter.
See Also:
Keep the following information in mind when you are using Data Pump Export and Import to move data between different database versions:
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |