免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2244 | 回复: 1
打印 上一主题 下一主题

请教:IBM p550双机拔主机的主备网线时,oracle资源一直处于releasing状态 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-04-23 18:10 |只看该作者 |倒序浏览
机器配置:AIX 5.3+HACMP+Oracle 9i,failover方式
问题描述:原来双机是好的,切换也没有问题,数据库应用可以正常切换到备机。但有一次数据库怎么也起不来了,临时重建了一个lv,做数据文件的引导;之后做双机的资源同步,提示ok,起双机,数据库可以正常拉起,但是拔掉主机上主备用网卡的网线后,等待很长时间,双机不能完成切换;但是比较奇怪的是,重新插上网线后,过一段时间后又能完成切换,即从原主机切换到了备机。
在hacmp日志中显示切换进程进入了死循环。
日志:
/tmp/hacmp.out

Apr 19 16:16:17 EVENT START: network_down aip4db2 net_ether_01

:network_down[62] [[ high = high ]]
:network_down[62] version=1.23
:network_down[63] :network_down[63] cl_get_path
HA_DIR=es
:network_down[65] [ 2 -ne 2 ]
:network_down[77] :network_down[77] cl_rrmethods2call net_cleanup
:cl_rrmethods2call[49] [[ high = high ]]
:cl_rrmethods2call[49] version=1.11
:cl_rrmethods2call[50] :cl_rrmethods2call[50] cl_get_path
HA_DIR=es
:cl_rrmethods2call[63] :cl_rrmethods2call[63] odmget -qname=net_ether_01 HACMPnetwork
:cl_rrmethods2call[63] egrep nimname
:cl_rrmethods2call[63] sed s/"//g
:cl_rrmethods2call[63] awk {print $3}
RRNET=ether
:cl_rrmethods2call[63] [[ ether = Geo_Primary ]]
:cl_rrmethods2call[63] [[ ether = XD_data ]]
:cl_rrmethods2call[75] :cl_rrmethods2call[75] odmget -qtype=2 HACMPrresmethods
:cl_rrmethods2call[75] egrep net_cleanup =
:cl_rrmethods2call[75] awk {print $3}
:cl_rrmethods2call[75] sed s/"//g
RRMETHODS=
:cl_rrmethods2call[77] echo  
:cl_rrmethods2call[78] exit 0
METHODS=
:network_down[91] set -u
:network_down[104] exit 0
Apr 19 16:16:17 EVENT COMPLETED: network_down aip4db2 net_ether_01 0

                        HACMP Event Summary
Event: network_down aip4db2 net_ether_01
Start time: Thu Apr 19 16:16:17 2007

End time: Thu Apr 19 16:16:17 2007

Action:                Resource:                        Script Name:
----------------------------------------------------------------------------
No resources changed as a result of this event
----------------------------------------------------------------------------

Apr 19 16:16:17 EVENT START: network_down_complete aip4db2 net_ether_01

