重灌系統後快速還原RAC-APP

zcs0237發表於2014-07-16
1、快速恢復RAC節點系列文章:
OCR-disk的恢復:http://www.itpub.net/thread-1876010-1-1.html
Votedisk的恢復:http://www.itpub.net/thread-1876017-1-1.html
快速還原RAC節點程式:http://www.itpub.net/thread-1878271-1-1.html
2、測試環境:10.2.0.1.0  on rhel5
3、測試過程如下,歡迎補充、指正


一、建立rac node上需要備份的程式檔案清單
# find  /etc/init.d/init.*                       >lst
find  /etc/rc{0,1,2,4,6}.d/K96init.crs         >>lst
find  /etc/rc{3,5}.d/S96init.crs               >>lst
find  /etc/inittab.crs /etc/inittab            >>lst
find  /home/oracle/oraInventory                >>lst
find  /home/oracle/.ssh                        >>lst
#find  /u01                                     >>lst   #為節約測試時間暫時註釋掉
find  /etc/oraInst.loc /etc/oracle /etc/oratab >>lst
find   /opt/oracle                             >>lst
find   /opt/ORCLfmap                           >>lst
find   /usr/local/bin/coraenv                  >>lst
find   /usr/local/bin/dbhome                   >>lst
find   /usr/local/bin/oraenv                   >>lst

二、將清單中的檔案打包備份
#  tar -czvPWf $HOSTNAME.tgz -T lst

補充說明:
tar  -c,--create:建立一個新歸檔
tar  -z, --gzip, --gunzip:使用 gzip 處理歸檔
tar  -v, --verbose:詳細地列出處理的檔案
tar  -P, --absolute-names:不要從檔名中清除引導符‘/’
tar  -W, --verify:在寫入以後嘗試校驗歸檔
tar  -f,--file:指定備份檔案。後緊跟被處理的檔名,不要再加其它引數
tar  -T:從檔名清單建立tar歸檔

三、模擬重灌系統(本測試僅將RAC程式刪除)
# rm -rf /etc/init.d/init.*
rm -f /etc/rc{0,1,2,4,6}.d/K96init.crs
rm -f /etc/rc{3,5}.d/S96init.crs
rm -f /etc/inittab.crs
echo y|cp /etc/inittab.orig /etc/inittab
rm -rf /home/oracle/oraInventory
rm -rf /home/oracle/.ssh
#rm -rf /u01                            #為節約測試時間暫時不刪掉/u01
rm -rf /etc/oraInst.loc
rm -rf /etc/oracle
rm -rf /etc/oratab
rm -rf /opt/oracle
rm -rf /opt/ORCLfmap
rm -rf /tmp/hsperfdata_oracle
rm -rf /tmp/OraInstall*
rm -rf /tmp/OraInstall*
rm -rf /usr/local/bin/coraenv
rm -rf /usr/local/bin/dbhome
rm -rf /usr/local/bin/oraenv
#mkdir -p /u01/app/oracle
#chown -R oracle:oinstall /u01
#chmod -R 775 /u01

reboot

