Sunday, December 9, 2012

SHELL SCRIPTING OF ORACLE DATAPUMP


This will take the full Database export using data pump in daily directory basis.
and also compress the dump file from 100GB to 12 GB

Steps:- Change the red coloured location as per your path and destination.

then open new file vi expdp.sh
copy and paste all the script in expdp.sh file.
save the file.
then give the permission to expdp.sh file.........     chmod -R 777 expdp.sh
then run the file for testing purpose.

sh expdp.sh and enjoy.




now=$(date +"%b-%d-%y")
mkdir -p /backup/daily_dppump_export/exports/$now
directory=/backup/daily_dppump_export/exports/$now/
echo "create or replace directory dpdata as '/backup/daily_dppump_export/exports/$now';" > create_directory.sql
echo "exit" >> create_directory.sql
sqlplus -s "/ as sysdba" @create_directory.sql
expdp "'/ as sysdba'" FULL=Y directory=dpdata dumpfile=EXPDP_TEST_FULL.dmp
gzip -f -v $directory*.dmp



Note:- Try everything at your own risk, if any thing happens wrong with your database so blogger will not be responsible.

2 comments: