Professional Documents
Culture Documents
Simon Pane
Agenda
Demonstration
2
Data Pump Overview
3
What is Data Pump?
4
Other Options for Moving Data
5
Other Options for Moving Data
Transportable Tablespaces
Pros
Undoubtedly the fastest way to move data
Can use the traditional exp/imp or Data Pump to move meta-data
Cross-platform support if the platform byte-order is the same
Cons
Tablespaces must be made read-only
Not selective (must move the entire tablespace)
Flashback is not possible (tablespace is read only when copied)
No physical reorganization is performed
Datafile sizes remain constant
Must use RMAN to convert the datafile if migrating to a platform with
a different byte-order (check V$TRANSPORTABLE_PLATFORM)
6
Other Options Used Less Frequently
7
Top 10 Reasons to Love DataPump
Export/Import
These utilities would basically connect to the Oracle database
via Oracle NET and run queries or DDL/DML
Processing of returned results and I/O operations were done
on the client
Data Pump
The executables call PL/SQL APIs
Therefore processing is done on the database server
This can be an advantage or a disadvantage depending on the
situation
“Self-Tuning”: no longer need to use BUFFER or RECORDSET
10
Export Operation
exp.exe
Network Oracle
Database
Export
File(s)
11
Data Pump Export Operation
expdp.exe
Network Oracle
Database
Export
File(s)
12
Key Differences
Dump and log files are on the server, not the client
Must have a DIRECTORY created in the Oracle
database for I/O
Permissions for the userid connecting to the instance, not the
schemas being exported or imported
Canceling the client process does not stop the job
Doesn’t automatically overwrite dump file if it already
exists – returns an error instead
Parameters (command line) are reported in the log file
Exported objects order based on table size
(descending) instead of alphabetically
13
Multiple Interfaces
2. Enterprise Manager
3. PL/SQL
Can be used independently but is difficult
14
Unload Mechanisms
16
Detaching and Re-Attaching
17
New Views
DBA_DATAPUMP_SESSIONS
Identify user sessions that are attached to a job
18
Security Considerations
19
Object Statistics
20
Other Random Points
21
Using Data Pump
22
Oracle Directory Objects
Directory created.
Grant succeeded.
SQL>
23
Key Data Pump Export Parameters
24
Key Data Pump Export Parameters
LOGFILE=[directory_object:]file_name
NOLOGFILE={Y | N}
PARALLEL=integer (default=1)
QUERY=[schema.][table_name:]query_clause
SCHEMAS=schema_name [,…]
TABLES=[schema_name.]table_name[:partition_name] [,…]
TABLESPACES=tablespace_name [,…]
25
Data Pump Export Parameter Samples
27
Key Data Pump Import Parameters
REMAP_DATAFILE=source_datafile:target_datafile
REMAP_SCHEMA=source_schema:target_schema
REMAP_TABLESPACE=source_tablespace:target_tablespace
REUSE_DATAFILES={Y | N}
SCHEMAS=schema_name [,…]
SKIP_UNUSABLE_INDEXES={Y | N}
SQLFILE=[directory_object:]file_name
TABLE_EXISTS_ACTION={SKIP|APPEND|TRUNCATE|REPLACE}
TABLES=[schema_name.]table_name[:partition_name] [,…]
TABLESPACES=tablespace_name [,…]
28
Interactive Mode Commands
ADD_FILE=[directory_object:]file_name [,…]
CONTINUE_CLIENT
EXIT_CLIENT
FILESIZE=number
KILL_JOB
PARALLEL=integer
START_JOB
STATUS
STOP_JOB
29
Demonstration
30
Exporting and Importing Sample Schemas
expdp system/oracle@ORA1020
dumpfile=scott.dmp schemas=scott
impdp system/oracle@ORA1020
dumpfile=scott.dmp schemas=SCOTT
remap_schema=SCOTT:LARRY
expdb system/oracle@ORA1020
dumpfile=larry.dmp schemas=larry
31
Using Interactive Mode
Export> status
Export> stop_job
expdp system/oracle@ORA1020
attach=SYS_EXPORT_SCHEMA_01
Export> start_job
Export> exit_client
32
Data Pump Test Cases
33
Test Scenario #1
Schema objects
Tables: 218 (many empty tables)
Indexes: 1180 (SIEBEL is a heavily indexed application)
34
Export Performance Test Criteria
35
Export Scripts
EXP
sqlplus -s system/oracle @timestamp.sql > exp.log
exp.exe userid=system/oracle@ORA1020 file=SIEBEL.dmp
log=SIEBEL.log owner='SIEBEL'
sqlplus -s system/oracle @timestamp.sql >> exp.log
EXPDP
erase SIEBEL.dmp
sqlplus -s system/oracle @timestamp.sql > expdp.log
expdp.exe userid=system/oracle@ORA1020
dumpfile=SIEBEL.dmp logfile=SIEBEL.log
schemas='SIEBEL' directory=test_dir
sqlplus -s system/oracle @timestamp.sql >> expdp.log
36
Export Performance Test Results
exp expdp
Average Export 6:02 3:18
Time
Estimated File Size N/A 1.201 GB
Actual File Size 965 MB 621MB
37
Import Scripts
IMP
sqlplus -s system/oracle @timestamp.sql > exp.log
imp.exe userid=system/oracle@ORA1020 file=SIEBEL.dmp
log=SIEBEL.log fromuser='SIEBEL' touser='SCOTT'
commit=y
sqlplus -s system/oracle @timestamp.sql >> exp.log
IMPDP
sqlplus -s system/oracle @timestamp.sql > expdp.log
impdp.exe userid=system/oracle@ORA1020
dumpfile=SIEBEL.dmp logfile=SIEBEL.log
schemas='SIEBEL' directory=test_dir
remap_schema=SIEBEL:SCOTT
remap_tablespace=TOOLS:SCOTT_DATA
sqlplus -s system/oracle @timestamp.sql >> expdp.log
38
Import Performance Test Results
imp impdb
Average Import Time 27:07
Average Import Time (no 25:19
indexes)
Average Import Time (no rows) 27:27
39
Test Scenario #2
40
Export Scripts
EXP
sqlplus -s system/oracle @timestamp.sql > exp.log
exp.exe userid=system/oracle@ORA1020 file=SCOTT.dmp
log=SCOTT.log owner='SCOTT'
sqlplus -s system/oracle @timestamp.sql >> exp.log
EXPDP
erase SIEBEL.dmp
sqlplus -s system/oracle @timestamp.sql > expdp.log
expdp.exe userid=system/oracle@ORA1020
dumpfile=SCOTT.dmp logfile=SCOTT.log schemas='SCOTT'
directory=test_dir
sqlplus -s system/oracle @timestamp.sql >> expdp.log
41
Export Performance Test Results
exp expdp
Average Export 1:24 1:32
Time
Estimated File Size N/A 290MB
Actual File Size 261MB 233MB
42
Import Scripts
IMP
sqlplus -s system/oracle @timestamp.sql > exp.log
imp.exe userid=system/oracle@ORA1020 file=SCOTT.dmp
log=SCOTT.log fromuser='SCOTT' touser='LARRY' commit=y
sqlplus -s system/oracle @timestamp.sql >> exp.log
IMPDP
sqlplus -s system/oracle @timestamp.sql > expdp.log
impdp.exe userid=system/oracle@ORA1020
dumpfile=SCOTT.dmp logfile=SCOTT.log schemas='SCOTT'
directory=test_dir remap_schema=SCOTT:LARRY
remap_tablespace=SCOTT_DATA:LARRY_DATA
sqlplus -s system/oracle @timestamp.sql >> expdp.log
43
Import Performance Test Results
imp impdb
Average Import Time 5:48 2:26
44
Conclusions
45
Conclusions
46
The End
47