A-A+

RAC单节点属组恢复

2013年06月17日 DG&RAC&OGG, TroubleShooting 暂无评论 阅读 1,976 次

rac单节点权限恢复
背景:一个同事误对ORACLE_BASE的顶层目录进行了chown -R oracle:oinstall /u01 操作,导致rac节点1无法正常启动。
下边重现并在没有备份的情况下恢复。

主要技术:getfacl 和setfacl
该命令是用来备份文件访问权限和恢复文件权限的
这个是可以从节点2 做节点1 的 属组问题的

节点1当前状态

[root@11grac1 ~]# su - grid
[grid@11grac1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    11grac1     
ora....C1.lsnr application    ONLINE    ONLINE    11grac1     
ora....ac1.gsd application    OFFLINE   OFFLINE               
ora....ac1.ons application    ONLINE    ONLINE    11grac1     
ora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac1     
ora....SM2.asm application    ONLINE    ONLINE    11grac2     
ora....C2.lsnr application    ONLINE    ONLINE    11grac2     
ora....ac2.gsd application    OFFLINE   OFFLINE               
ora....ac2.ons application    ONLINE    ONLINE    11grac2     
ora....ac2.vip ora....t1.type ONLINE    ONLINE    11grac2     
ora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac1     
ora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac1     
ora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac1     
ora.asm        ora.asm.type   ONLINE    ONLINE    11grac1     
ora.cvu        ora.cvu.type   ONLINE    ONLINE    11grac2     
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    11grac1     
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac2     
ora.ons        ora.ons.type   ONLINE    ONLINE    11grac1     
ora.racdb.db   ora....se.type ONLINE    ONLINE    11grac1     
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac1   

数据库版本

SQL> set line 400
SQL> select * from gv$version;

   INST_ID BANNER
---------- --------------------------------------------------------------------------------
         1 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
         1 PL/SQL Release 11.2.0.3.0 - Production
         1 CORE 11.2.0.3.0      Production
         1 TNS for Linux: Version 11.2.0.3.0 - Production
         1 NLSRTL Version 11.2.0.3.0 - Production
         2 Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
         2 PL/SQL Release 11.2.0.3.0 - Production
         2 CORE 11.2.0.3.0      Production
         2 TNS for Linux: Version 11.2.0.3.0 - Production
         2 NLSRTL Version 11.2.0.3.0 - Production

10 rows selected.

OS信息

[oracle@11grac1 ~]$ uname -a
Linux 11grac1 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux

模拟在节点1修改oracle根目录属组

[root@11grac1 ~]# su - oracle
[oracle@11grac1 ~]$ env | grep ORACLE_BASE
ORACLE_BASE=/u01/app/oracle
[root@11grac1 ~]# ls -l /
total 110
dr-xr-xr-x.   2 root root      4096 May 10 08:33 bin
dr-xr-xr-x.   5 root root      1024 May  8 23:15 boot
drwxr-xr-x.   2 root root      4096 Jul 26  2011 cgroup
drwxr-xr-x   16 root root      3700 Jun 17 15:12 dev
drwxr-xr-x. 121 root root     12288 Jun 17 15:12 etc
drwxr-xr-x.   4 root root      4096 May  8 15:23 home
dr-xr-xr-x.  13 root root      4096 May 10 08:33 lib
dr-xr-xr-x.   9 root root     12288 May  9 14:02 lib64
drwx------.   2 root root     16384 May  8 23:04 lost+found
drwxr-xr-x.   2 root root      4096 Jun 28  2011 media
drwxr-xr-x    2 root root         0 Jun 17 15:12 misc
drwxr-xr-x.   2 root root      4096 Jun 28  2011 mnt
drwxr-xr-x    2 root root         0 Jun 17 15:12 net
drwxr-xr-x.   4 root root      4096 May  9 12:50 opt
dr-xr-xr-x  242 root root         0 Jun 17 15:11 proc
dr-xr-x---.  21 root root      4096 May 11 22:04 root
dr-xr-xr-x.   2 root root     12288 May  9 09:14 sbin
drwxr-xr-x.   2 root root      4096 May  8 23:07 selinux
drwxr-xr-x.   2 root root      4096 Jun 28  2011 srv
drwxr-xr-x   13 root root         0 Jun 17 15:11 sys
drwxrwxrwt.  15 root root      4096 Jun 17 15:12 tmp
drwxr-xr-x.   5 root oinstall  4096 May  9 13:19 u01
drwxr-xr-x.  13 root root      4096 May  8 23:08 usr
drwxr-xr-x.  22 root root      4096 May  8 23:14 var
[root@11grac1 ~]# chown oracle:oinstall -R /u01
[root@11grac1 ~]# ls -l /
total 110
dr-xr-xr-x.   2 root   root      4096 May 10 08:33 bin
dr-xr-xr-x.   5 root   root      1024 May  8 23:15 boot
drwxr-xr-x.   2 root   root      4096 Jul 26  2011 cgroup
drwxr-xr-x   16 root   root      3700 Jun 17 15:12 dev
drwxr-xr-x. 121 root   root     12288 Jun 17 15:12 etc
drwxr-xr-x.   4 root   root      4096 May  8 15:23 home
dr-xr-xr-x.  13 root   root      4096 May 10 08:33 lib
dr-xr-xr-x.   9 root   root     12288 May  9 14:02 lib64
drwx------.   2 root   root     16384 May  8 23:04 lost+found
drwxr-xr-x.   2 root   root      4096 Jun 28  2011 media
drwxr-xr-x    2 root   root         0 Jun 17 15:12 misc
drwxr-xr-x.   2 root   root      4096 Jun 28  2011 mnt
drwxr-xr-x    2 root   root         0 Jun 17 15:12 net
drwxr-xr-x.   4 root   root      4096 May  9 12:50 opt
dr-xr-xr-x  242 root   root         0 Jun 17 15:11 proc
dr-xr-x---.  21 root   root      4096 May 11 22:04 root
dr-xr-xr-x.   2 root   root     12288 May  9 09:14 sbin
drwxr-xr-x.   2 root   root      4096 May  8 23:07 selinux
drwxr-xr-x.   2 root   root      4096 Jun 28  2011 srv
drwxr-xr-x   13 root   root         0 Jun 17 15:11 sys
drwxrwxrwt.  15 root   root      4096 Jun 17 15:12 tmp
drwxr-xr-x.   5 oracle oinstall  4096 May  9 13:19 u01
drwxr-xr-x.  13 root   root      4096 May  8 23:08 usr
drwxr-xr-x.  22 root   root      4096 May  8 23:14 var

[root@11grac1 ~]# sync
[root@11grac1 ~]# reboot

Broadcast message from root@11grac1
        (/dev/pts/0) at 15:29 ...

The system is going down for reboot NOW!

[root@11grac1 bin]# ./crsctl start crs
CRS-4640: Oracle High Availability Services is already active
CRS-4000: Command Start failed, or completed with errors.
[root@11grac1 bin]# ./crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4535: Cannot communicate with Cluster Ready Services
CRS-4530: Communications failure contacting Cluster Synchronization Services daemon
CRS-4534: Cannot communicate with Event Manager

节点2正常

[root@11grac2 ~]# su - grid
[grid@11grac2 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac2     
ora....SM2.asm application    ONLINE    ONLINE    11grac2     
ora....C2.lsnr application    ONLINE    ONLINE    11grac2     
ora....ac2.gsd application    OFFLINE   OFFLINE               
ora....ac2.ons application    ONLINE    ONLINE    11grac2     
ora....ac2.vip ora....t1.type ONLINE    ONLINE    11grac2     
ora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac2     
ora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac2     
ora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac2     
ora.asm        ora.asm.type   ONLINE    ONLINE    11grac2     
ora.cvu        ora.cvu.type   ONLINE    ONLINE    11grac2     
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    11grac2     
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac2     
ora.ons        ora.ons.type   ONLINE    ONLINE    11grac2     
ora.racdb.db   ora....se.type ONLINE    ONLINE    11grac2     
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac2   

在节点2备份权限并传到节点1

[root@11grac2 ~]# cd /
[root@11grac2 /]# date;getfacl -R u01 > /tmp/ch.bak;date
Mon Jun 17 15:42:59 CST 2013
Mon Jun 17 15:44:39 CST 2013
[root@11grac2 /]# scp /tmp/ch.bak 192.168.137.165:/tmp/ch.bak 
The authenticity of host '192.168.137.165 (192.168.137.165)' can't be established.
RSA key fingerprint is 69:c3:cb:7f:5b:dd:59:a9:5c:94:4e:33:fa:5b:0c:70.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.137.165' (RSA) to the list of known hosts.
root@192.168.137.165's password: 
ch.bak                                                                                            100% 9531KB   4.7MB/s   00:02    

在节点1上替换ch.bak中和节点相关的文件名及目录名后进行恢复
注意:替换有节点名,实例名相关的字符串

[root@11grac1 bin]# date;setfacl --restore=/tmp/ch.bak;date

部分输出略

setfacl: /u01/app/oracle/diag/clients/user_oracle/host_870208700_80/incident: No such file or directory
setfacl: /u01/app/oracle/diag/clients/user_oracle/host_870208700_80/alert: No such file or directory
setfacl: /u01/app/oracle/diag/clients/user_oracle/host_870208700_80/alert/log.xml: No such file or directory
setfacl: /u01/app/oracle/diag/clients/user_oracle/host_870208700_80/incpkg: No such file or directory
setfacl: /u01/app/oracle/diag/clients/user_oracle/host_870208700_80/metadata_dgif: No such file or directory
setfacl: /u01/app/oraInventory/logs/AttachHome2013-05-09_09-56-32PM.log: No such file or directory
setfacl: /u01/app/oraInventory/logs/AttachHome2013-05-09_10-17-21PM.log: No such file or directory
setfacl: /u01/app/oraInventory/logs/AttachHome2013-05-09_08-58-40PM.log: No such file or directory
setfacl: /u01/app/oraInventory/logs/UpdateNodeList2013-05-09_09-28-20PM.log: No such file or directory
setfacl: /u01/app/oraInventory/logs/AttachHome2013-05-09_08-40-32PM.log: No such file or directory
Mon Jun 17 16:02:38 CST 2013

稍过几分钟即可

[root@11grac1 bin]# ./crsctl check crs
CRS-4638: Oracle High Availability Services is online
CRS-4537: Cluster Ready Services is online
CRS-4529: Cluster Synchronization Services is online
CRS-4533: Event Manager is online
[root@11grac1 bin]# su - grid
[grid@11grac1 ~]$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....SM1.asm application    ONLINE    ONLINE    11grac1     
ora....C1.lsnr application    ONLINE    ONLINE    11grac1     
ora....ac1.gsd application    OFFLINE   OFFLINE               
ora....ac1.ons application    ONLINE    ONLINE    11grac1     
ora....ac1.vip ora....t1.type ONLINE    ONLINE    11grac1     
ora....SM2.asm application    ONLINE    ONLINE    11grac2     
ora....C2.lsnr application    ONLINE    ONLINE    11grac2     
ora....ac2.gsd application    OFFLINE   OFFLINE               
ora....ac2.ons application    ONLINE    ONLINE    11grac2     
ora....ac2.vip ora....t1.type ONLINE    ONLINE    11grac2     
ora.DATA.dg    ora....up.type ONLINE    ONLINE    11grac1     
ora....ER.lsnr ora....er.type ONLINE    ONLINE    11grac1     
ora....N1.lsnr ora....er.type ONLINE    ONLINE    11grac2     
ora.asm        ora.asm.type   ONLINE    ONLINE    11grac1     
ora.cvu        ora.cvu.type   ONLINE    ONLINE    11grac2     
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    11grac1     
ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    11grac2     
ora.ons        ora.ons.type   ONLINE    ONLINE    11grac1     
ora.racdb.db   ora....se.type ONLINE    ONLINE    11grac1     
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    11grac2    

至此,全部OK!

给我留言

Copyright © YallonKing 保留所有权利.   Theme  Ality

用户登录

分享到: