The idea is to manage the OEM agent by Oracle Grid CRSCTL utility, so we can manage OEM agent along with other resources on the server. In order to do this,

  1. Create a basic shell script to start/stop and check the status of the agent.
  2. Add the above script to CRSCTL add the resource.

crs_AG_startstop.sh

[grid@node1 script]$ cat crs_AG_startstop.sh #!/bin/bash   #  Sandeep Narani ORACLE_BASE=/u01/app/oracle   ORACLE_HOME=/u01/app/oracle/product/11.2.0.4/dbhome_1  LIBRARY_PATH=$ORACLE_HOME/lib  AGENT_HOME=/u01/app/oracle/product/oem13c/em_agent/agent_inst export ORACLE_BASE   export ORACLE_HOME   export LD_LIBRARY_PATH   export AGENT_HOME   agent_start () {   $AGENT_HOME/bin/emctl start agent   }  agent_stop () {   $AGENT_HOME/bin/emctl stop agent   }  agent_check () {   $AGENT_HOME/bin/emctl status agent   }  case “$1″ in    start)            agent_start          ;;    stop)          agent_stop          ;;    check)      agent_check          ;;    clean)      agent_clean $(ps -C emagent -o pid=)      ;;    *)          echo $”Usage: `basename $0` {start|stop|status|clean}”          exit 1   esac

 

Add CRSCTL Resource: 

crsctl add resource crs_agent13c -type local_resource -attr "ACTION_SCRIPT=/u01/app/11.2.0.4/grid/crs/script/crs_AG_startstop.sh,DESCRIPTION=Local Resource for Agent 12c, DEGREE=1, ENABLED=1, AUTO_START=restore, START_TIMEOUT=120, UPTIME_THRESHOLD=1h,CHECK_INTERVAL=60, STOP_TIMEOUT=120, SCRIPT_TIMEOUT=120, RESTART_ATTEMPTS=3, OFFLINE_CHECK_INTERVAL=60, START_DEPENDENCIES=, STOP_DEPENDENCIES=,"

Restart CRSCTL: 

up

 

 

 

Leave a comment