ora.crf服务的功能是Cluster Health Monitor(简称CHM),是Oracle提供监控检测工具,可以自动收集操作系统的资源(CPU、内存、SWAP、进程、I/O以及网络等)信息。CHM会每秒收集一次数据。这些系统资源数据对于诊断集群系统的节点重启、Hang、实例驱逐(Eviction)、性能问题等。但是由于生成的bdb文件很多,对软件目录是个很大的冲击。本文测试如何在线停止ora.crf服务,并删除其记录的文件(太占用软件目录) 。这个测试用例来自银行生产环境的实施前的测试文档。
在线停止ora.crf服务,删除CHM文件
1 查询当前资源ora.crf状态
[grid@rac1 ~]$ crsctl status res ora.crf -init
NAME=ora.crf
TYPE=ora.crf.type
TARGET=ONLINE
STATE=ONLINE on rac1
[grid@rac1 ~]$ crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
1 ONLINE ONLINE rac1 Started
ora.cluster_interconnect.haip
1 ONLINE ONLINE rac1
ora.crf
1 ONLINE ONLINE rac1
2 停止ora.crf资源服务
[grid@rac1 ~]$ /oracle/asm/bin/crsctl stop res ora.crf -init
CRS-2673: Attempting to stop 'ora.crf' on 'rac1'
CRS-2677: Stop of 'ora.crf' on 'rac1' succeeded
[grid@rac1 ~]$ /oracle/asm/bin/crsctl status res ora.crf -init
NAME=ora.crf
TYPE=ora.crf.type
TARGET=OFFLINE
STATE=OFFLINE
3 删除CHM的bdb文件。(root用户)
cd /oracle/asm/crf/db/rac1/
[root@rac1 rac1]# ls -lrt *.bdb
-rw-r----- 1 root root 8192 Apr 15 22:26 crfconn.bdb
-rw-r----- 1 root root 8192 Sep 17 10:08 repdhosts.bdb
-rw-r----- 1 root root 442368 Sep 17 10:08 crfts.bdb
-rw-r----- 1 root root 487424 Sep 17 10:08 crfloclts.bdb
-rw-r----- 1 root root 565248 Sep 17 10:08 crfhosts.bdb
-rw-r----- 1 root root 729088 Sep 17 10:08 crfcpu.bdb
-rw-r----- 1 root root 26214400 Sep 17 10:08 crfclust.bdb
-rw-r----- 1 root root 536576 Sep 17 10:08 crfalert.bdb
[root@rac1 rac1]# rm -rf *.bdb
验证删除
[root@rac1 rac1]# ls -lrt *.bdb
ls: cannot access *.bdb: No such file or directory
4 禁止ora.crf随机自启动(root用户)
/[root@rac1 rac1]# /oracle/asm/bin/crsctl modify res ora.crf -attr ENABLED=0 -init
验证修改效果
[root@rac1 rac1]# /oracle/asm/bin/crsctl status res ora.crf -init -f <<<<<<<< DISABLED = 0
NAME=ora.crf
TYPE=ora.crf.type
STATE=OFFLINE
TARGET=OFFLINE
ACL=owner:root:rw-,pgrp:dba:rw-,other::r--,user:grid:r-x
ACTION_FAILURE_TEMPLATE=
ACTION_SCRIPT=
ACTIVE_PLACEMENT=0
AGENT_FILENAME=%CRS_HOME%/bin/orarootagent%CRS_EXE_SUFFIX%
AUTO_START=always
CARDINALITY=1
CARDINALITY_ID=0
CHECK_ARGS=
CHECK_COMMAND=
CHECK_INTERVAL=30
CLEAN_ARGS=
CLEAN_COMMAND=
CREATION_SEED=16
DAEMON_LOGGING_LEVELS=CRFMOND=0,CRFLDREP=0,CRFLOGD=0,CRFPROXY=0,OCLUMON=0,OCRAPI=0,OCRCLI=0,OCRMSG=0,CSSCLNT=0,CRFM=0
DAEMON_TRACING_LEVELS=CRFMOND=0,CRFLDREP=0,CRFLOGD=0,CRFPROXY=0,OCLUMON=0,OCRAPI=0,OCRCLI=0,OCRMSG=0,CSSCLNT=0,CRFM=0
DEFAULT_TEMPLATE=
DEGREE=1
DESCRIPTION="Resource type for Crf Agents"
DETACHED=true
ENABLED=0
FAILOVER_DELAY=0
FAILURE_INTERVAL=3
FAILURE_THRESHOLD=5
HOSTING_MEMBERS=
ID=ora.crf
LOAD=1
LOGGING_LEVEL=1
NOT_RESTARTING_TEMPLATE=
OFFLINE_CHECK_INTERVAL=0
ORA_VERSION=11.2.0.4.0
PID_FILE=
PLACEMENT=balanced
PROCESS_TO_MONITOR=
PROFILE_CHANGE_TEMPLATE=
RESTART_ATTEMPTS=5
SCRIPT_TIMEOUT=60
SERVER_POOLS=
START_ARGS=
START_COMMAND=
START_DEPENDENCIES=hard(ora.gpnpd)
START_TIMEOUT=120
STATE_CHANGE_TEMPLATE=
STOP_ARGS=
STOP_COMMAND=
STOP_DEPENDENCIES=hard(shutdown:ora.gipcd)
STOP_TIMEOUT=120
UNRESPONSIVE_TIMEOUT=180
UPTIME_THRESHOLD=1m
USR_ORA_ENV=
[root@rac1 rac1]# /oracle/asm/bin/crsctl status res ora.crf -init
NAME=ora.crf
TYPE=ora.crf.type
TARGET=OFFLINE
STATE=OFFLINE
5 此时 集群状态
[root@rac1 rac1]# /oracle/asm/bin/crsctl stat res -t -init
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.asm
1 ONLINE ONLINE rac1 Started
ora.cluster_interconnect.haip
1 ONLINE ONLINE rac1
ora.crf
1 OFFLINE OFFLINE
ora.crsd
1 ONLINE ONLINE rac1
ora.cssd
1 ONLINE ONLINE rac1
ora.cssdmonitor
1 ONLINE ONLINE rac1
ora.ctssd
1 ONLINE ONLINE rac1 ACTIVE:0
ora.diskmon
1 OFFLINE OFFLINE
ora.evmd
1 ONLINE ONLINE rac1
ora.gipcd
1 ONLINE ONLINE rac1
ora.gpnpd
1 ONLINE ONLINE rac1
ora.mdnsd
1 ONLINE ONLINE rac1
[root@rac1 rac1]# /oracle/asm/bin/crsctl stat res -t
--------------------------------------------------------------------------------
NAME TARGET STATE SERVER STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.ASMOCR.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ASMVG1.dg
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.LISTENER.lsnr
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.asm
ONLINE ONLINE rac1 Started
ONLINE ONLINE rac2 Started
ora.gsd
OFFLINE OFFLINE rac1
OFFLINE OFFLINE rac2
ora.net1.network
ONLINE ONLINE rac1
ONLINE ONLINE rac2
ora.ons
ONLINE ONLINE rac1
ONLINE ONLINE rac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
1 ONLINE ONLINE rac2
ora.cvu
1 ONLINE ONLINE rac1
ora.oc4j
1 ONLINE ONLINE rac1
ora.orcl.db
1 ONLINE ONLINE rac1 Open
2 ONLINE ONLINE rac2 Open
ora.rac1.vip
1 ONLINE ONLINE rac1
ora.rac2.vip
1 ONLINE ONLINE rac2
ora.scan1.vip
1 ONLINE ONLINE rac2
6 另一个节点相同操作
***********************************************************简化后的操作步骤******************************************************************
在两个节点分别执行
1 停止ora.crf资源服务
/oracle/asm/bin/crsctl stop res ora.crf -init
/oracle/asm/bin/crsctl status res ora.crf -init
2 删除CHM文件
cd /oracle/asm/crf/db/rac1/
rm -rf *. bdb
rm -rf *.ldb
3 禁止ora.crf随机自启动
/oracle/asm/bin/crsctl modify res ora.crf -attr ENABLED=0 -init (/oracle/asm/bin/crsctl modify res ora.crf -attr ENABLED=0 -init -f)
验证文件修改结果
/oracle/asm/bin/crsctl status res ora.crf -init -f
/oracle/asm/bin/crsctl status res ora.crf -init
*****************************************************生产环境可以不执行重启集群操作************************************************************
4 重启集群测试
/oracle/asm/bin/crsctl stop crs
/oracle/asm/bin/crsctl start crs
/oracle/asm/bin/crsctl status res ora.crf -init