Datapump EXPDP and IMPDP scripts

Expdp and Impdp backup Script in Linux platform

 
You can simply copy paste the script and change the location present in the script and save as shell script.It is also used to scheduled backup in crontab.

Parameter Details for scripts:
DATO Parameter: is used for current date
ORACLE_SId Parameter: is used to mention your oracle database SID.
EXP_ORADIR Parameter: is used to define the dump directory present in your database for backup.

Script for EXPDP


. /u01/app/oracle/.bashrc
#NLS_LANG=American_Norway.we8iso8859p1
#NLS_DATE_FORMAT=DD-MON-YYYY HH24:MI:SS
DATO=`date +%d%m%EY`
ORAENV_ASK=NO
ORACLE_SID=
#EXP_DIR=/scratch/datapump
#OLD_EXP_DIR=/scratch/datapump/old
EXP_ORADIR=datapump1
export EXP_DIR OLD_EXP_DIR EXP_ORADIR NLS_DATE_FORMAT ORACLE_SID#mv $EXP_DIR/expdp_$ORACLE_SID.log $OLD_EXP_DIR
#mv $EXP_DIR/expdp_$ORACLE_SID.dmp $OLD_EXP_DIRexpdp \"/@ as sysdba\" directory=$EXP_ORADIR dumpfile=expdp_$ORACLE_SID.dmp logfile=expdp_$ORACLE_SID.log full=y flashback_time=\"to_timestamp\(to_char\(SYSDATE-1/8640,
\'DD-MON-YYYY HH24:MI:SS\'\), \'DD-MON-YYYY HH24:MI:SS\'\)\"

Impdp Script is used to import the dump file generated by expdp backup utility.
You simply copy paste the following script change the parameter as needed and save it as shell script

Scripts for IMPDP

. /u01/app/oracle/.bashrc
#NLS_LANG=American_Norway.we8iso8859p1
#NLS_DATE_FORMAT=DD.MM.RRRR
DATO=`date +%d%m%EY`
#ORAENV_ASK=NO
ORACLE_SID=#OLD_EXP_DIR=/scratch/datapump/old
EXP_ORADIR=DATA_PUMP_DIR
export EXP_DIR OLD_EXP_DIR EXP_ORADIR NLS_DATE_FORMAT ORACLE_SIDimpdp \"/@ as sysdba\" directory=$EXP_ORADIR dumpfile=exp_PROD_V11_1_20110711_17-30.dmp logfile=impdp_$ORACLE_SID.log

 
 

Advertisements

One thought on “Datapump EXPDP and IMPDP scripts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s