Friday, October 16, 2015

EXPDP Command in Action


Create dump directory and give grants

 CREATE OR REPLACE DIRECTORY DUMP_DIRAS '/u02/live_dump'
 GRANT READ, WRITE ON DIRECTORY importme TO dba_user;


Export Full Schema

expdp directory=DUMP_DIRE  dumpfile=scott_test.dmp logfile=scott_test.log schemas=scott flashback_time=\"to_timestamp\(to_char\(sysdate,\'yyyy-mm-dd hh24:mi:ss\'\),\'yyyy-mm-dd hh24:mi:ss\'\)\"


Export Tables

expdp directory=DUMP_DIRE  dumpfile=scott_test_table.dmp logfile=scott_test_table.log tables=scott.enployees flashback_time=\"to_timestamp\(to_char\(sysdate,\'yyyy-mm-dd hh24:mi:ss\'\),\'yyyy-mm-dd hh24:mi:ss\'\)\"


Export Schema without specific tables

expdp directory=DUMP_DIRE  dumpfile=scott_test.dmp logfile=scott_test.log schemas=scott flashback_time=\"to_timestamp\(to_char\(sysdate,\'yyyy-mm-dd hh24:mi:ss\'\),\'yyyy-mm-dd hh24:mi:ss\'\)\" EXCLUDE=TABLE:\"LIKE \'AUDIT%\'\"

Get dump file size Estimate

expdp directory=DUMP_DIRE  schemas=scott flashback_time=\"to_timestamp\(to_char\(sysdate,\'yyyy-mm-dd hh24:mi:ss\'\),\'yyyy-mm-dd hh24:mi:ss\'\)\" ESTIMATE_ONLY=Y


Export data with where condition 

create file as backup.par with following details

DIRECTORY= DUMP_DIRE
DUMPFILE= scott_table.dmp
LOGFILE= scott_table.log
TABLES=scott_employee
QUERY="where JOB_TYPE = 'ACC' and SALARY >= 10000"
EXCLUDE=statistics

then execute expdp command

expdp parfile=backup.par

No comments:

Post a Comment