You are on page 1of 4

Data Pump Export and Import

Data pump takes the old export and import one step further, you can have total control over the job running
(stop it, pause it, check it, restart it). Data pump is a server side technology and it can transfer large amounts of
data very quickly, using parallel streams to achieve maximum throughput, they can be 15-45% faster than the
older import/export utilities. Advantages using data pump are

• ability to estimate jobs times

• ability to restart failed jobs
• perform fine-grained object selection
• monitor running jobs
• directly load a database from a remote instance via the network
• remapping capabilities
• improved performance using parallel executions

A couple of notes is that you cannot export to a tape device only to disk, and the import will only work with
version of oracle 10.1 or greater.

Data Pump Uses

Use can use data pump for the following

• migrating databases
• copying databases
• transferring oracle databases between different operating systems
• backing up important tables before you change them
• moving database objects from one tablespace to another
• transporting tablespace's between databases
• reorganizing fragmented table data
• extracting the DDL for tables and other objects such as stored procedures and packages

Data Pump components

Data pump technology consists of three major components

• dbms_datapump - the main engine for driving data dictionary metadata loading and unloading
• dbms_metadata - used to extract the appropriate metadata
• command-line - expdp and impdp are the import/export equivalents

Data Access methods

Data pump has two methods for loading data, direct path or external table path you as a dba have no control
with data pump uses, normally simple structures such as heap tables without triggers will use direct path more
complex tables will use the external path, oracle will always try and use the direct-path method.

bypasses the database buffer cache and writes beyond the high water mark when finished adjusts the
Direct Path high water mark No undo is generated and can switch off redo as well, minimal impact to users as does
not use SGA. Must disable triggers on tables before use.
External Uses the database buffer cache acts as a SELECT statement into a dump file, during import reconstructs
Data Pump Export and Import

statements into INSERT statements, so whole process is like a normal SELECT/INSERT job. Both
undo and redo are generated and uses a normal COMMIT just like a DML statement would.

In the following cases oracle will use the external path

• clustered tables
• active triggers in the table
• a single partition in a table with a global index
• referential integrity constraints
• domain indexes on LOB columns
• tables with fine-grained access control enabled in the insert mode
• tables with BFILE or opaque type columns

Data Pump files

You will use three typess of files when using data pump, all files will be creted on the server.

• dump files - holds the data and metadata

• log files - the resulting output from the data pump command
• sql files - contain the DDL statements describing the objects included in the job but can contain data

Data Pump privileges

In order to advance features of data pump you need exp_full_database and imp_full_database privilgeges.

How Data Pump works

The Master Control Process (MCP), has the process name DMnn, only one master job runs per job which
controls the whole Data Pump job, it performs the following

• create jobs and controls them

• creates and manages the worker processes
• monitors the jobs and logs the process
• maintains the job state and restart information in the master table
• manages the necessary files including the dump file set

The master process creates a master table which contains job details (state, restart info), this table is created in
the users schema who is running the Data Pump job. Once the job has finished it dumps the table contents into
the data pump file and deletes the table. When you import the data pump file it re-creates the table and read it to
verify the correct sequence in which the it should import the various database objects.

The worker process is named DWnn and is the process that actually performs the work, you can have a number
of worker process running on the same job (parallelism). The work process updates the master table with the
various job status.

The shadow process is created when the client logs in to the oracle server it services data pump API requests, it
creates the job consisting of the master table and the master process.
Data Pump Export and Import

The client processes are the expdp and impdp commands.

Running Data Pump

You can either run via a commandline specifying options or use a parameter file, there are many options to Data
Pump so it would be best to check out the oracle web site, I have given a few examples below

# expdp vallep/password directory=datapump full=y dumpfile=data.dmp
filesize=2G parallel=2 logfile=full.log
Note: increase the parallel option based on the number of CPU's you have
schema # expdp sys/password schemas=testuser dumpfile=data.dmp logfile=schema.log
# expdp vallep/password tables=accounts,employees dumpfile=data.dmp
# expdp vallep/password tablespaces=users dumpfile=data.dmp
database # impdp system/password full=y dumpfile=data.dmp nologfile=y
# impdp system/password schemas=’HR’ remap_schema=’HR:HR_TEST’
schema change
# impdp system/passwd remap_schema=’TEST:TEST3’ tables=test log=…
dumpfile=… directory=…
Other Options
directory specifies a oracle directory object
filesize split the dump file into specific sizes (could be used if filesystem has 2GB limit)
parfile specify the parameter file
compression compression is used by default but you can stop it
exclude/include metadata filtering
query selectively export table data usin a SQL statement
estimate tells you how much space is required without running the job
network link you can perform a export across a network
encryption you can encrypt data within the data pump file
parallel increase worker processes to increase throughput, base it on number of CPU's
remap_schema move objects from one schema to another
remap_datafile change the name of the datafile when moving across different systems
remap_tablespace move from one tablespace to another
Useful Tables
DBA_DATAPUMP_JOBS summary information of all currently running data pump jobs
DBA_DATAPUMP_SESSIONS displays the user currently running data pump jobs
V$SESSION_LONGOPS display information like totalwork, sofar, units and opname
Data Pump Export and Import

IMP_FULL_DATABASE required if using advanced features
EXP_FULL_DATABASE required if using advanced features


The package dbms_datapump can be used for the following

• starting/stopping/restarting a job
• monitoring a job
• detaching from a job

d1 number;
d1 :='export','schema',null, 'test1', 'latest');
exporting dbms_datapump.add_file(d1, 'test1.dmp', 'dmpdir');
dbms_datapump.metadata_filter(d1, 'schema_expr','in (''OE'')');
d1 number;
d1 :='import','full',null, 'test1');
importing dbms_datapump.add_file(d1, 'test1.dmp', 'dmpdir');
dbms_datapump.metadata_remap(d1, 'remap_schema', 'oe', 'hr');