測試將RAC GRID_HOME下所有檔案屬組修改後的修復方式permission.pl

還不算暈發表於2016-12-16
測試將GRID_HOME下所有檔案屬組改變為ORACLE使用者的,叢集出現異常後的修復方式。
參考MOS文件:Script to capture and restore file permission in a directory (for eg. ORACLE_HOME) (文件 ID 1515018.1)
測試環境:LINUX-x64+oracle11gR2兩節點RAC
1.測試,修改節點1 GRID_HOME中所有檔案許可權為oracle:oinstall
[root@bys1 app]# cd /u01/11.2.0/grid/
[root@bys1 grid]# chown -R oracle:oinstall ./*


2.在正常節點2上獲取目錄及檔案的正確許可權
[root@bys2 ~]# ls
anaconda-ks.cfg  Documents  install.log         Music          Pictures  Templates
Desktop          Downloads  install.log.syslog  permission.pl  Public    Videos
[root@bys2 ~]# chmod a+x permission.pl
[root@bys2 ~]# ./permission.pl  /u01/11.2.0/grid/
Following log files are generated
logfile      : permission-Wed-Dec-14-16-16-50-2016
Command file : restore-perm-Wed-Dec-14-16-16-50-2016.cmd
Linecount : 17253


3.使用生成的指令碼對許可權進行恢復
[root@bys1 ~]# chmod a+x restore-perm-Wed-Dec-14-16-16-50-2016.cmd
[root@bys1 ~]# ./restore-perm-Wed-Dec-14-16-16-50-2016.cmd >/tmp/chown.log
---從如下輸出來看,主要是一些日誌檔案不存在引起的對應CHOWN語句出錯;
---注意:1.olr在安裝完成時的自動備份檔案許可權需要手動配置
---注意:2.OCR自動備份許可權需要手動配置/u01/11.2.0/grid/cdata/bysrac--許可權不對會導致無法覆蓋
---注意:3.注意檢驗GRID/ORACLE 的home下bin目錄中oracle程式的許可權--6751e及屬組

--部分重複的輸出已經刪除--
chown: cannot access `/u01/11.2.0/grid/cdata/bys1/backup_20161109_205004.olr': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/cdata/bys1/backup_20161109_205004.olr': No such file or directory
chown: cannot access `/u01/11.2.0/grid/cfgtoollogs/opatch/lsinv/lsinventory2016-11-24_15-50-32PM.txt': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/cfgtoollogs/oui/oraInstall2016-11-09_09-01-09PM.out.bys1': No such file or directory
chown: cannot access `/u01/11.2.0/grid/log/bys1/client/clsc_7.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/log/bys1/client/gpnptool_13875.log': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/log/bys1/client/ocrcheck_18006.log': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/log/bys1/client/clsc_9.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/log/bys1/client/gpnptool_12955.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/log/bys1/client/clsc_14.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/log/bys1/client/ocrconfig_14761.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/cv/init/start.txt': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/install/root_bys1.bys.com_2016-11-09_20-46-04.log': No such file or directory
chown: cannot access `/u01/11.2.0/grid/crf/db/bys1/26-NOV-2016-09:36:58.txt': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/crf/db/bys1/10-NOV-2016-13:30:24.txt': No such file or directory
chown: cannot access `/u01/11.2.0/grid/crf/db/bys1/log.0000000018': No such file or directory
chown: cannot access `/u01/11.2.0/grid/crf/db/bys1/26-NOV-2016-09:33:56.txt': No such file or directory
chown: cannot access `/u01/11.2.0/grid/crf/db/bys1/log.0000000017': No such file or directory
chown: cannot access `/u01/11.2.0/grid/crf/db/bys1/10-NOV-2016-12:07:04.txt': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/crf/db/bys1/29-NOV-2016-18:27:55.txt': No such file or directory
chown: cannot access `/u01/11.2.0/grid/oc4j/j2ee/home/log/oc4j_2016_11_29_18_05_27.err': No such file or directory
chown: cannot access `/u01/11.2.0/grid/oc4j/j2ee/home/log/oc4j_2016_11_27_21_25_38.out': No such file or directory
chown: cannot access `/u01/11.2.0/grid/oc4j/j2ee/home/persistence/MBeanServerEjb.ser': No such file or directory
chown: cannot access `/u01/11.2.0/grid/.patch_storage/NApply/2016-11-10_12-54-39PM': No such file or directory
chown: cannot access `/u01/11.2.0/grid/rdbms/log/+asm2_ora_2644.trc': No such file or directory
大量此類檔案
chmod: cannot access `/u01/11.2.0/grid/rdbms/log/+asm2_ora_2478.trc': No such file or directory
chmod: cannot access `/u01/11.2.0/grid/rdbms/audit/+ASM2_ora_10622_20161109214606892302143795.aud': No such file or directory
大量此類檔案
chmod: cannot access `/u01/11.2.0/grid/rdbms/audit/+ASM2_ora_15864_20161109210021310719143795.aud': No such file or directory
chown: cannot access `/u01/11.2.0/grid/dbs/ab_+ASM2.dat': No such file or directory

[root@bys1 ~]#

4.重啟主機或者叢集,檢查叢集狀態,叢集可以恢復正常;
[root@bys1 ~]# crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.DATA.dg
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.LISTENER.lsnr
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.asm
               ONLINE  ONLINE       bys1                     Started             
               ONLINE  ONLINE       bys2                     Started             
ora.gsd
               OFFLINE OFFLINE      bys1                                         
               OFFLINE OFFLINE      bys2                                         
ora.net1.network
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
ora.ons
               ONLINE  ONLINE       bys1                                         
               ONLINE  ONLINE       bys2                                         
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       bys2                                         
ora.bys1.vip
      1        ONLINE  ONLINE       bys1                                         
ora.bys2.vip
      1        ONLINE  ONLINE       bys2                                         
ora.bysrac.db
      1        ONLINE  ONLINE       bys1                     Open                
      2        ONLINE  ONLINE       bys2                     Open                
ora.cvu
      1        ONLINE  ONLINE       bys2                                         
ora.oc4j
      1        OFFLINE OFFLINE                                                   
ora.scan1.vip
      1        ONLINE  ONLINE       bys2  

相關文章