:network_down_complete[61] [[ high = high ]]
:network_down_complete[61] version=1.1.1.13
:network_down_complete[62] :network_down_complete[62] cl_get_path
HA_DIR=es
:network_down_complete[64] [ ! -n  ]
:network_down_complete[66] EMULATE=REAL
:network_down_complete[69] [ 2 -ne 2 ]
:network_down_complete[75] set -u
:network_down_complete[81] STATUS=0
:network_down_complete[85] odmget HACMPnode
:network_down_complete[85] grep name =
:network_down_complete[85] sort
:network_down_complete[85] uniq
:network_down_complete[85] wc -l
:network_down_complete[85] [ 2 -eq 2 ]
:network_down_complete[87] :network_down_complete[87] odmget HACMPgroup
:network_down_complete[87] grep group =
:network_down_complete[87] sed s/"//g
:network_down_complete[87] awk {print $3}
RESOURCE_GROUPS=aip4db_ora
:network_down_complete[91] :network_down_complete[91] odmget -q group=aip4db_ora AND name=EXPORT_FILESYSTEM HACMPresource
:network_down_complete[91] grep value
:network_down_complete[91] awk {print $3}
:network_down_complete[91] sed s/"//g
EXPORTLIST=
:network_down_complete[92] [ -n  ]
:network_down_complete[114] cl_hb_alias_network net_ether_01 add
:cl_hb_alias_network[57] [[ high = high ]]
:cl_hb_alias_network[57] version=1.4
:cl_hb_alias_network[58] :cl_hb_alias_network[58] cl_get_path
HA_DIR=es
:cl_hb_alias_network[60] NETWORK=net_ether_01
:cl_hb_alias_network[61] ACTION=add
:cl_hb_alias_network[64] [[ 2 != 2 ]]
:cl_hb_alias_network[70] [[ add != add ]]
:cl_hb_alias_network[76] set -u
:cl_hb_alias_network[78] cl_echo 33 Starting execution of /usr/es/sbin/cluster/utilities/cl_hb_alias_network with parameters net_ether_01 add\n /usr/es/sbin/cluster/utilities/cl_hb_alias_network net_ether_01 add
:cl_echo[49] version=1.13
:cl_echo[98] HACMP_OUT_FILE=/tmp/hacmp.out
Apr 19 2007 16:16:18 Starting execution of /usr/es/sbin/cluster/utilities/cl_hb_alias_network with parameters net_ether_01 add
:cl_hb_alias_network[79] date
Thu Apr 19 16:16:18 BEIST 2007
:cl_hb_alias_network[81] :cl_hb_alias_network[81] get_local_nodename
:get_local_nodename[40] [[ high = high ]]
:get_local_nodename[40] version=1.2.1.16
:get_local_nodename[41] :get_local_nodename[41] cl_get_path
HA_DIR=es
:get_local_nodename[43] AIXODMDIR=/etc/objrepos
:get_local_nodename[44] HAODMDIR=/etc/es/objrepos
:get_local_nodename[48] export ODMDIR=/etc/es/objrepos
:get_local_nodename[50] :get_local_nodename[50] /usr/es/sbin/cluster/utilities/cllsclstr -N
nodename=aip4db2
:get_local_nodename[52] :get_local_nodename[52] cut -d: -f1
:get_local_nodename[52] cllsnode -cS
NODENAME=aip4db1
aip4db2
:get_local_nodename[56] [[ aip4db1 = aip4db2 ]]
:get_local_nodename[56] [[ aip4db2 = aip4db2 ]]
:get_local_nodename[59] print aip4db2
:get_local_nodename[60] exit 0
LOCALNODENAME=aip4db2
:cl_hb_alias_network[82] STATUS=0
:cl_hb_alias_network[85] cllsnw -Scn net_ether_01
:cl_hb_alias_network[85] cut -d: -f4
:cl_hb_alias_network[85] grep -q hb_over_alias
:cl_hb_alias_network[85] exit 0
:network_down_complete[120] exit 0
Apr 19 16:16:18 EVENT COMPLETED: network_down_complete aip4db2 net_ether_01 0

                        HACMP Event Summary
Event: network_down_complete aip4db2 net_ether_01
Start time: Thu Apr 19 16:16:17 2007

End time: Thu Apr 19 16:16:18 2007

Action:                Resource:                        Script Name:
----------------------------------------------------------------------------
No resources changed as a result of this event
----------------------------------------------------------------------------

Apr 19 16:16:29 EVENT START: rg_move_release aip4db2 1

+ [[ high = high ]]
+ version=1.10.1.46
+ set -u
+ [ 2 != 2 ]
+ set +u
+ clcallev rg_move aip4db2 1 RELEASE

Apr 19 16:16:29 EVENT START: rg_move aip4db2 1 RELEASE

