OracleRAC集群维护工具
一.配置RAC集群要用到的工具
olsnodes 节点查看工具
oifcfg 网络接口配置工具
crsctl (CRS)集群环境控制工具
crs_stat (CRS)查看所有集群资源的运行状态
ocrcheck (OCR)集群注册文件状态,用于检查OCR内容一致性
ocrdump (OCR)输出集群注册文件的ASCII内容
ocrconfig (OCR)集群注册文件配置工具
onsctl (ONS)Oracle通知服务
srvctl 服务管理工具(包含资源:database|instance|service|nodeapps|asm|listener)
CRS(Cluster Ready Service)
OCR(Oracle Cluster Registry)
ONS(Oracle Notification Service)
位置: $CRS_HOME/bin/
二.集群工具使用说明
-------------------------------------------------------------------------------------------
1.olsnodes 节点查看工具
# ./olsnodes -
Usage: olsnodes [-n] [-p] [-i] [<node> | -l] [-g] [-v]
where
-n print node number with the node name
-p print private interconnect name with the node name
-i print virtual IP name with the node name
<node> print information for the specified node
-l print information for the local node
-g turn on logging
-v run in verbose mode
-------------------------------------------------------------------------------------------
2.oifcfg 网络接口配置工具(Oracle Interface Configuration Tool)
# ./oifcfg
Name:
oifcfg - Oracle Interface Configuration Tool.
Usage: oifcfg iflist [-p [-n]]
oifcfg setif {-node <nodename> | -global} {<if_name>/<subnet>:<if_type>}...
oifcfg getif [-node <nodename> | -global] [ -if <if_name>[/<subnet>] [-type <if_type>] ]
oifcfg delif [-node <nodename> | -global] [<if_name>[/<subnet>]]
oifcfg [-help]
<nodename> - name of the host, as known to a communications network
<if_name> - name by which the interface is configured in the system
<subnet> - subnet address of the interface
<if_type> - type of the interface { cluster_interconnect | public | storage }
例:
# ./oifcfg iflist
# ./oifcfg setif -global eth0/192.168.89.0:public
# ./oifcfg setif -global eth1/192.168.234.0:cluster_interconnect
# ./oifcfg getif
-------------------------------------------------------------------------------------------
3.crsctl 集群环境控制工具
# ./crsctl
Usage: crsctl check crs - checks the viability of the CRS stack
crsctl check cssd - checks the viability of CSS
crsctl check crsd - checks the viability of CRS
crsctl check evmd - checks the viability of EVM
crsctl set css <parameter> <value> - sets a parameter override
crsctl get css <parameter> - gets the value of a CSS parameter
crsctl unset css <parameter> - sets CSS parameter to its default
crsctl query css votedisk - lists the voting disks used by CSS
crsctl add css votedisk <path> - adds a new voting disk
crsctl delete css votedisk <path> - removes a voting disk
crsctl enable crs - enables startup for all CRS daemons
crsctl disable crs - disables startup for all CRS daemons
crsctl start crs - starts all CRS daemons.
crsctl stop crs - stops all CRS daemons. Stops CRS resources in case of cluster.
crsctl start resources - starts CRS resources.
crsctl stop resources - stops CRS resources.
crsctl debug statedump evm - dumps state info for evm objects
crsctl debug statedump crs - dumps state info for crs objects
crsctl debug statedump css - dumps state info for css objects
crsctl debug log css [module:level]{,module:level} ...
- Turns on debugging for CSS
crsctl debug trace css - dumps CSS in-memory tracing cache
crsctl debug log crs [module:level]{,module:level} ...
- Turns on debugging for CRS
crsctl debug trace crs - dumps CRS in-memory tracing cache
crsctl debug log evm [module:level]{,module:level} ...
- Turns on debugging for EVM
crsctl debug trace evm - dumps EVM in-memory tracing cache
crsctl debug log res <resname:level> turns on debugging for resources
crsctl query crs softwareversion [<nodename>] - lists the version of CRS software installed
crsctl query crs activeversion - lists the CRS software operating version
crsctl lsmodules css - lists the CSS modules that can be used for debugging
crsctl lsmodules crs - lists the CRS modules that can be used for debugging
crsctl lsmodules evm - lists the EVM modules that can be used for debugging
If necesary any of these commands can be run with additional tracing by
adding a "trace" argument at the very front.
Example: crsctl trace check css
例:
# ./crsctl check crs # 查询CRS服务状态
# ./crsctl stop crs # 停止CRS服务
# ./crsctl start crs # 启动CRS服务
# ./crsctl disable crs # 禁止CRS随系统启动
# ./crsctl enable crs # 允许CRS随系统启动 实际上是修改了/etc/oracle/scls_scr/dbp/root/crsstart这个文件
-------------------------------------------------------------------------------------------
4.crs_stat 查看CRS所有集群资源的运行状态
# ./crs_stat -
Usage: crs_stat [resource_name [...]] [-v] [-l] [-q] [-c cluster_member]
crs_stat [resource_name [...]] -t [-v] [-q] [-c cluster_member]
crs_stat -p [resource_name [...]] [-q]
crs_stat [-a] application -g
crs_stat [-a] application -r [-c cluster_member]
crs_stat -f [resource_name [...]] [-q] [-c cluster_member]
crs_stat -ls [resource_name [...]] [-q]
例:
$ ./crs_stat -t -v
-------------------------------------------------------------------------------------------
5.ocrcheck 集群注册文件OCR状态,用于检查OCR内容一致性
# ./ocrcheck -
Name:
ocrcheck - Displays health of Oracle Cluster Registry.
Synopsis:
ocrcheck
Description:
prompt> ocrcheck
Displays current usage, location and health of the cluster registry
Notes:
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrcheck_<pid>.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
-------------------------------------------------------------------------------------------
6.ocrdump 输出集群注册文件的ASCII内容
# ./ocrdump -
Name:
ocrdump - Dump contents of Oracle Cluster Registry to a file.
Synopsis:
ocrdump [<filename>|-stdout] [-backupfile <backupfilename>] [-keyname <keyname>] [-xml] [-noheader]
Description:
Default filename is OCRDUMPFILE. Examples are:
prompt> ocrdump
writes cluster registry contents to OCRDUMPFILE in the current directory
prompt> ocrdump MYFILE
writes cluster registry contents to MYFILE in the current directory
prompt> ocrdump -stdout -keyname SYSTEM
writes the subtree of SYSTEM in the cluster registry to stdout
prompt> ocrdump -stdout -xml
writes cluster registry contents to stdout in xml format
Notes:
The header information will be retrieved based on best effort basis.
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrdump_<pid>.log. Make sure
you have file creation privileges in the above directory before
running this tool.
-------------------------------------------------------------------------------------------
7.ocrconfig 集群注册文件配置工具
# ./ocrconfig -help
Name:
ocrconfig - Configuration tool for Oracle Cluster Registry.
Synopsis:
ocrconfig [option]
option:
-export <filename> [-s online]
- Export cluster register contents to a file
-import <filename> - Import cluster registry contents from a file
-upgrade [<user> [<group>]]
- Upgrade cluster registry from previous version
-downgrade [-version <version string>]
- Downgrade cluster registry to the specified version
-backuploc <dirname> - Configure periodic backup location
-showbackup - Show backup information
-restore <filename> - Restore from physical backup
-replace ocr|ocrmirror [<filename>] - Add/replace/remove a OCR device/file
-overwrite - Overwrite OCR configuration on disk
-repair ocr|ocrmirror <filename> - Repair local OCR configuration
-help - Print out this help information
Note:
A log file will be created in
$ORACLE_HOME/log/<hostname>/client/ocrconfig_<pid>.log. Please ensure
you have file creation privileges in the above directory before
running this tool.
-------------------------------------------------------------------------------------------
8.onsctl Oracle通知服务
# ./onsctl -help
usage: ./onsctl start|stop|ping|reconfig|debug
start - Start opmn only.
stop - Stop ons daemon
ping - Test to see if ons daemon is running
debug - Display debug information for the ons daemon
reconfig - Reload the ons configuration
help - Print a short syntax description (this).
detailed - Print a verbose syntax description.
-------------------------------------------------------------------------------------------
9.srvctl 服务管理工具(包含资源:database|instance|service|nodeapps|asm|listener)
# ./srvctl
用法: srvctl <command> <object> [<options>]
命令: enable|disable|start|stop|relocate|status|add|remove|modify|getenv|setenv|unsetenv|config
对象: database|instance|service|nodeapps|asm|listener
有关各个命令和对象的详细帮助, 请使用:
srvctl <command> <object> -h