EBS R12 克隆備份指令碼
[root@hostname ~]$ cat Autobackup.sh
#!/bin/bash
###
### The script. is auto cold backup EBS service.
### It about need 5 hours.
### Pay attention to run it by penske account
### Current appTier and DBTier is running.
###
# Define variable
penske_home=/d01/penske
date=`date +%Y%m%d%H%M`
PSline=12
psline=12
firsttime=1
lasttime=50
# Stop EBS appTier service
cd $penske_home
source /home/penske/.apps
echo "It's stopping application Tier"
$INST_TOP/admin/scripts/adstpall.sh apps/pass*****>>$penske_home/Autobackup"$date".log 2>&1
sleep 120s
#Judge whether FND* process is end
while [ $PSline -ge 2 ]
do
echo "It's stopping"
sleep 20s
PSline=`ps -ef | grep FND* | wc -l | awk '{print $1}'`
if [ $firsttime -lt $lasttime ];then
echo "Wait twenty second"
else
break;
fi
let "firsttime++"
done
#Kill process of unfinished
echo "FND process can't stop normally. It will be killed immediately"
ps -ef | grep FND* | awk '{print $2}' > /home/penske/FNDpid.txt
for FNDpid in `cat /home/penske/FNDpid.txt`;
do
kill -9 "$FNDpid"
done
echo "It's stopped successful">>$penske_home/Autobackup"$date".log 2>&1
echo -e "Yeah \nIt's ok">>$penske_home/Autobackup"$date".log 2>&1
sleep 20s
rm -rf /home/oracrp/FNDpid.txt
# Preclone
source /home/penske/.ora11g
cd $ORACLE_HOME/appsutil/scripts/PROD_PLASPASHCN13/
perl adpreclone.pl dbTier>>$penske_home/Autobackup"$date".log 2>&1
sleep 300s
source /home/penske/.apps
cd $INST_TOP/admin/scripts/
perl adpreclone.pl appsTier>>$penske_home/Autobackup"$date".log 2>&1
sleep 300s
# Stop EBS dbTier service
source /home/penske/.ora11g
echo "It's stopping Database Tier"
$ORACLE_HOME/appsutil/scripts/PROD_PLASPASHCN13/addlnctl.sh stop prod>>$penske_home/Autobackup"$date".log 2>&1
sleep 60s
$ORACLE_HOME/appsutil/scripts/PROD_PLASPASHCN13/addbctl.sh stop immediate prod>>$penske_home/Autobackup"$date".log 2>&1
sleep 120s
while [ $psline -ge 2 ]
do
echo "It's running, for a moment"
sleep 5s
psline=`ps -ef | grep ora_ | wc -l | awk 'print $1'`
done
echo “It’s backuping ora11g directory”>>$penske_home/Autobackup"$date".log 2>&1
# Cold backup by tar command
tar zcfp /d01/bak_clone_to137/ora11g"$date".tar.gz ./ora11g>>$penske_home/Autobackup"$date".log 2>&1
echo “It’s backuping R12apps directory”>>$penske_home/Autobackup"$date".log 2>&1
tar zcfp /d01/bak_clone_to137/R12apps"$date".tar.gz ./R12apps>>$penske_home/Autobackup"$date".log 2>&1
echo "It's backuping proddata directory">>$penske_home/Autobackup"$date".log 2>&1
tar zcfp /d01/bak_clone_to137/proddata"$date".tar.gz ./proddata>>$penske_home/Autobackup"$date".log 2>&1
echo “It’s completed all backup processing”>>$penske_home/Autobackup"$date".log 2>&1
sleep 30s
# Start EBS service
echo "It's starting Database Tier">>$penske_home/Autobackup"$date".log 2>&1
/d01/penske/ora11g/db/tech_st/11.1.0/appsutil/scripts/PROD_plaspashcn13/addlnctl.sh start prod>>$penske_home/Autobackup"$date".log 2>&1
sleep 100s
/d01/penske/ora11g/db/tech_st/11.1.0/appsutil/scripts/PROD_plaspashcn13/addbctl.sh start prod>>$penske_home/Autobackup"$date".log 2>&1
sleep 160s
source /home/penske/.apps
echo "It's starting application Tier">>$penske_home/Autobackup"$date".log 2>&1
/d01/penske/R12apps/inst/apps/PROD_plaspashcn13/admin/scripts/adstrtal.sh apps/pass****>>Autobackup"$date".log 2>&1
sleep 300s
# Display result information
echo "The EBS service is startup successful">>$penske_home/Autobackup"$date".log 2>&1
echo "The script. log message in /d01/penske/Autobackup"$date".log. Please review it"
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/15187685/viewspace-759728/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 3Oracle資料庫
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 2Oracle資料庫
- EBS R12克隆 - Oracle11.2.0.3 EBS資料庫克隆(RMAN恢復) 1Oracle資料庫
- 備份指令碼指令碼
- rman備份和增量備份指令碼指令碼
- ORACLE備份指令碼Oracle指令碼
- mysqldump 備份指令碼MySql指令碼
- rman 備份指令碼指令碼
- mysqldump備份指令碼MySql指令碼
- innobackupex備份指令碼指令碼
- SQLServer備份指令碼SQLServer指令碼
- SQL 備份指令碼SQL指令碼
- Mongodb 備份指令碼MongoDB指令碼
- rman備份指令碼指令碼
- oracle 備份指令碼Oracle指令碼
- mysql備份指令碼MySql指令碼
- windows mysqldump備份指令碼WindowsMySql指令碼
- 自動備份指令碼指令碼
- mysql innobackupex備份指令碼MySql指令碼
- rman 全備份指令碼指令碼
- rman增量備份指令碼指令碼
- windows rman備份指令碼Windows指令碼
- Windows 快速備份指令碼Windows指令碼
- ORACLE日常備份指令碼Oracle指令碼
- RMAN常用備份指令碼指令碼
- Oracle 集中備份指令碼Oracle指令碼
- 生成熱備份指令碼指令碼
- 生成冷備份指令碼指令碼
- 備份指令碼--紀錄指令碼
- oracle RMAN備份指令碼Oracle指令碼
- EXP的備份指令碼指令碼
- oracle_備份指令碼Oracle指令碼
- MySQL備份之分庫分表備份指令碼MySql指令碼
- Oracle冷備份(一致備份)指令碼Oracle指令碼
- 兩套mysql備份指令碼MySql指令碼
- 資料庫備份指令碼資料庫指令碼
- mysql按表備份指令碼MySql指令碼
- [Oracle] rman備份指令碼(2)Oracle指令碼