+ [[ high = high ]]
+ version=1.2.1.16
+ + cl_get_path
HA_DIR=es
+ AIXODMDIR=/etc/objrepos
+ HAODMDIR=/etc/es/objrepos
+ export ODMDIR=/etc/es/objrepos
+ + /usr/es/sbin/cluster/utilities/cllsclstr -N
nodename=aip4db2
+ + cut -d: -f1
+ cllsnode -cS
NODENAME=aip4db1
aip4db2
+ [[ aip4db1 = aip4db2 ]]
+ [[ aip4db2 = aip4db2 ]]
+ print aip4db2
+ exit 0
:rg_move[71] version=1.28.1.1
:rg_move[73] :rg_move[73] cl_get_path
HA_DIR=es
:rg_move[82] STATUS=0
:rg_move[84] [ ! -n  ]
:rg_move[86] EMULATE=REAL
:rg_move[92] set -u
:rg_move[94] [[ 3 != 3 ]]
:rg_move[106] export NODENAME=aip4db2
:rg_move[107] RGID=1
:rg_move[108] [[ 3 = 3 ]]
:rg_move[110] ACTION=RELEASE
:rg_move[117] odmget -qid=1 HACMPgroup
:rg_move[117] egrep group =
:rg_move[117] awk {print $3}
:rg_move[117] eval RGNAME="aip4db_ora"
:rg_move[117] RGNAME=aip4db_ora
:rg_move[119] UPDATESTATD=0
:rg_move[120] export UPDATESTATD
:rg_move[124] export RG_MOVE_EVENT=true
:rg_move[125] group_state=$RESGRP_aip4db_ora_aip4db2
:rg_move[126] set +u
:rg_move[127] eval print $RESGRP_aip4db_ora_aip4db2
:rg_move[127] print
:rg_move[127] export RG_MOVE_ONLINE=
:rg_move[128] set -u
:rg_move[129] RG_MOVE_ONLINE=TMP_ERROR
:rg_move[136] rm -f /tmp/.NFSSTOPPED
:rg_move[137] rm -f /tmp/.RPCLOCKDSTOPPED
:rg_move[144] set -a
:rg_move[145] clsetenvgrp aip4db2 rg_move aip4db_ora
:clsetenvgrp[50] [[ high = high ]]
:clsetenvgrp[50] version=1.16
:clsetenvgrp[52] usingVer=clSetenvgrp
:clsetenvgrp[57] clSetenvgrp aip4db2 rg_move aip4db_ora
executing clSetenvgrp
clSetenvgrp: argc = 4
clSetenvgrp completed successfully
:clsetenvgrp[58] exit 0
:rg_move[145] eval NFS_aip4db_ora="TRANS" NFSNODE_aip4db_ora="aip4db1" FORCEDOWN_GROUPS="" RESOURCE_GROUPS="aip4db_ora" HOMELESS_GROUPS="" ERRSTATE_GROUPS="" PRINCIPAL_ACTIONS="R" ASSOCIATE_ACTIONS="MO" AUXILLIARY_ACTIONS="N" SIBLING_GROUPS="" SIBLING_NODES_BY_GROUP="" SIBLING_ACQUIRING_GROUPS="" SIBLING_ACQUIRING_NODES_BY_GROUP="" SIBLING_RELEASING_GROUPS="" SIBLING_RELEASING_NODES_BY_GROUP="" SIBLING_PRE_EVENT_LOC=""
:rg_move[145] NFS_aip4db_ora=TRANS NFSNODE_aip4db_ora=aip4db1 FORCEDOWN_GROUPS= RESOURCE_GROUPS=aip4db_ora HOMELESS_GROUPS= ERRSTATE_GROUPS= PRINCIPAL_ACTIONS=R ASSOCIATE_ACTIONS=MO AUXILLIARY_ACTIONS=N SIBLING_GROUPS= SIBLING_NODES_BY_GROUP= SIBLING_ACQUIRING_GROUPS= SIBLING_ACQUIRING_NODES_BY_GROUP= SIBLING_RELEASING_GROUPS= SIBLING_RELEASING_NODES_BY_GROUP= SIBLING_PRE_EVENT_LOC=
:rg_move[146] RC=0
:rg_move[147] set +a
:rg_move[151] [[ 0 -ne 0 ]]
:rg_move[151] [[ -z aip4db_ora ]]
:rg_move[156] [ RELEASE = ACQUIRE ]
:rg_move[235] set -a
:rg_move[236] clsetenvres aip4db_ora rg_move
:rg_move[236] eval PRINCIPAL_ACTION="RELEASE" ASSOCIATE_ACTION="MOUNT" AUXILLIARY_ACTION="NONE" VG_RR_ACTION="RELEASE" SIBLING_NODES="" SIBLING_NONOWNER_NODES="" SIBLING_ACQUIRING_NODES= SIBLING_RELEASING_NODES= FOLLOWER_ACTION="NONE" NFS_HOST=aip4db1 DISK= CONCURRENT_VOLUME_GROUP= EXPORT_FILESYSTEM= AIX_CONNECTIONS_SERVICES= AIX_FAST_CONNECT_SERVICES= SNA_CONNECTIONS= COMMUNICATION_LINKS= SHARED_TAPE_RESOURCES= MOUNT_FILESYSTEM= INACTIVE_TAKEOVER= TAKEOVER_LABEL= NFSMOUNT_LABEL= MISC_DATA= NFS_NETWORK= SHARED_TAPE_RESOURCES= PPRC_REP_RESOURCE= ERCMF_REP_RESOURCE= SVCPPRC_REP_RESOURCE= GMD_REP_RESOURCE= GMVG_REP_RESOURCE= APPLICATIONS="aip4db_app" FILESYSTEM="ALL" FORCED_VARYON="false" FSCHECK_TOOL="fsck" FS_BEFORE_IPADDR="false" RECOVERY_METHOD="sequential" SERVICE_LABEL="service_ip" SSA_DISK_FENCING="false" VG_AUTO_IMPORT="false" VOLUME_GROUP="vg_index vg_data"
:rg_move[236] PRINCIPAL_ACTION=RELEASE ASSOCIATE_ACTION=MOUNT AUXILLIARY_ACTION=NONE VG_RR_ACTION=RELEASE SIBLING_NODES= SIBLING_NONOWNER_NODES= SIBLING_ACQUIRING_NODES= SIBLING_RELEASING_NODES= FOLLOWER_ACTION=NONE NFS_HOST=aip4db1 DISK= CONCURRENT_VOLUME_GROUP= EXPORT_FILESYSTEM= AIX_CONNECTIONS_SERVICES= AIX_FAST_CONNECT_SERVICES= SNA_CONNECTIONS= COMMUNICATION_LINKS= SHARED_TAPE_RESOURCES= MOUNT_FILESYSTEM= INACTIVE_TAKEOVER= TAKEOVER_LABEL= NFSMOUNT_LABEL= MISC_DATA= NFS_NETWORK= SHARED_TAPE_RESOURCES= PPRC_REP_RESOURCE= ERCMF_REP_RESOURCE= SVCPPRC_REP_RESOURCE= GMD_REP_RESOURCE= GMVG_REP_RESOURCE= APPLICATIONS=aip4db_app FILESYSTEM=ALL FORCED_VARYON=false FSCHECK_TOOL=fsck FS_BEFORE_IPADDR=false RECOVERY_METHOD=sequential SERVICE_LABEL=service_ip SSA_DISK_FENCING=false VG_AUTO_IMPORT=false VOLUME_GROUP=vg_index vg_data
:rg_move[237] set +a
:rg_move[238] export GROUPNAME=aip4db_ora
aip4db_ora:rg_move[238] [[ RELEASE =  ]]
aip4db_ora:rg_move[267] [ RELEASE = RELEASE ]
aip4db_ora:rg_move[269] [ RELEASE = RELEASE ]
aip4db_ora:rg_move[271] clcallev node_down_local

