有网友反映在11.2的RAC中有一个名如*_preconnect.svc的资源一直处于OFFLINE状态,而其TARGET则为ONLINE状态,无法通过重启CRS或者手动start该资源来使之ONLINE。我们来具体看一下什么情况下回产生这种资源?:
[oracle@rh2 ~]$ srvctl add service -h Adds a service configuration to the Oracle Clusterware. Usage: srvctl add service -d -s {-r "" [-a ""] [-P {BASIC | NONE | PRECONNECT}] | -g [-c {UNIFORM | SINGLETON}] } [-k ] [-l [PRIMARY][,PHYSICAL_STANDBY] [,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]] [-y {AUTOMATIC | MANUAL}] [-q {TRUE|FALSE}] [-x {TRUE|FALSE}] [-j {SHORT|LONG}] [-B {NONE|SERVICE_TIME|THROUGHPUT}] [-e {NONE|SESSION|SELECT}] [-m {NONE|BASIC}] [-z ] [-w ] [-t ] [-f] -d Unique name for the database -s Service name -r "" Comma separated list of preferred instances -a "" Comma separated list of available instances -g Server pool name -c {UNIFORM | SINGLETON} Service runs on every active server in the server pool hosting this service (UNIFORM) or just one server (SINGLETON) -k network number (default number is 1) -P {NONE | BASIC | PRECONNECT} TAF policy specification -l Role of the service (primary, physical_standby, logical_standby, snapshot_standby) -y Management policy for the service (AUTOMATIC or MANUAL) -e Failover type (NONE, SESSION, or SELECT) -m Failover method (NONE or BASIC) -w Failover delay -z Failover retries -t Edition (or "" for empty edition value) -j Connection Load Balancing Goal (SHORT or LONG). Default is LONG. -B Runtime Load Balancing Goal (SERVICE_TIME, THROUGHPUT, or NONE) -x Distributed Transaction Processing (TRUE or FALSE) -q AQ HA notifications (TRUE or FALSE) Usage: srvctl add service -d -s -u {-r "" | -a ""} [-f] -d Unique name for the database -s Service name -u Add a new instance to service configuration -r Name of new preferred instance -a Name of new available instance -f Force the add operation even though a listener is not configured for a network -h Print usage [oracle@rh2 ~]$ srvctl add service -d PROD -s maclean -r "PROD1,PROD2" -P BASIC [oracle@rh2 ~]$ crs_stat|grep maclean NAME=ora.prod.maclean.svc NAME=ora.prod.maclean_taf.svc [oracle@rh2 ~]$ srvctl add service -d PROD -s maclean_pre -r "PROD1,PROD2" -P PRECONNECT [oracle@rh2 ~]$ crs_stat|grep maclean_pre NAME=ora.prod.maclean_pre.svc NAME=ora.prod.maclean_pre_preconnect.svc /* 可以看到仅当创建的service使用preconnect的TAF policy时会附带创建{service_name}_preconnect.svc的服务 */ [oracle@rh2 ~]$ srvctl start service -d PROD -s maclean [oracle@rh2 ~]$ srvctl start service -d PROD -s maclean_pre [oracle@rh2 ~]$ crs_stat |grep -A3 maclean NAME=ora.prod.maclean.svc TYPE=ora.service.type TARGET=ONLINE STATE=ONLINE on rh2 -- NAME=ora.prod.maclean_pre.svc TYPE=ora.service.type TARGET=ONLINE STATE=ONLINE on rh2 -- NAME=ora.prod.maclean_pre_preconnect.svc TYPE=ora.service.type TARGET=ONLINE STATE=OFFLINE -- NAME=ora.prod.maclean_taf.svc TYPE=ora.service.type TARGET=OFFLINE STATE=OFFLINE [oracle@rh2 ~]$ srvctl start service -d prod -s maclean_pre_preconnect PRCD-1084 : Failed to start service maclean_pre_preconnect PRCR-1079 : Failed to start resource ora.prod.maclean_pre_preconnect.svc CRS-2674: Start of 'ora.prod.maclean_pre_preconnect.svc' on 'rh2' failed CRS-2674: Start of 'ora.prod.maclean_pre_preconnect.svc' on 'rh3' failed CRS-2632: There are no more servers to try to place resource 'ora.prod.maclean_pre_preconnect.svc' on that would satisfy its placement policy /* 无法手动启动该preconnect.svc服务 */ [oracle@rh2 ~]$ crs_stat |grep preconnect NAME=ora.prod.maclean_pre_preconnect.svc [oracle@rh2 ~]$ srvctl remove service -d PROD -s maclean_pre_preconnect PRCD-1107 : Removed service maclean_pre_preconnect but failed to remove its underlying server pool PROD_maclean_pre PRCS-1012 : Failed to remove server pool PROD_maclean_pre PRCR-1072 : Failed to unregister server pool ora.PROD_maclean_pre CRS-2554: Server pool 'ora.PROD_maclean_pre' cannot be unregistered as it is referenced by resource 'ora.prod.maclean_pre.svc' [oracle@rh2 ~]$ crs_stat |grep preconnec /* 以上remove命令报错但该preconnect.svc服务还是被删除了,虽然我们并不推荐这样做 */ [oracle@rh2 admin]$ srvctl start service -d PROD -s maclean_pre [oracle@rh2 admin]$ lsnrctl service LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 30-MAR-2011 18:55:43 Copyright (c) 1991, 2010, Oracle. All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "PROD" has 1 instance(s). Instance "PROD1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "PRODXDB" has 1 instance(s). Instance "PROD1", status READY, has 1 handler(s) for this service... Handler(s): "D000" established:0 refused:0 current:0 max:1022 state:ready DISPATCHER (ADDRESS=(PROTOCOL=tcp)(HOST=rh2)(PORT=36196)) Service "maclean" has 1 instance(s). Instance "PROD1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER Service "maclean_pre" has 1 instance(s). Instance "PROD1", status READY, has 1 handler(s) for this service... Handler(s): "DEDICATED" established:0 refused:0 state:ready LOCAL SERVER The command completed successfully [oracle@rh2 admin]$ tnsping PROD_TAF TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 30-MAR-2011 18:54:38 Copyright (c) 1997, 2010, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = rh-cluster-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = maclean_pre))) OK (10 msec) [oracle@rh2 admin]$ sqlplus maclean/maclean@PROD_TAF SQL> select instance_name,host_name from v$instance; INSTANCE_NAME ---------------- HOST_NAME ---------------------------------------------------------------- PROD2 rh3.oracle.com shutdown PROD2 instance:SQL> shutdown abort SQL> select instance_name,host_name from v$instance; INSTANCE_NAME ---------------- HOST_NAME ---------------------------------------------------------------- PROD1 rh2.oracle.com /* 可以看到即使删除preconnect.svc服务也不会影响到TAF的正常使用, 在生产环境中无需刻意去调试该服务,最好的应对方式是放任不管 */
所以如果某天你看到你的crs_stat -t输出里有一条莫名的类似"ora....ect.svc ora....ce.type ONLINE OFFLINE"的记录,那么大可以忽略该资源的OFFLINE状态;这是正常现象,用不着紧张!
本文转自maclean_007 51CTO博客,原文链接:http://blog.51cto.com/maclean/1277080