测试将RAC GRID_HOME下所有文件属组修改后的修复方式permission.pl

测试将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  

你可能感兴趣的:(ORACLE,RAC/ASM)