四、從 $HOSTNAME.tgz備份恢復中恢復程式檔案
# ls *.tgz 
rac1.tgz
# echo $HOSTNAME
rac1
# echo y|tar -xzwPf $HOSTNAME.tgz
extract `/etc/init.d/init.crs'?extract `/etc/init.d/init.crsd'?
extract `/etc/init.d/init.cssd'?
extract `/etc/init.d/init.evmd'?
extract `/etc/rc0.d/K96init.crs'?
extract `/etc/rc1.d/K96init.crs'?
extract `/etc/rc2.d/K96init.crs'?
extract `/etc/rc4.d/K96init.crs'?
extract `/etc/rc6.d/K96init.crs'?
extract `/etc/rc3.d/S96init.crs'?
extract `/etc/rc5.d/S96init.crs'?
extract `/etc/inittab.crs'?
extract `/etc/inittab'?
extract `/home/oracle/.ssh'?
extract `/home/oracle/.ssh/authorized_keys'?
extract `/home/oracle/.ssh/known_hosts'?
extract `/home/oracle/.ssh/id_dsa.pub'?
extract `/home/oracle/.ssh/id_dsa'?
extract `/home/oracle/.ssh/id_rsa.pub'?
extract `/home/oracle/.ssh/id_rsa'?
extract `/home/oracle/.ssh/authorized_keys'?
extract `/home/oracle/.ssh/known_hosts'?
extract `/home/oracle/.ssh/id_dsa.pub'?
extract `/home/oracle/.ssh/id_dsa'?
extract `/home/oracle/.ssh/id_rsa.pub'?
extract `/home/oracle/.ssh/id_rsa'?
extract `/etc/oraInst.loc'?
extract `/etc/oracle'?
extract `/etc/oracle/ocr.loc'?
extract `/etc/oracle/scls_scr'?
extract `/etc/oracle/scls_scr/rac1'?
extract `/etc/oracle/scls_scr/rac1/root'?
extract `/etc/oracle/scls_scr/rac1/root/crsdboot'?
extract `/etc/oracle/scls_scr/rac1/root/nooprocd'?
extract `/etc/oracle/scls_scr/rac1/root/cssrun'?
extract `/etc/oracle/scls_scr/rac1/root/crsstart'?
extract `/etc/oracle/scls_scr/rac1/root/noclsmon'?
extract `/etc/oracle/scls_scr/rac1/oracle'?
extract `/etc/oracle/scls_scr/rac1/oracle/cssfatal'?
extract `/etc/oracle/ocr.loc'?
extract `/etc/oracle/scls_scr'?
extract `/etc/oracle/scls_scr/rac1'?
extract `/etc/oracle/scls_scr/rac1/root'?
extract `/etc/oracle/scls_scr/rac1/root/crsdboot'?
extract `/etc/oracle/scls_scr/rac1/root/nooprocd'?
extract `/etc/oracle/scls_scr/rac1/root/cssrun'?
extract `/etc/oracle/scls_scr/rac1/root/crsstart'?
extract `/etc/oracle/scls_scr/rac1/root/noclsmon'?
extract `/etc/oracle/scls_scr/rac1/oracle'?
extract `/etc/oracle/scls_scr/rac1/oracle/cssfatal'?
extract `/etc/oracle/scls_scr/rac1'?
extract `/etc/oracle/scls_scr/rac1/root'?
extract `/etc/oracle/scls_scr/rac1/root/crsdboot'?
extract `/etc/oracle/scls_scr/rac1/root/nooprocd'?
extract `/etc/oracle/scls_scr/rac1/root/cssrun'?
extract `/etc/oracle/scls_scr/rac1/root/crsstart'?
extract `/etc/oracle/scls_scr/rac1/root/noclsmon'?
extract `/etc/oracle/scls_scr/rac1/oracle'?
extract `/etc/oracle/scls_scr/rac1/oracle/cssfatal'?
extract `/etc/oracle/scls_scr/rac1/root'?
extract `/etc/oracle/scls_scr/rac1/root/crsdboot'?
extract `/etc/oracle/scls_scr/rac1/root/nooprocd'?
extract `/etc/oracle/scls_scr/rac1/root/cssrun'?
extract `/etc/oracle/scls_scr/rac1/root/crsstart'?
extract `/etc/oracle/scls_scr/rac1/root/noclsmon'?
extract `/etc/oracle/scls_scr/rac1/root/crsdboot'?
extract `/etc/oracle/scls_scr/rac1/root/nooprocd'?
extract `/etc/oracle/scls_scr/rac1/root/cssrun'?
extract `/etc/oracle/scls_scr/rac1/root/crsstart'?
extract `/etc/oracle/scls_scr/rac1/root/noclsmon'?
extract `/etc/oracle/scls_scr/rac1/oracle'?
extract `/etc/oracle/scls_scr/rac1/oracle/cssfatal'?
extract `/etc/oracle/scls_scr/rac1/oracle/cssfatal'?
extract `/etc/oratab'?
extract `/opt/ORCLfmap'?
extract `/opt/ORCLfmap/prot1_32'?
extract `/opt/ORCLfmap/prot1_32/log'?
extract `/opt/ORCLfmap/prot1_32/bin'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputl'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputlhp'?
extract `/opt/ORCLfmap/prot1_32/etc'?
extract `/opt/ORCLfmap/prot1_32/etc/filemap.ora'?
extract `/opt/ORCLfmap/prot1_32'?
extract `/opt/ORCLfmap/prot1_32/log'?
extract `/opt/ORCLfmap/prot1_32/bin'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputl'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputlhp'?
extract `/opt/ORCLfmap/prot1_32/etc'?
extract `/opt/ORCLfmap/prot1_32/etc/filemap.ora'?
extract `/opt/ORCLfmap/prot1_32/log'?
extract `/opt/ORCLfmap/prot1_32/bin'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputl'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputlhp'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputl'?
extract `/opt/ORCLfmap/prot1_32/bin/fmputlhp'?
extract `/opt/ORCLfmap/prot1_32/etc'?
extract `/opt/ORCLfmap/prot1_32/etc/filemap.ora'?
extract `/opt/ORCLfmap/prot1_32/etc/filemap.ora'?
extract `/usr/local/bin/coraenv'?
extract `/usr/local/bin/dbhome'?
extract `/usr/local/bin/oraenv'?

補充說明:
tar  -w, --interactive, --confirmation 每次操作都要求確認
tar  -P, --absolute-names:不要從檔名中清除引導符‘/’

五、驗證還原是否有效果
1、以root身份重啟RAC節點
[root@rac1 ~]# reboot
2、驗證程式是否已經執行
[oracle@rac1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    ONLINE    ONLINE    rac1        
ora....B2.inst application    ONLINE    ONLINE    rac2        
ora.RACDB.db   application    ONLINE    ONLINE    rac2        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2

六、特別補充
# cat 60-raw.rules 
# This file and interface are deprecated.
# Applications needing raw device access should open regular
# block devices with O_DIRECT.
#
# Enter raw device bindings here.
#
# An example would be:
#   ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N"
# to bind /dev/raw/raw1 to /dev/sda, or
#   ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m"
# to bind /dev/raw/raw2 to the device with major 8, minor 1.
ACTION=="add", KERNEL=="/dev/sdb1",RUN+="/bin/raw /dev/raw/raw1 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="17",RUN+="/bin/raw /dev/raw/raw1 %M %m"
ACTION=="add", KERNEL=="/dev/sdc1",RUN+="/bin/raw /dev/raw/raw2 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="33",RUN+="/bin/raw /dev/raw/raw2 %M %m"
ACTION=="add", KERNEL=="/dev/sdd1",RUN+="/bin/raw /dev/raw/raw3 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="49",RUN+="/bin/raw /dev/raw/raw3 %M %m"
ACTION=="add", KERNEL=="/dev/sde1",RUN+="/bin/raw /dev/raw/raw4 %N"
ACTION=="add", ENV{MAJOR}=="8",ENV{MINOR}=="65",RUN+="/bin/raw /dev/raw/raw4 %M %m"
KERNEL=="raw[1-4]", OWNER="oracle", GROUP="oinstall", MODE="640"

zcs0237 
2014.07.16
More cleaner and more efficient!

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/210154/viewspace-1220730/,如需轉載,請註明出處,否則將追究法律責任。

相關文章