Apr 19 16:16:29 EVENT START: node_down_local

aip4db_ora:node_down_local[141] [[ high == high ]]
aip4db_ora:node_down_local[141] version=1.2.1.68
aip4db_ora:node_down_local[142] cl_get_path
aip4db_ora:node_down_local[142] HA_DIR=es
aip4db_ora:node_down_local[144] STATUS=0
aip4db_ora:node_down_local[144] typeset -i STATUS
aip4db_ora:node_down_local[146] EMULATE=REAL
aip4db_ora:node_down_local[148] (( 0 != 0 ))
aip4db_ora:node_down_local[160] eval 'echo ${RESGRP_aip4db_ora_aip4db2}'
aip4db_ora:node_down_local[1] echo
aip4db_ora:node_down_local[160] read state
aip4db_ora:node_down_local[161] [[ TMP_ERROR != TMP_ERROR ]]
aip4db_ora:node_down_local[167] set -u
aip4db_ora:node_down_local[172] set_resource_status RELEASING
aip4db_ora:node_down_local[3] set +u
aip4db_ora:node_down_local[4] NOT_DOIT=''
aip4db_ora:node_down_local[5] set -u
aip4db_ora:node_down_local[6] [[ '' != TRUE ]]
aip4db_ora:node_down_local[8] [[ REAL == EMUL ]]
aip4db_ora:node_down_local[13] clchdaemons -d clstrmgr_scripts -t resource_locator -n aip4db2 -o aip4db_ora -v RELEASING
aip4db_ora:node_down_local[22] [[ RELEASING == RELEASING ]]
aip4db_ora:node_down_local[24] [[ NONE == RELEASE_SECONDARY ]]
aip4db_ora:node_down_local[25] [[ NONE == SECONDARY_BECOMES_PRIMARY ]]
aip4db_ora:node_down_local[29] cl_RMupdate releasing aip4db_ora node_down_local
Reference string: Thu.Apr.19.16:16:30.BEIST.2007.node_down_local.aip4db_ora.ref
aip4db_ora:node_down_local[177] [[ -n aip4db_app ]]
aip4db_ora:node_down_local[184] TMPLIST=''
aip4db_ora:node_down_local[185] [[ -n aip4db_app ]]
aip4db_ora:node_down_local[186] print aip4db_app
aip4db_ora:node_down_local[186] read first_one APPLICATIONS
aip4db_ora:node_down_local[187] TMPLIST=aip4db_app
aip4db_ora:node_down_local[185] [[ -n '' ]]
aip4db_ora:node_down_local[190] APPLICATIONS=aip4db_app
aip4db_ora:node_down_local[193] [[ REAL == EMUL ]]
aip4db_ora:node_down_local[198] clcallev stop_server aip4db_app

