Wednesday, June 9, 2010

EM Console startup/shutdown Error in 11gR2 Cluster

Once the database is installed and started the EM console is automatically started.
Depending on how the PATH variable is set following error maybe encountered when trying to stop the EM console
[oracle@hpc1 ~ grid1]$ emctl stop dbconsole
Can't locate CompEMdbconsole.pm in @INC (@INC contains: %s_javapOracleHome%
/sysman/admin/scripts %s_javapOracleHome%/bin .....
The problem was as of 11gR2 both grid infrastructure and Oracle database have emctl in the bin directory.
/opt/app/11.2.0/grid/bin
[oracle@hpc1 bin grid1]$ ls | grep emctl
emctl
emctl.pl
emctl.template
Therefore when ORA_CRS_HOME\bin appear first in the PATH instead of or ORACLE_HOME\bin the above error will be thrown.
Also ORACLE_UNIQUENAME is required when starting the EM otherwise
Environment variable ORACLE_UNQNAME not defined. 
Please set ORACLE_UNQNAME to database unique name
which wasn't the case before.

Simply set the global database SID (not the instance SID)
export ORACLE_UNQNAME=grid
emctl start dbconsole