vi expdp_all_schemas.sh
rm *.DMP
rm *.tar
cd /home/oracle/rman_src/
./dpexp_all.sh
TICK=$(date +"%d.%m.%Y %H:%M:%S")
echo "2. End expdp and begin archiveing in $TICK" >> "$OPER_LOG$FILE_LOG"
/bin/tar -cf /oracle/dpdump/dpdump_backup_$NOW.tar /oracle/dpdump
#===================================================================================================
#Checking that remote server is visiable
remote_server="xxx.xxx.xxx.xxx"
checkserver=`ping -c 1 $remote_server | grep loss | awk -F "," '{print $3}'`
l_cp_backup=0
if [ "$checkserver" = " 0% packet loss" ]
then
echo "Server $remote_server on"
#Next we need check that remote backup folder is mounted
checkmount=`cat /etc/mtab | grep "//$remote_server/msc /mnt/win"`
if [ -z "$checkmount" ]
then
echo "Not mount, try mount it"
mount -t cifs -o username="zzzzzzzz",password="yyyyy" //$remote_server/msc /mnt/win
#Try again that folder is mounted
checkmount=`cat /etc/mtab | grep "//$remote_server/msc /mnt/win"`
if [ -z "$checkmount" ]
then
echo "There is problem with mounting remote folder."
else
l_cp_backup=1
fi
else
l_cp_backup=1
fi
else
echo "ERROR: Remote server [$remote_server] for storage backup is OFF."
fi
#===================================================================================================
if [ "$l_cp_backup" -eq "1" ]
then
echo "OK: Copy backup"
TICK=$(date +"%d.%m.%Y %H:%M:%S")
echo "3. End archiveing and begin copy in $TICK" >> "$OPER_LOG$FILE_LOG"
cp /oracle/dpdump/dpdump_backup_$NOW.tar /mnt/win/dpdump_backups/dpdump_backup_$NOW.tar
TICK=$(date +"%d.%m.%Y %H:%M:%S")
echo "4. End coping in $TICK" >> "$OPER_LOG$FILE_LOG"
CNT=$(ls /mnt/win/dpdump_backups | grep tar | wc -l)
if [ "$CNT" -gt "$USL" ]
then
echo "Delete old backup."
rm `ls --sort=time /mnt/win/dpdump_backups/*.tar|tail --lines=1`
fi
else
echo "ERROR: No ACTION."
echo "ERROR: No ACTION: in $(date +"%d.%m.%Y %H:%M:%S")" >> "$OPER_LOG$FILE_LOG"
fi
exit 0
vi dpexp_all.sh
...
...
...
...
...