oracle 11g rac修改资源随集群自动启动
oracle 11gR2 grid 集群有些资源不会集群自动启动,需要手工启动,比如用srvctl和crs_start 等等,出现这种问题的原因大概是在集群运行时,出现手工停止某些资源的情况。
查看resource 的启动属性
1:crsctl status resource resource_name -p
auto_start的值为restore
[grid@rac2:/home/grid]$crsctl status resource ora.db01.db -p
NAME=ora.db01.db
TYPE=ora.database.type
ACL=owner:oracle:rwx,pgrp:oinstall:rwx,other::r--
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=1
AGENT_FILENAME=%CRS_HOME%/bin/oraagent%CRS_EXE_SUFFIX%
AUTO_START=restore
CARDINALITY=2
CHECK_INTERVAL=1
CHECK_TIMEOUT=30
CLUSTER_DATABASE=true
DATABASE_TYPE=RAC
DB_UNIQUE_NAME=db01
DEFAULT_TEMPLATE=PROPERTY(RESOURCE_CLASS=database) PROPERTY(DB_UNIQUE_NAME= CONCAT(PARSE(%NAME%, ., 2), %USR_ORA_DOMAIN%, .)) ELEMENT(INSTANCE_NAME= %GEN_USR_ORA_INST_NAME%) ELEMENT(DATABASE_TYPE= %DATABASE_TYPE%)
DEGREE=1
DESCRIPTION=Oracle Database resource
ENABLED=1
FAILOVER_DELAY=0
FAILURE_INTERVAL=60
FAILURE_THRESHOLD=1
GEN_AUDIT_FILE_DEST=/oracle/app/oracle/admin/db01/adump
GEN_START_OPTIONS=
GEN_START_OPTIONS@SERVERNAME(rac1)=open
GEN_START_OPTIONS@SERVERNAME(rac2)=open
GEN_USR_ORA_INST_NAME=
GEN_USR_ORA_INST_NAME@SERVERNAME(rac1)=db011
GEN_USR_ORA_INST_NAME@SERVERNAME(rac2)=db012
HOSTING_MEMBERS=
INSTANCE_FAILOVER=0
LOAD=1
LOGGING_LEVEL=1
MANAGEMENT_POLICY=AUTOMATIC
NLS_LANG=
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ONLINE_RELOCATION_TIMEOUT=0
ORACLE_HOME=/oracle/app/oracle/product/11.2.0
ORACLE_HOME_OLD=
PLACEMENT=restricted
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=2
ROLE=PRIMARY
SCRIPT_TIMEOUT=60
SERVER_POOLS=ora.db01
SPFILE=+DGDATA/db01/spfiledb01.ora
START_DEPENDENCIES=hard(ora.DGDATA.dg,ora.DGRECOVER.dg) weak(type:ora.listener.type,global:type:ora.scan_listener.type,uniform:ora.ons,global:ora.gns) pullup(ora.DGDATA.dg,ora.DGRECOVER.dg)
START_TIMEOUT=600
STATE_CHANGE_TEMPLATE=
STOP_DEPENDENCIES=hard(intermediate:ora.asm,shutdown:ora.DGDATA.dg,shutdown:ora.DGRECOVER.dg)
STOP_TIMEOUT=600
TYPE_VERSION=3.2
UPTIME_THRESHOLD=1h
USR_ORA_DB_NAME=db01
USR_ORA_DOMAIN=
USR_ORA_ENV=
USR_ORA_FLAGS=
USR_ORA_INST_NAME=
USR_ORA_INST_NAME@SERVERNAME(rac1)=db011
USR_ORA_INST_NAME@SERVERNAME(rac2)=db012
USR_ORA_OPEN_MODE=open
USR_ORA_OPI=false
USR_ORA_STOP_MODE=immediate
VERSION=11.2.0.3.0
修改成跟随集群软件自动启动
1: crsctl modify res ora.db01.db -attr auto_start=always
[grid@rac2:/home/grid]$crsctl modify res ora.db01.db -attr auto_start=always
CRS-0160: The attribute 'auto_start' is not supported in this resource type.
CRS-4000: Command Modify failed, or completed with errors.
报错[color=#000080],如果是11g,修改方法不同,
应该如下:crs_register ora.db01.db -update -o as=always
Oracle 10gR2 RAC参考以下的内容修改资源AUTO_START属性。
使用命令 crs_register resource_name -update [option ...] [-o option,...] -q
如:修改资源ora.dbrac.dbrac2.inst 中 AUTO_START值 0,表示:启动到资源重启之前的状态
1,表示: 启动资源
2,表示:不启动资源
修改属性名称采用第一个字母表示,如 AUTO_START = as
#crs_register resource_name -update -o as=2
./crs_register ora.rkywk.db -update -o as=1
./crs_register ora.rkcxk.db -update -o as=1
crs_register ora.db01.db -update -o as=always (11g)
--end--
2: 检查是否修改成功
crsctl status resource resource_name -p
auto_start的值为always
以下是auto_start的解释。
AUTO_START
Indicates whether Oracle Clusterware automatically starts a resource after a cluster server restart. Valid AUTO_START values are:
always: [color=#008080]Restarts the resource when the server restarts regardless of the state of the resource when the server stopped.
restore:[color=#008000] [color=#008000]Restores the resource to the same state that it was in when the server stopped. Oracle Clusterware attempts to restart the resource if the value of TARGET was ONLINE before the server stopped.
never: [color=#008000]Oracle Clusterware never restarts the resource regardless of the state of the resource when the server stopped.