Apr 19 16:16:30 EVENT START: stop_server aip4db_app

aip4db_ora:stop_server[48] [[ high = high ]]
aip4db_ora:stop_server[48] version=1.4.1.10
aip4db_ora:stop_server[49] aip4db_ora:stop_server[49] cl_get_path
HA_DIR=es
aip4db_ora:stop_server[51] STATUS=0
aip4db_ora:stop_server[55] [ ! -n  ]
aip4db_ora:stop_server[57] EMULATE=REAL
aip4db_ora:stop_server[60] PROC_RES=false
aip4db_ora:stop_server[64] [[ 0 != 0 ]]
aip4db_ora:stop_server[68] set -u
aip4db_ora:stop_server[71] ALLSERVERS=All_servers
aip4db_ora:stop_server[72] [ REAL = EMUL ]
aip4db_ora:stop_server[77] cl_RMupdate resource_releasing All_servers stop_server
Reference string: Thu.Apr.19.16:16:30.BEIST.2007.stop_server.All_servers.aip4db_ora.ref
aip4db_ora:stop_server[88] aip4db_ora:stop_server[88] cut -d: -f3
aip4db_ora:stop_server[88] cllsserv -cn aip4db_app
STOP=/opt/oracle/stopdb.sh
aip4db_ora:stop_server[90] PATTERN=aip4db2 aip4db_app
aip4db_ora:stop_server[97] [ -x /opt/oracle/stopdb.sh ]
aip4db_ora:stop_server[99] [ REAL = EMUL ]
aip4db_ora:stop_server[104] /opt/oracle/stopdb.sh
aip4db_ora:stop_server[104] ODMDIR=/etc/objrepos
[YOU HAVE NEW MAIL]

