Posts

Showing posts with the label rman bash script

Simple Bash Script to automate restore backup of controlfile.

Came up with this very simple script to automate the restore of control file from given backup. This was to answer a question posted on OTN, https://community.oracle.com/message/13668456#13668456 [oracle@prima ~]$ cat cnt_rst.sh export ORACLE_HOME=/orahome/product/11.2.0/dbhome_1 export ORACLE_SID=DG1 bdate=20151214 rman target / cmdfile='to_os.scr' log='os_file.txt' #bpc=`cat os_file.txt | grep -i $bdate | grep -i ncnn | cut -d '/' -f 2-` - to restore from piece bpc=`cat os_file.txt | grep -i 20151214 | grep -i tag: | awk '{print $NF}'` echo "run {" >> rst_cnt.scr #echo "restore controlfile to '/home/oracle/cnt_$bdate.cnt' from '/$bpc';" >> rst_cnt.scr - to restore from piece echo "restore controlfile to '/home/oracle/cnt_$bdate.cnt' from tag $bpc;" >> rst_cnt.scr echo "}" >> rst_cnt.scr rman target / cmdfile='rst_cnt.scr...