A script to make autoclone automatically everynight
#!/bin/sh
#############################################################Pay Attention Please############################################################
###This script only tested on RHEL 3.0 for E-business Suite 11i. If you want to use it for E-business Suite R12, You have to Replace the ###
###path of start and stop scripts. Before running the script, make sure all variable has been changed according to your system!!!!!!!!!!!!###
###And because of it is designed to do clone from a backup through Physical Standby and Archivelogs, so you also need to create a Physical###
###Standby on your test server and write a scripts for your Physical Standby to: 1) sync the archive logs; 2) then switch to primary every###
###day; 3) before switchover you should backup the Physical Standby. You should also create a script to: 1) run prelclone on the source db###
###tier, 2) copy $ORACLE_HOME/appsutil/clone from the source db to the target. The last, you should create a backup after your first clone###
###for some files, such as /etc/oraInst.loc, pfile, $CONTEXT_NAME.xml, wdbsvr.app, CGIcmd.dat, etc........................................###
oruser=ortest
apuser=aptest
appspw=apps ###Apps password will be changed to this after refreshed###
apclpw=abcdefg ###Apps password of source database###
systpw=xyz ###System password of source database###
CONTEXT_NAME=TEST_testserver
ORACLE_HOME=/test/oracle/product/920
ORACLE_SID=TEST
export oruser apuser appspw apclpw systpw CONTEXT_NAME ORACLE_HOME ORACLE_SID
echo ""
echo "Shutting down services on Middle Tier ...please wait"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh apps/$appspw"
echo "Waiting for concurrent manager processes to exit..."
echo "Waiting for another 10 munite"
sleep 600
pkill -9 -u $apuser
echo ""
echo "Middle tier services shut down"
echo ""
echo "Shutting down database listener as $oruser user...please wait"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addlnctl.sh stop $ORACLE_SID"
echo ""
echo "Shutting down database as $oruser user...please wait"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh stop abort"
echo ""
echo "All services shut down."
echo "Start to recover database."
cp --reply=yes /etc/oraInst.loc.db.$ORACLE_SID /etc/oraInst.loc
su - $oruser -c "sh $HOME/rman_standby_recover.sh"
su - $oruser -c "sh $HOME/auto_copy_clone.sh"
echo "Start to Clone database"
su - $oruser -c "cd $ORACLE_HOME/appsutil/clone/bin;perl adcfgclone.pl dbTier $ORACLE_HOME/appsutil/$CONTEXT_NAME.xml < $apclpw
EOF
"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh stop immediate"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;cp --reply=yes $ORACLE_HOME/dbs/init$ORACLE_SID.ora.bck $ORACLE_HOME/dbs/init$ORACLE_SID.ora"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh start"
echo ""
echo "Start to Clone apps"
cp --reply=yes /etc/oraInst.loc.ap.$ORACLE_SID /etc/oraInst.loc
su - $apuser -c "cd $COMMON_TOP/clone/bin;perl adcfgclone.pl appsTier $HOME/$CONTEXT_NAME.xml < $apclpw
EOF
"
echo "waiting for application startup"
sleep 1800
echo ""
echo "Shutting down services on Middle Tier ...please wait"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh apps/$apclpw"
echo "Waiting for concurrent manager processes to exit..."
echo "Waiting for another 10 munite"
sleep 600
pkill -9 -u $apuser
echo ""
echo "Middle tier services shut down,now to change apps password"
su - $apuser -c "FNDCPASS apps/$apclpw 0 Y system/$systpw SYSTEM APPLSYS apps"
su - $apuser -c "cp --reply=yes $IAS_ORACLE_HOME/Apache/modplsql/cfg/wdbsvr.app.bck $IAS_ORACLE_HOME/Apache/modplsql/cfg/wdbsvr.app"
su - $apuser -c "cp --reply=yes $ORACLE_HOME/reports60/server/CGIcmd.dat.bck $ORACLE_HOME/reports60/server/CGIcmd.dat"
echo ""
echo "Rebuild workflow mailer queue And change SITE NAME"
su - $apuser -c "sqlplus apps/$appspw @$FND_TOP/patch/115/sql/wfntfqup apps apps applsys"
su - $apuser -c "sqlplus apps/$appspw @$HOME/auto_change_site_name.sql"
echo ""
echo "Now to restart apps"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstrtal.sh apps/$appspw"[@more@]
#############################################################Pay Attention Please############################################################
###This script only tested on RHEL 3.0 for E-business Suite 11i. If you want to use it for E-business Suite R12, You have to Replace the ###
###path of start and stop scripts. Before running the script, make sure all variable has been changed according to your system!!!!!!!!!!!!###
###And because of it is designed to do clone from a backup through Physical Standby and Archivelogs, so you also need to create a Physical###
###Standby on your test server and write a scripts for your Physical Standby to: 1) sync the archive logs; 2) then switch to primary every###
###day; 3) before switchover you should backup the Physical Standby. You should also create a script to: 1) run prelclone on the source db###
###tier, 2) copy $ORACLE_HOME/appsutil/clone from the source db to the target. The last, you should create a backup after your first clone###
###for some files, such as /etc/oraInst.loc, pfile, $CONTEXT_NAME.xml, wdbsvr.app, CGIcmd.dat, etc........................................###
oruser=ortest
apuser=aptest
appspw=apps ###Apps password will be changed to this after refreshed###
apclpw=abcdefg ###Apps password of source database###
systpw=xyz ###System password of source database###
CONTEXT_NAME=TEST_testserver
ORACLE_HOME=/test/oracle/product/920
ORACLE_SID=TEST
export oruser apuser appspw apclpw systpw CONTEXT_NAME ORACLE_HOME ORACLE_SID
echo ""
echo "Shutting down services on Middle Tier ...please wait"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh apps/$appspw"
echo "Waiting for concurrent manager processes to exit..."
echo "Waiting for another 10 munite"
sleep 600
pkill -9 -u $apuser
echo ""
echo "Middle tier services shut down"
echo ""
echo "Shutting down database listener as $oruser user...please wait"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addlnctl.sh stop $ORACLE_SID"
echo ""
echo "Shutting down database as $oruser user...please wait"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh stop abort"
echo ""
echo "All services shut down."
echo "Start to recover database."
cp --reply=yes /etc/oraInst.loc.db.$ORACLE_SID /etc/oraInst.loc
su - $oruser -c "sh $HOME/rman_standby_recover.sh"
su - $oruser -c "sh $HOME/auto_copy_clone.sh"
echo "Start to Clone database"
su - $oruser -c "cd $ORACLE_HOME/appsutil/clone/bin;perl adcfgclone.pl dbTier $ORACLE_HOME/appsutil/$CONTEXT_NAME.xml <
EOF
"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh stop immediate"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;cp --reply=yes $ORACLE_HOME/dbs/init$ORACLE_SID.ora.bck $ORACLE_HOME/dbs/init$ORACLE_SID.ora"
su - $oruser -c ". $ORACLE_HOME/$CONTEXT_NAME.env;$ORACLE_HOME/appsutil/scripts/$CONTEXT_NAME/addbctl.sh start"
echo ""
echo "Start to Clone apps"
cp --reply=yes /etc/oraInst.loc.ap.$ORACLE_SID /etc/oraInst.loc
su - $apuser -c "cd $COMMON_TOP/clone/bin;perl adcfgclone.pl appsTier $HOME/$CONTEXT_NAME.xml <
EOF
"
echo "waiting for application startup"
sleep 1800
echo ""
echo "Shutting down services on Middle Tier ...please wait"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstpall.sh apps/$apclpw"
echo "Waiting for concurrent manager processes to exit..."
echo "Waiting for another 10 munite"
sleep 600
pkill -9 -u $apuser
echo ""
echo "Middle tier services shut down,now to change apps password"
su - $apuser -c "FNDCPASS apps/$apclpw 0 Y system/$systpw SYSTEM APPLSYS apps"
su - $apuser -c "cp --reply=yes $IAS_ORACLE_HOME/Apache/modplsql/cfg/wdbsvr.app.bck $IAS_ORACLE_HOME/Apache/modplsql/cfg/wdbsvr.app"
su - $apuser -c "cp --reply=yes $ORACLE_HOME/reports60/server/CGIcmd.dat.bck $ORACLE_HOME/reports60/server/CGIcmd.dat"
echo ""
echo "Rebuild workflow mailer queue And change SITE NAME"
su - $apuser -c "sqlplus apps/$appspw @$FND_TOP/patch/115/sql/wfntfqup apps apps applsys"
su - $apuser -c "sqlplus apps/$appspw @$HOME/auto_change_site_name.sql"
echo ""
echo "Now to restart apps"
su - $apuser -c "$COMMON_TOP/admin/scripts/$CONTEXT_NAME/adstrtal.sh apps/$appspw"[@more@]
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35496/viewspace-1057221/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Doc list involved with autoclone and configOracle
- DML Locks Automatically Acquired for DML Statements (349)UI
- Make 使用
- Make It Zero
- A gateway to automatically provide RESTful API for gRPCGatewayIDERESTAPIRPC
- WPF automatically generate shapes fill wrappanelAPP
- Script
- ./configure,make,make install的作用
- NDK的坑爹問題make: *** No rule to make target
- Script Browser & Script Analyzer 1.3更新發布
- Make 命令教程
- make與cmake
- Shell Script
- shell script
- oracle scriptOracle
- script win
- bat scriptBAT
- Building an Automatically Scaling Web ApplicationUIWebAPP
- Linux 的./configure,make,make install的作用Linux
- caffe make 編譯編譯
- Make NTFS writable on macOSMac
- fitflop arrives make a list of
- GNU make 指南(轉)
- html:how to make love?HTML
- Go make 介紹Go
- Python實現make_bricks與make_chocolate問題Python
- script標籤
- [Oracle Script] LockOracle
- Tablespace Space Script
- Cold backup script
- Oracle Database ScriptOracleDatabase
- tom's script
- Shell Script(轉)
- TEMPORARY LOBS are not freed up automatically after PL/SQL block executionSQLBloC
- 控制make的函式函式
- Make 命令教程詳解
- GNU Make 4.0釋出
- Make notes for disaster recoveryAST