Tuesday, August 24, 2010

Oracle Tips: using Data Pump

Create Directory for Export & Import Data in Oracle
-- Unix
create directory expdp_dir as '/u01/backup/exports'; OR
-- Windows
create directory expdp_dir as 'C:\orabackup\exports';

grant read,write on directory expdp_dir to system, user1, user2, user3;

Data Pump Export
Full Export Mode

expdp system/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=expfull.dmp FULL=y LOGFILE=expfull.log

Schema Export Mode
expdp <schema_owner/system>/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=schema_exp.dmp SCHEMAS=<schema1>,<schema2> LOGFILE=expSCHEMA.log

Table Export Mode
expdp <schema_owner>/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=tables_exp.dmp TABLES=<table1>,<table2>,<table3> LOGFILE=expTABLES.log


Data Pump Import
Full Import Mode
impdp system/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=expfull.dmp FULL=y LOGFILE=impfull.log

Schema Import Mode
impdp <schema_owner/system>/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=expfull.dmp SCHEMAS=<schema1>,<schema2> LOGFILE=impSCHEMA.log

Table Import Mode
impdp <schema_owner>/<password>@<db_name> DIRECTORY=expdp_dir DUMPFILE=expfull.dmp TABLES=<table1>,<table2>,<table3> LOGFILE=impTABLES.log

No comments: