CRS and 10g/11.1 Real Application Clusters
Applies to:
Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.1.0.7 - Release: 10.1 to 11.1
Information in this document applies to any platform.
目的
本文档提供10g上关于CRS的附加信息和11.1 Real Application Clusters.对于version11.2的信息和以上,看注释1053147.1 11gR2 Clusterware 和Grid Home——你需要知道的
范围和应用
本文档倾向于RAC数据库管理员和Oracle支持工程师
CRS and 10g/11.1 Real Application Clusters
-------------------------------------
CRS是一个10g Real Application Clusters的新特性,可以在所有平台上提供一个标准的集群接口并且能有好的可用性操作在先前的版本上没有的。
CRS KEY FACTS
-------------
在安装CRS和10gRAC之前,有几个关键点要记住
CRS and 10g RAC:
- CRS 需要被安装并且是在安装10gRAC之前运行。
- CRS 能运行在很多集群产品之上(such as Sun Cluster,HP Serviceguard, IBM HACMP, TruCluster, Veritas Cluster, Fujitsu Primecluster,etc...) or can run without the vendor clusterware. 集群产品在9i上需要,在10g上可选。.
The CRS HOME and ORACLE_HOME 必须安装在不同的路径下。.
- Shared Location(s) or devices for the Voting File and OCR (Oracle
Configuration Repository) file 在安装CRS之前必须可用. The voting file should be at least 20MB and the OCR file should be at least 100MB.
- CRS and RAC 需要在安装CRS和RAC之前配置好以下网络接口
- Public Interface
- Private Interface
- Virtual (Public) Interface
For more information on this, see Note 264847.1
- 在CRS安装结束的时候root的shell脚本启动CRS堆.
If your CRS stack does not start, see Note 240001.1
- 只有一个守护进程集能运行在每一个RAC节点上
- 在Unix中,CRS是从进入/etc/inittab with "respawn"这个文件来运行。.
- 如果有一个网络分离(nodes lose communication with each other). 一个或者多个节点可能自动重启来阻止数据的丢失。
- 支持的方法是启动CRS来启动机器,或者使用命令"crsctl start crs" or "init.crs start".
- 除非移除CRS,不然不支持杀死CRS守护进程。
通过Note 239998.1安装, 因为标志文件可能不匹配。
- For maintenance, go to single user mode at the OS or shut down CRS.
一旦堆启动起来,你应该能查看到所有的守护进程
用a ps -ef command:
[rac1]/u01/home/beta> ps -ef | grep crs
oracle 1363 999 0 11:23:21 ? 0:00 /u01/crs_home/bin/evmlogger.bin -o /u01
oracle 999 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/evmd.bin
root 1003 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/crsd.bin
oracle 1002 1 0 11:21:39 ? 0:01 /u01/crs_home/bin/ocssd.bin
CRS DAEMON FUNCTIONALITY
------------------------
每一个CRS守护进程都有一小段描述
CRSD:
- Engine for HA operation
- Manages 'application resources'
- Starts, stops, and fails 'application resources' over
- Spawns separate 'actions' to start/stop/check application resources
- Maintains configuration profiles in the OCR (Oracle Configuration Repository)
- Stores current known state in the OCR.
- Runs as root
- Is restarted automatically on failure
OCSSD:
- OCSSD is part of RAC and Single Instance with ASM
- Provides access to node membership
- Provides group services
- Provides basic cluster locking
- Integrates with existing vendor clusteware, when present
- Can also runs without integration to vendor clustware
- Runs as Oracle.
- Failure exit causes machine reboot.
--- This is a feature to prevent data corruption in event of a split brain.
EVMD:
- Generates events when things happen
- Spawns a permanent child evmlogger
- Evmlogger, on demand, spawns children
- Scans callout directory and invokes callouts.
- Runs as Oracle.
- Restarted automatically on failure
CRS LOG DIRECTORIES
-------------------
When troubleshooting CRS problems, it is important to review the directories
under the CRS Home.
In 10gR2 and 11.1, almost all logfiles are under /log/. The following
is the directory structure under /log/
./admin:
./client:
./crsd:
./cssd:
./cssd/oclsmon:
./cssd/oclsomon:
./evmd:
./racg:
./racg/racgeut:
./racg/racgevtf:
./racg/racgmain:
./srvm:
In 10.1:
/crs/log - This directory includes traces for CRS resources that are
joining, leaving, restarting, and relocating as identified by CRS.
/crs/init - Any core dumps for the crsd.bin daemon should be written
here. Note 1812.1 could be used to debug these.
/css/log - The css logs indicate all actions such as
reconfigurations, missed checkins , connects, and disconnects from the client
CSS listener . In some cases the logger logs messages with the category of
(auth.crit) for the reboots done by oracle. This could be used for checking the
exact time when the reboot occured.
/css/init - Core dumps from the ocssd primarily and the pid for the
css daemon whose death is treated as fatal are located here. If there are
abnormal restarts for css then the core files will have the formats of
core.. Note 1812.1 could be used to debug these.
/evm/log - Log files for the evm and evmlogger daemons. Not used
as often for debugging as the CRS and CSS directories.
/evm/init - Pid and lock files for EVM. Core files for EVM should
also be written here. Note 1812.1 could be used to debug these.
/srvm/log - Log files for OCR.
STATUS FOR CRS RESOURCES
------------------------
After installing RAC and running the VIPCA (Virtual IP Configuration Assistant)
launched with the RAC root.sh, you should be able to see all of your CRS
resources with crs_stat. Example:
cd $ORA_CRS_HOME/bin
./crs_stat
NAME=ora.rac1.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac1.oem
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac1.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac1.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac2.gsd
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac2.oem
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac2.ons
TYPE=application
TARGET=ONLINE
STATE=ONLINE
NAME=ora.rac2.vip
TYPE=application
TARGET=ONLINE
STATE=ONLINE
也有一个更容易阅读的格式的可用脚本来查看CRS资源。Just create a shell script with:
--------------------------- Begin Shell Script -------------------------------
#!/usr/bin/ksh
#
# Sample 10g CRS resource status query script
#
# Description:
# - Returns formatted version of crs_stat -t, in tabular
# format, with the complete rsc names and filtering keywords
# - The argument, $RSC_KEY, is optional and if passed to the script, will
# limit the output to HA resources whose names match $RSC_KEY.
# Requirements:
# - $ORA_CRS_HOME should be set in your environment
RSC_KEY=$1
QSTAT=-u
AWK=/usr/xpg4/bin/awk # if not available use /usr/bin/awk
# Table header:echo ""
$AWK \
'BEGIN {printf "%-45s %-10s %-18s\n", "HA Resource", "Target", "State";
printf "%-45s %-10s %-18s\n", "-----------", "------", "-----";}'
# Table body:
$ORA_CRS_HOME/bin/crs_stat $QSTAT | $AWK \
'BEGIN { FS="="; state = 0; }
$1~/NAME/ && $2~/'$RSC_KEY'/ {appname = $2; state=1};
state == 0 {next;}
$1~/TARGET/ && state == 1 {apptarget = $2; state=2;}
$1~/STATE/ && state == 2 {appstate = $2; state=3;}
state == 3 {printf "%-45s %-10s %-18s\n", appname, apptarget, appstate; state=0;}'
--------------------------- End Shell Script -------------------------------
Example output:
[opcbsol1]/u01/home/usupport> ./crsstat
HA Resource Target State
----------- ------ -----
ora.V10SN.V10SN1.inst ONLINE ONLINE on opcbsol1
ora.V10SN.V10SN2.inst ONLINE ONLINE on opcbsol2
ora.V10SN.db ONLINE ONLINE on opcbsol2
ora.opcbsol1.ASM1.asm ONLINE ONLINE on opcbsol1
ora.opcbsol1.LISTENER_OPCBSOL1.lsnr ONLINE ONLINE on opcbsol1
ora.opcbsol1.gsd ONLINE ONLINE on opcbsol1
ora.opcbsol1.ons ONLINE ONLINE on opcbsol1
ora.opcbsol1.vip ONLINE ONLINE on opcbsol1
ora.opcbsol2.ASM2.asm ONLINE ONLINE on opcbsol2
ora.opcbsol2.LISTENER_OPCBSOL2.lsnr ONLINE ONLINE on opcbsol2
ora.opcbsol2.gsd ONLINE ONLINE on opcbsol2
ora.opcbsol2.ons ONLINE ONLINE on opcbsol2
ora.opcbsol2.vip ONLINE ONLINE on opcbsol2
CRS RESOURCE ADMINISTRATION
---------------------------
你可以用srvctl来管理这些资源, Below are syntax and examples.
-------------------------------------------------------------------------------
CRS RESOURCE STATUS
srvctl status database -d [-f] [-v] [-S ]
srvctl status instance -d -i >[,]
[-f] [-v] [-S ]
srvctl status service -d -s [,]
[-f] [-v] [-S ]
srvctl status nodeapps [-n ]
srvctl status asm -n
EXAMPLES:
Status of the database, all instances and all services.
srvctl status database -d ORACLE -v
Status of named instances with their current services.
srvctl status instance -d ORACLE -i RAC01, RAC02 -v
Status of a named services.
srvctl status service -d ORACLE -s ERP -v
Status of all nodes supporting database applications.
srvctl status node
-------------------------------------------------------------------------------
START CRS RESOURCES
srvctl start database -d [-o ]
[-c | -q]
srvctl start instance -d -i
[,] [-o ] [-c | -q]
srvctl start service -d [-s [,]]
[-i ] [-o ] [-c | -q]
srvctl start nodeapps -n
srvctl start asm -n [-i ] [-o ]
EXAMPLES:
Start the database with all enabled instances.
srvctl start database -d ORACLE
Start named instances.
srvctl start instance -d ORACLE -i RAC03, RAC04
Start named services. Dependent instances are started as needed.
srvctl start service -d ORACLE -s CRM
Start a service at the named instance.
srvctl start service -d ORACLE -s CRM -i RAC04
Start node applications.
srvctl start nodeapps -n myclust-4
-------------------------------------------------------------------------------
STOP CRS RESOURCES
srvctl stop database -d [-o ]
[-c | -q]
srvctl stop instance -d -i [,]
[-o ][-c | -q]
srvctl stop service -d [-s [,]]
[-i ][-c | -q] [-f]
srvctl stop nodeapps -n
srvctl stop asm -n [-i ] [-o ]
EXAMPLES:
Stop the database, all instances and all services.
srvctl stop database -d ORACLE
Stop named instances, first relocating all existing services.
srvctl stop instance -d ORACLE -i RAC03,RAC04
Stop the service.
srvctl stop service -d ORACLE -s CRM
Stop the service at the named instances.
srvctl stop service -d ORACLE -s CRM -i RAC04
Stop node applications. Note that instances and services also stop.
srvctl stop nodeapps -n myclust-4
-------------------------------------------------------------------------------
ADD CRS RESOURCES
srvctl add database -d -o [-m ] [-p ]
[-A /netmask] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}]
[-s ] [-n ]
srvctl add instance -d -i -n
srvctl add service -d -s -r
[-a ] [-P ] [-u]
srvctl add nodeapps -n -o
[-A /netmask[/if1[|if2|...]]]
srvctl add asm -n -i -o
OPTIONS:
-A vip range, node, and database, address specification. The format of
address string is:
[]//[/] [,] []//
[/]
-a for services, list of available instances, this list cannot include
preferred instances
-m domain name with the format “us.mydomain.com”
-n node name that will support one or more instances
-o $ORACLE_HOME to locate Oracle binaries
-P for services, TAF preconnect policy - NONE, PRECONNECT
-r for services, list of preferred instances, this list cannot include
available instances.
-s spfile name
-u updates the preferred or available list for the service to support the
specified instance. Only one instance may be specified with the -u
switch. Instances that already support the service should not be
included.
EXAMPLES:
Add a new node:
srvctl add nodeapps -n myclust-1 -o $ORACLE_HOME –A
139.184.201.1/255.255.255.0/hme0
Add a new database.
srvctl add database -d ORACLE -o $ORACLE_HOME
Add named instances to an existing database.
srvctl add instance -d ORACLE -i RAC01 -n myclust-1
srvctl add instance -d ORACLE -i RAC02 -n myclust-2
srvctl add instance -d ORACLE -i RAC03 -n myclust-3
Add a service to an existing database with preferred instances (-r) and
available instances (-a). Use basic failover to the available instances.
srvctl add service -d ORACLE -s STD_BATCH -r RAC01,RAC02 -a RAC03,RAC04
Add a service to an existing database with preferred instances in list one and
available instances in list two. Use preconnect at the available instances.
srvctl add service -d ORACLE -s STD_BATCH -r RAC01,RAC02 -a RAC03,RAC04 -P PRECONNECT
-------------------------------------------------------------------------------
REMOVE CRS RESOURCES
srvctl remove database -d
srvctl remove instance -d [-i ]
srvctl remove service -d -s [-i ]
srvctl remove nodeapps -n
EXAMPLES:
Remove the applications for a database.
srvctl remove database -d ORACLE
Remove the applications for named instances of an existing database.
srvctl remove instance -d ORACLE -i RAC03
srvctl remove instance -d ORACLE -i RAC04
Remove the service.
srvctl remove service -d ORACLE -s STD_BATCH
Remove the service from the instances.
srvctl remove service -d ORACLE -s STD_BATCH -i RAC03,RAC04
Remove all node applications from a node.
srvctl remove nodeapps -n myclust-4
-------------------------------------------------------------------------------
MODIFY CRS RESOURCES
srvctl modify database -d [-n ] [-m ]
[-p ] [-r {PRIMARY | PHYSICAL_STANDBY | LOGICAL_STANDBY}]
[-s ]
srvctl modify instance -d -i -n
srvctl modify instance -d -i {-s | -r}
srvctl modify service -d -s -i
-t [-f]
srvctl modify service -d -s -i
-r [-f]
srvctl modify nodeapps -n [-A ] [-x]
OPTIONS:
-i -t the instance name (-i) is replaced by the
instance name (-t)
-i -r the named instance is modified to be a preferred instance
-A address-list for VIP application, at node level
-s add or remove ASM dependency
EXAMPLES:
Modify an instance to execute on another node.
srvctl modify instance -d ORACLE -n myclust-4
Modify a service to execute on another node.
srvctl modify service -d ORACLE -s HOT_BATCH -i RAC01 -t RAC02
Modify an instance to be a preferred instance for a service.
srvctl modify service -d ORACLE -s HOT_BATCH -i RAC02 –r
-------------------------------------------------------------------------------
RELOCATE SERVICES
srvctl relocate service -d -s [-i ]-t [-f]
EXAMPLES:
Relocate a service from one instance to another
srvctl relocate service -d ORACLE -s CRM -i RAC04 -t RAC01
-------------------------------------------------------------------------------
ENABLE CRS RESOURCES (The resource may be up or down to use this function)
srvctl enable database -d
srvctl enable instance -d -i [,]
srvctl enable service -d -s ] [, ] [-i ]
EXAMPLES:
Enable the database.
srvctl enable database -d ORACLE
Enable the named instances.
srvctl enable instance -d ORACLE -i RAC01, RAC02
Enable the service.
srvctl enable service -d ORACLE -s ERP,CRM
Enable the service at the named instance.
srvctl enable service -d ORACLE -s CRM -i RAC03
-------------------------------------------------------------------------------
DISABLE CRS RESOURCES (The resource must be down to use this function)
srvctl disable database -d
srvctl disable instance -d -i [,]
srvctl disable service -d -s ] [,] [-i ]
EXAMPLES:
Disable the database globally.
srvctl disable database -d ORACLE
Disable the named instances.
srvctl disable instance -d ORACLE -i RAC01, RAC02
Disable the service globally.
srvctl disable service -d ORACLE -s ERP,CRM
Disable the service at the named instance.
srvctl disable service -d ORACLE -s CRM -i RAC03,RAC04
-------------------------------------------------------------------------------
如需获取更多信息请看 the Oracle10g Real Application Clusters
Administrator’s Guide - Appendix B