Pages

Tuesday, April 25, 2017

bash example. expdp and scp of generated dmp file

==================================
General
==================================
Example of running oracle expdp, amd scp of generated dmp file to another server.

#!/bin/bash
. /etc/profile
. /etc/sh/orash/oracle_login.sh orainst
HOST='100.100.100.30'
USER='my_user'
PASSWD='my_pass'

cd /starhome/my_user/workarea/

expdp db_user/db_pass@orainst PARFILE=exp_sparx.prm
if [ $? -ne 0 ]
then
/usr/local/etc/starhome/bin/send_snmp.sh Critical "Export dump of MLT_VODAF_SPARX failed exiting" 987989 ;
exit;
fi

expdp db_user/db_pass@orainst PARFILE=exp_metadata.prm
if [ $? -ne 0 ] 
then
/usr/local/etc/starhome/bin/send_snmp.sh Critical "Export Meta data dump of MLT_VODAF_SPARX failed exiting" 987989;
exit;
fi

sudo /software/oracle/oracle/scripts/change_dmp_permissions.sh
#chmod a+r,a+w /starhome/my_user/workarea/ora_exp/dmp_a_exp.dmp
#chmod a+r,a+w /starhome/my_user/workarea/ora_exp/dmp_b_exp.dmp


scp my_user@10.100.100.58:/starhome/my_user/workarea/ora_exp/dmp_a_exp.dmp my_user@100.100.100.30:/starhome/my_user/workarea/ora_exp/
if [ $? -ne 0 ]
then
/usr/local/etc/starhome/bin/send_snmp.sh Critical "Export dump file mlt_vod_sparx_exp_metadata.dmp transfer failed exiting" 987989;
exit;
fi

scp my_user@10.100.100.58:/starhome/my_user/workarea/ora_exp/dmp_b_exp.dmp my_user@100.100.100.30:/starhome/my_user/workarea/ora_exp/
if [ $? -ne 0 ]
then
/usr/local/etc/starhome/bin/send_snmp.sh Critical "Export dump file mlt_vod_sparx_exp_data.dmp transfer failed exiting" 987989;
exit;


==================================
scp
==================================
Example scp
scp my_file remote_user@remote_server:/remote_dir

No comments:

Post a Comment