RAC安裝目錄許可權快速恢復

yingyifeng306發表於2022-04-15

 

安裝目錄許可權快速恢復

$ 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).

 

 

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>.

 

   

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

 

簡便方法:

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、檢查驗證。

 

 

 

 

 


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23732248/viewspace-2887194/,如需轉載,請註明出處,否則將追究法律責任。

相關文章