oracle集群管理-测试将RAC GRID_HOME下所有文件属组修改后的修复方式permission.pl

本文介绍在Oracle 11g R2两节点RAC集群中,如何通过脚本恢复因修改GRID_HOME文件属组至ORACLE用户导致的集群异常。详细步骤包括:在正常节点上获取正确的权限信息,使用生成的脚本恢复权限,重启集群并验证状态,以及重要文件权限检查。

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

5.几种重要文件的权限

1 ASM磁盘的文件权限

检查ASM磁盘的权限,确认属主为grid用户,group为asmadmin,且权限为660.

2 执行文件oracle的权限

检查rdbms_home/bin/oralce文件的权限,确认属主为oracle用户,group和asm磁盘的group相同,同时黏着位被设置

如果属主出现问题会出现很多问题例如无法登录到数据库,ora-600错误,访问ASM磁盘时出现问题,解决办法很简单,使用如下脚本

GI_HOME/bin/setasmgidwrap -o RDBMS_HOME/bin/oracle

3 socket文件的权限

检查/var/tmp/.oracle/目录是否有创建文件的权限等。


版权声明:本文为CSDN博主「还不算晕」的原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/q947817003/java/article/details/53697505

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值