SQL*Plus: Release 9.2.0.5.0 - Production on Thu Apr 19 16:16:30 2007

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

SQL> Connected.
SQL>
Apr 19 16:22:29 EVENT START: config_too_long 360 /usr/es/sbin/cluster/events/rg_move.rp

:config_too_long[64] [[ high = high ]]
:config_too_long[64] version=1.11
:config_too_long[65] :config_too_long[65] cl_get_path
HA_DIR=es
:config_too_long[67] NUM_SECS=360
:config_too_long[68] EVENT=/usr/es/sbin/cluster/events/rg_move.rp
:config_too_long[70] HOUR=3600
:config_too_long[71] THRESHOLD=5
:config_too_long[72] SLEEP_INTERVAL=1
:config_too_long[78] PERIOD=30
:config_too_long[81] set -u
:config_too_long[86] LOOPCNT=0
:config_too_long[87] MESSAGECNT=0
:config_too_long[88] :config_too_long[88] cllsclstr -c
:config_too_long[88] grep -v cname
:config_too_long[88] cut -d : -f2
CLUSTER=aip4db_cluster
:config_too_long[89] TIME=360
:config_too_long[90] sleep_cntr=0
:config_too_long[95] [ -x /usr/lpp/ssp/bin/spget_syspar ]
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 360 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 390 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 420 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 450 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 480 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 540 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 600 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 660 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 720 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 780 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 900 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 1020 seconds. Please check cluster status.
WARNING: Cluster aip4db_cluster has been running recovery program '/usr/es/sbin/cluster/events/rg_move.rp' for 1140 seconds. Please check cluster status.

请各位给予指点,多谢!!

论坛徽章:
0
2 [报告]
发表于 2007-04-23 18:13 |只看该作者
请大家帮忙看看是哪里的问题,多谢!!

monitor监控脚本内容:
#!/usr/bin/ksh

# *****************************************************************************
# ********** Note: This file MUST be edited before it can be used. ************
# *****************************************************************************

# *****************************************************************************
# ************************ START OF EDITABLE SECTION **************************
# *****************************************************************************
SERVICE_IP=10.71.111.183
ORACLE_SID=ibmora
ORACLE_HOME=/opt/oracle/product/9.2
ORACLE_LISTENER_NAME=
LOG_FILE=/tmp/monitor.out
HACMPCLUTL=/usr/sbin/cluster/utilities
SH=/usr/bin/ksh
MONITOR_INTERVAL=5
PFILE=$ORACLE_HOME/dbs/init${ORACLE_SID}.ora
ORACLE_VERSION=9.2.0.5

# *****************************************************************************
# ********************** START OF NON-EDITABLE SECTION ************************
# *****************************************************************************
set -A MONITOR_PROCESSES ora_pmon_${ORACLE_SID} ora_dbw0_${ORACLE_SID} ora_ckpt_${ORACLE_SID}  ora_smon_${ORACLE_SID} ora_lgwr_${ORACLE_SID} ora_reco_${ORACLE_SID}

HOST=`hostname`
PATH=${ORACLE_HOME}/bin:/sbin:/usr/bin:/usr/sbin:/etc:/bin

export ORACLE_SID
export ORACLE_HOME

# *****************************************************************************
# return code
#   0 - primary
#   1 - standby
# *****************************************************************************
function is_cluster_primary
{
    ifconfig -a | grep ${SERVICE_IP} > /dev/null
    return $?
}

# *****************************************************************************
# return code
#   0 - succeed
#   1 - fail
# *****************************************************************************
function monitor_listener
{
    su - oracle -c "${ORACLE_HOME}/bin/lsnrctl status ${ORACLE_LISTENER_NAME}" > /dev/null
    if [ $? = 0 ]
    then
        MONITOR_LISTENER_PID=`ps -fu oracle | grep tnslsnr | awk '{ print $2 }'`
#       print "Monitored process = tnslsnr, pid = ${MONITOR_LISTENER_PID}" >> ${LOG_FILE}

        return 0
    fi

    su - oracle -c "${ORACLE_HOME}/bin/lsnrctl start ${ORACLE_LISTENER_NAME}" > /dev/null
    if [ $? = 0 ]
    then
        MONITOR_LISTENER_PID=`ps -fu oracle | grep tnslsnr | awk '{ print $2 }'`
        print "Monitored process = tnslsnr, pid = ${MONITOR_LISTENER_PID}" >> ${LOG_FILE}

        print "\n *** listener has restarted. ***" >> ${LOG_FILE}
        return 0
    fi

    print "\n *** listener has failed.  Aborting Oracle. ***" >> ${LOG_FILE}
    return 1
}

