# ------------------------------------------------------------------------- # This is a shell script for making exports directly to tape with a label. # This label contains the db name and timestamp. # # This script also verifies the tape's protection. If the tape is # protected it will display an error message and ask for a new tape. # # Another function lists the tape's label and its contents (option show=y # of export). # # This script also writes a history log with dbname and timestamp. # # Sergio Klimberg <sklimberg@hotmail.com> # -------------------------------------------------------------------------
clear echo ' ORACLE TAPE EXPORTS ' echo ' ------------------- ' b=' ' while [ "$b" != "end" ] do echo echo "* Enter DB for backup or list / Type 'end' to finish" echo ' ' read b if [ "$b" = "end" ] then exit fi echo ' ' echo "* Mount the tape and hit Enter or type 'list' / Type 'end' to finish" echo ' ' echo ' - Warning , Verify tape is not protected for backup ' echo ' - If are you going to list the result will appear on screeen and into /tmp/list.txt' echo ' ' read a echo ' ' read a if [ "$a" = "end" ] then exit fi
mt -t /dev/rmt/0m rew # if [ "$a" = "list" ] then echo echo "<= Export's Header =>" tar tf /dev/rmt/0mn echo " " echo "* Hit Enter for show the export's remainder / Type 'end' to finish" echo ' ' read c if [ "$c" = "end" ] then exit fi echo 'file=/dev/rmt/0m ' >list.imp echo 'log=/tmp/list.txt' >>list.imp echo 'show=y' >>list.imp echo 'volsize=4000M' >>list.imp echo 'full=y ' >>list.imp echo 'back/xxxxxx@'$b >>list.imp imp parfile=list.imp 2>&1 echo echo "Type 'end' to finish " read d exit fi
HORA="`date '+%d-%m-%y %H:%M:%S'`" DESC_EXPORT="EXPORT $b $HORA" touch "$DESC_EXPORT" tar cvf /dev/rmt/0mn "$DESC_EXPORT" 2>/dev/null RTA=$? while [ $RTA != 0 ] do echo "Tape protected , Hit ENTER when it's ready / Type 'end' to finish" read RTA1 if [ "$RTA1" = "end" ] then exit fi tar cvf /dev/rmt/0mn "$DESC_EXPORT" 2>/dev/null RTA=$? done