I had an error message today from one of my grid agents which was cut short in the GUI just when it became interesting. So I thought of a way of running the command on the comand line to get the full output.
This has been a little easier than I thought. I based my approach on an earlier blog article on my knowledgebase to get the perl environment variables set. I then needed to figure out where some of the libraries (perl scripts ending in *.pm) the agent script are referring were located.
A simple “locate -i *pm | grep $ORACLE_HOME” did it. This enabled me to write a preliminary script to run an EM agent task, shown below. It expects that you have ran “oraenv” previously to set the environment to the AGENT_HOME. When referring to ORACLE_HOME in the following, the AGENT_HOME is meant. It takes the full parameter to the script to be executed as the parameter and checked for ORACLE_HOME and $1 to exist.
#!/bin/bash if [ "${ORACLE_HOME}" == "" ]; then echo "Need to specify the ORACLE_HOME first!" exit 1 fi if [ "$1" == "" ]; then echo "Need to specify the full path to the script to run" exit 1; fi LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH PERLBIN=$ORACLE_HOME/perl/bin/perl PERLV=`${PERLBIN} -e 'printf "%vd", $^V'` PERLINC="-I ${ORACLE_HOME}/perl/lib/${PERLV}" PERLINC="${PERLINC} -I ${ORACLE_HOME}/perl/lib/site_perl/${PERLV}" PERLINC="${PERLINC} -I ${ORACLE_HOME}/lib" PERLINC="${PERLINC} -I $ORACLE_HOME/sysman/admin/scripts/" RUNTHIS="${PERLBIN} ${PERLINC} $1" exec ${RUNTHIS}
This allowed me to run the script crs_status.pl – $ORACLE_HOME/sysman/admin/scripts/ without problem.