# *****************************************************************************
# return code
#   0 - succeed
#   1 - fail
# *****************************************************************************
function monitor_processes
{
    typeset -i n=0

        DATE=`date`
#    print "${HOST} - ${DATE}" >> ${LOG_FILE}
    for i in ${MONITOR_PROCESSES[@]}
    do
        MONITOR_PROCESSES_PID[$n]=`ps -fu oracle | grep ${i} | awk '{ print $2 }'`
#        print "Monitored process = ${i}, pid = ${MONITOR_PROCESSES_PID[$n]}" >> ${LOG_FILE}
        if [[ ${MONITOR_PROCESSES_PID[$n]} = "" ]]
        then
            print "\n\n" >> ${LOG_FILE}
            ps -ef >> ${LOG_FILE}
            print "\n *** ${i} has failed.  Aborting Oracle. ***" >> ${LOG_FILE}
            print "\n" >> ${LOG_FILE}

            return 1
        fi
        (( n = n + 1 ))
    done

    monitor_listener
    if [ $? = 1 ]
    then
        return 1
    fi

    print "\n" >> ${LOG_FILE}
    return 0
}

# *****************************************************************************
# main code
# *****************************************************************************
if [ ${LOGIN} != root ]
then
    print "Please run $0 as super user root. script exits now."
    exit 1
fi

case $1 in
    start)
            su - oracle -c "${ORACLE_HOME}/bin/lsnrctl start" >> ${LOG_FILE}

#is_cluster_primary
#                if [ $? = 1 ]
#                then
#                        exit 0
#                fi
#ps -ef|grep HWIVASMON|grep -v grep > /dev/null
#                if [ $? = 0 ]
#                then
#                        exit 0
#                fi

            if [ ${ORACLE_VERSION} = 8.1.X ]
            then
                    su - oracle -c "${ORACLE_HOME}/bin/sqlplus /nolog<<EOF
connect / as sysdba
startup pfile=${PFILE}
exit
EOF
" >> ${LOG_FILE}
                else
print "oracle 9205" >> ${LOG_FILE}
                    su - oracle -c "${ORACLE_HOME}/bin/sqlplus /nolog<<EOF
connect / as sysdba
startup
exit
EOF
" >> ${LOG_FILE}
        fi
        print "shell is $0"
        ${SH} "$0 monitor HWIVASMON" &
        exit 0
        ;;
    stop)
        ps -ef | grep HWIVASMON | grep -v grep | awk '{print "kill", $2}' | ${SH}
            su - oracle -c "${ORACLE_HOME}/bin/lsnrctl stop" >> ${LOG_FILE}
        ps -ef|grep oracle${ORACLE_SID}|grep -v grep|awk '{print $2}'|xargs kill -9
            su - oracle -c "${ORACLE_HOME}/bin/sqlplus /nolog<<EOF
connect / as sysdba
shutdown immediate
exit
EOF
" >> ${LOG_FILE}
        exit 0
        ;;
    monitor)
            while true
            do
                sleep ${MONITOR_INTERVAL}
       
                is_cluster_primary
                if [ $? = 0 ]
                then
                    monitor_processes
                    if [ $? = 1 ]
                    then
                        ${HACMPCLUTL}/clstop -y '-N' '-gr' # stop and takeover
                        exit 1
                    fi
                fi
            done
        exit 0
        ;;
    *)
            print "Usage: $0 [start | stop | monitor]"
            exit 0
            ;;
esac
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP