RAC安装目录权限快速恢复

 

Rac 安装目录权限快速恢复

1  Validate the by using cluvfy tool.

$ cluvfy comp software -n all -verbose

This though only validates the binary files and theirs permissions. This is mentioned in unpublished bug 18407533 (closed as not a bug).

 

2  Check the permissions from the following 2 files which are created during Grid Infrastructure installation.  

In $GRID_HOME/crs/utl (for 11.2 and 12.1.0.1) and /crs/utl/ (for 12.1.0.2) directory:

 

- crsconfig_dirs which has all directories listed in and their permissions

 

- crsconfig_fileperms which has list of files and their permissions and locations in .

 

3  The permissions can be reverted back to original values with rootcrs.pl or roothas.pl.  For versions 11.2.0.3.6 and higher, there is an option -init:    

Reset the permissions of all files and directories under Oracle . Please ensure CRS is not running while performing the followings:

 

For 11.2:

For clustered Grid Infrastructure, as root user

 

# cd /crs/install/

# ./rootcrs.pl -init

For Standalone Grid Infrastructure, as root user

 

# cd /crs/install/

# ./roothas.pl  -init

 

For 12c:

For clustered Grid Infrastructure, as root user

 

# cd /crs/install/

# ./rootcrs.sh -init

 

 

Need to add or modify executable permissions of crsctl binary , if modified after execucting rootcrs.sh -init as per the BUG 21032304 - LNX64-12C-UD: SOME FILES NOT EXECUTABLE AFTER EXECUTING "ROOTCRS.SH -INIT"

 

For Standalone Grid Infrastructure, as root user

 

 

# cd /crs/install/

# ./roothas.sh -init

 

4 简便方法:

getfaclsetfacl命令

 

a.在节点 2上获取文件及目录的权限 :

     # getfacl -pR /oracle > backup.txt

b.拷贝 backup.txt 至节点 1

c.替换 backup.txt中的 rac2rac1ASM2ASM1orcl2orcl1

     vi bakcup.txt

     :1,$s/rac2/rac1/g  回车 (:n,$s/ rac2/ rac1/g 替换第 n 行开始到最后一行中每一行所有 rac2rac1)

d.在节点 1上恢复权限(切到 backup.txt目录下)

     # setfacl --restore=backup.txt

e. crsctl start crs

f.srvctl start instance -d orcl -i orcl1

g.检查验证。

 

然后去检查节点 1上的权限是否已经恢复 ,包含用户 ,group,acl,suid,sgid.

 

重启!

总结: /oracle 目录被修改之后

1srvctl stop instance -d orcl -i orcl1

2、停止 asm实例   停不下来   kill -9 pid of asm_smon_+ASM1

3、停止 crs  停不下来   kill -9 pid of /oracle/grid/crs_1/bin/crsd.bin reboot

4crsctl stop crs -f

5、恢复目录权限:

         a.在节点 2上获取文件及目录的权限 :

           # getfacl -pR /oracle > backup.txt

         b.拷贝 backup.txt 至节点 1

         c.替换 backup.txt中的 rac2rac1ASM2ASM1orcl2orcl1

           vi bakcup.txt

              :1,$s/rac2/rac1/g  回车 (:n,$s/ rac2/ rac1/g 替换第 n 行开始到最后一行中每一行所有 rac2rac1)

          d.在节点 1上恢复权限(切到 backup.txt目录下)

             # setfacl --restore=backup.txt

6crsctl start crs

7srvctl start instance -d orcl -i orcl1

8、检查验证。

 

 

 

 

 


请使用浏览器的分享功能分享到微信等