分类: Oracle
2009-02-18 17:02:10
在Oracle环境中,当RAC不同节点间的时间差超过30秒时,会导致oracle数据库反复重启或者状态异常,如下:
1.通过CRS_STAT查看RAC服务状态
[oracle@silinux2 ~]$ crs_stat -t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application ONLINE UNKNOWN silinux2
ora....l1.inst application ONLINE ONLINE silinux1
ora....l2.inst application ONLINE ONLINE silinux2
ora....SM1.asm application ONLINE ONLINE silinux1
ora....X1.lsnr application ONLINE OFFLINE
ora....ux1.gsd application ONLINE UNKNOWN silinux1
ora....ux1.ons application ONLINE UNKNOWN silinux1
ora....ux1.vip application ONLINE ONLINE silinux1
ora....SM2.asm application ONLINE ONLINE silinux2
ora....X2.lsnr application ONLINE ONLINE silinux2
ora....ux2.gsd application ONLINE UNKNOWN silinux2
ora....ux2.ons application ONLINE UNKNOWN silinux2
ora....ux2.vip application ONLINE ONLINE silinux2
说明:通过crs_stat命令查看,其中多个服务状态显示为UNKNOWN,可通过配置NTP或者直接用date -s XX:XX:XX来修改两节点时间,以保持一致(其中XX:XX:XX为小时:分钟:秒)。
2.通过CRS_STOP命令来停止RAC相应服务
[oracle@silinux2 ~]$ crs_stop –all
Attempting to stop `ora.orcl.db` on member `silinux1`
Stop of `ora.orcl.db` on member `silinux1` succeeded.
Attempting to stop `ora.silinux2.LISTENER_SILINUX2.lsnr` on member `silinux2`
Attempting to stop `ora.silinux1.LISTENER_SILINUX1.lsnr` on member `silinux1`
Stop of `ora.silinux1.LISTENER_SILINUX1.lsnr` on member `silinux1` succeeded.
`ora.orcl.orcl1.inst` is already OFFLINE.
Attempting to stop `ora.silinux1.ASM1.asm` on member `silinux1`
Stop of `ora.silinux2.LISTENER_SILINUX2.lsnr` on member `silinux2` succeeded.
`ora.orcl.orcl2.inst` is already OFFLINE.
Attempting to stop `ora.silinux2.ASM2.asm` on member `silinux2`
Stop of `ora.silinux1.ASM1.asm` on member `silinux1` succeeded.
Attempting to stop `ora.silinux1.vip` on member `silinux1`
Stop of `ora.silinux1.vip` on member `silinux1` succeeded.
Stop of `ora.silinux2.ASM2.asm` on member `silinux2` succeeded.
Attempting to stop `ora.silinux2.vip` on member `silinux2`
Stop of `ora.silinux2.vip` on member `silinux2` succeeded.
CRS-0216: Could not stop resource 'ora.orcl.orcl1.inst'.
CRS-0216: Could not stop resource 'ora.orcl.orcl2.inst'.
然后,用CRS_STAT查看结果,可见服务状态显示为UNKNOWN的服务无法正常关闭。
[oracle@silinux2 ~]$ crs_stat –t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....X1.lsnr application OFFLINE OFFLINE
ora....ux1.gsd application ONLINE UNKNOWN silinux1
ora....ux1.ons application ONLINE UNKNOWN silinux1
ora....ux1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....X2.lsnr application OFFLINE OFFLINE
ora....ux2.gsd application ONLINE UNKNOWN silinux2
ora....ux2.ons application ONLINE UNKNOWN silinux2
ora....ux2.vip application OFFLINE OFFLINE
3.通过CRS_STAT命令查看状态异常的服务所对应的服务全称
[oracle@silinux2 ~]$ crs_stat
NAME=ora.orcl.db
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.orcl.orcl1.inst
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.orcl.orcl2.inst
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux1.ASM1.asm
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux1.LISTENER_SILINUX1.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux1.gsd
TYPE=application
TARGET=ONLINE
STATE=UNKNOWN on silinux1
NAME=ora.silinux1.ons
TYPE=application
TARGET=ONLINE
STATE=UNKNOWN on silinux1
NAME=ora.silinux1.vip
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux2.ASM2.asm
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux2.LISTENER_SILINUX2.lsnr
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
NAME=ora.silinux2.gsd
TYPE=application
TARGET=ONLINE
STATE=UNKNOWN on silinux2
NAME=ora.silinux2.ons
TYPE=application
TARGET=ONLINE
STATE=UNKNOWN on silinux2
NAME=ora.silinux2.vip
TYPE=application
TARGET=OFFLINE
STATE=OFFLINE
4.通过手动的方式逐一停止UNKNOWN状态的服务,最后通过CRS_STAT确认结果
[oracle@silinux2 ~]$ crs_stop ora.silinux1.ons
Attempting to stop `ora.silinux1.ons` on member `silinux1`
Stop of `ora.silinux1.ons` on member `silinux1` succeeded.
[oracle@silinux2 ~]$ crs_stop ora.silinux2.ons
Attempting to stop `ora.silinux2.ons` on member `silinux2`
Stop of `ora.silinux2.ons` on member `silinux2` succeeded.
[oracle@silinux2 ~]$ crs_stop ora.silinux1.gsd
Attempting to stop `ora.silinux1.gsd` on member `silinux1`
Stop of `ora.silinux1.gsd` on member `silinux1` succeeded.
[oracle@silinux2 ~]$ crs_stop ora.silinux2.gsd
Attempting to stop `ora.silinux2.gsd` on member `silinux2`
Stop of `ora.silinux2.gsd` on member `silinux2` succeeded.
[oracle@silinux2 ~]$ crs_stat –t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application OFFLINE OFFLINE
ora....l1.inst application OFFLINE OFFLINE
ora....l2.inst application OFFLINE OFFLINE
ora....SM1.asm application OFFLINE OFFLINE
ora....X1.lsnr application OFFLINE OFFLINE
ora....ux1.gsd application OFFLINE OFFLINE
ora....ux1.ons application OFFLINE OFFLINE
ora....ux1.vip application OFFLINE OFFLINE
ora....SM2.asm application OFFLINE OFFLINE
ora....X2.lsnr application OFFLINE OFFLINE
ora....ux2.gsd application OFFLINE OFFLINE
ora....ux2.ons application OFFLINE OFFLINE
ora....ux2.vip application OFFLINE OFFLINE
5.使用CRS_START命令来重启服务,因时间已经修改,可通过此步骤来确保RAC正常启动
[oracle@silinux2 ~]$ crs_start –all
Attempting to start `ora.silinux2.vip` on member `silinux2`
Attempting to start `ora.silinux1.vip` on member `silinux1`
Start of `ora.silinux2.vip` on member `silinux2` succeeded.
Attempting to start `ora.silinux2.ASM2.asm` on member `silinux2`
Start of `ora.silinux1.vip` on member `silinux1` succeeded.
Attempting to start `ora.silinux1.ASM1.asm` on member `silinux1`
Start of `ora.silinux2.ASM2.asm` on member `silinux2` succeeded.
Attempting to start `ora.orcl.orcl2.inst` on member `silinux2`
Start of `ora.silinux1.ASM1.asm` on member `silinux1` succeeded.
Attempting to start `ora.orcl.orcl1.inst` on member `silinux1`
Start of `ora.orcl.orcl2.inst` on member `silinux2` succeeded.
Attempting to start `ora.silinux2.LISTENER_SILINUX2.lsnr` on member `silinux2`
Start of `ora.silinux2.LISTENER_SILINUX2.lsnr` on member `silinux2` succeeded.
Start of `ora.orcl.orcl1.inst` on member `silinux1` succeeded.
Attempting to start `ora.silinux1.LISTENER_SILINUX1.lsnr` on member `silinux1`
Start of `ora.silinux1.LISTENER_SILINUX1.lsnr` on member `silinux1` succeeded.
CRS-1002: Resource 'ora.silinux1.ons' is already running on member 'silinux1'
CRS-1002: Resource 'ora.silinux2.ons' is already running on member 'silinux2'
Attempting to start `ora.silinux2.gsd` on member `silinux2`
Attempting to start `ora.orcl.db` on member `silinux1`
Attempting to start `ora.silinux1.gsd` on member `silinux1`
Start of `ora.orcl.db` on member `silinux1` succeeded.
Start of `ora.silinux1.gsd` on member `silinux1` succeeded.
Start of `ora.silinux2.gsd` on member `silinux2` succeeded.
CRS-0223: Resource 'ora.silinux1.ons' has placement error.
CRS-0223: Resource 'ora.silinux2.ons' has placement error.
[oracle@silinux2 ~]$ crs_stat –t
Name Type Target State Host
------------------------------------------------------------
ora.orcl.db application ONLINE ONLINE silinux1
ora....l1.inst application ONLINE ONLINE silinux1
ora....l2.inst application ONLINE ONLINE silinux2
ora....SM1.asm application ONLINE ONLINE silinux1
ora....X1.lsnr application ONLINE ONLINE silinux1
ora....ux1.gsd application ONLINE ONLINE silinux1
ora....ux1.ons application ONLINE ONLINE silinux1
ora....ux1.vip application ONLINE ONLINE silinux1
ora....SM2.asm application ONLINE ONLINE silinux2
ora....X2.lsnr application ONLINE ONLINE silinux2
ora....ux2.gsd application ONLINE ONLINE silinux2
ora....ux2.ons application ONLINE ONLINE silinux2
ora....ux2.vip application ONLINE ONLINE silinux2