rac安装目录权限快速恢复

来源:这里教程网 时间:2026-03-03 19:36:28 作者:

1. Validate the <GRID_HOME> 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 <GRID_HOME>/crs/utl/<hostname> (for 12.1.0.2) directory:

 

- crsconfig_dirs which has all directories listed in <GRID_HOME> and their permissions

 

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

 

 

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 <GRID_HOME>.  Please ensure CRS is not running while performing the followings:

 

For 11.2:

For clustered Grid Infrastructure, as root user

 

# cd <GRID_HOME>/crs/install/

# ./rootcrs.pl -init

For Standalone Grid Infrastructure, as root user

 

# cd <GRID_HOME>/crs/install/

# ./roothas.pl  -init

 

For 12c:

For clustered Grid Infrastructure, as root user

 

# cd <GRID_HOME>/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 <GRID_HOME>/crs/install/

# ./roothas.sh -init

 

 

简便方法:

 

getfacl 、setfacl命令

 

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

     # getfacl -pR /oracle > backup.txt

b. 拷贝 backup.txt 至节点1

c. 替换backup.txt中的rac2为rac1、ASM2为ASM1、orcl2为orcl1

     vi bakcup.txt

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

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 目录被修改之后

1 、srvctl 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

4 、crsctl stop crs -f

5 、恢复目录权限:

            

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

             # getfacl -pR /oracle > backup.txt

          b. 拷贝 backup.txt 至节点1

          c. 替换backup.txt中的rac2为rac1、ASM2为ASM1、orcl2为orcl1

             vi bakcup.txt

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

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

               # setfacl --restore=backup.txt

6 、crsctl start crs

7 、srvctl start instance -d orcl -i orcl1 8 、检查验证。

相关推荐