OEM - Quick Commands

Managing dbconsole
./emctl status dbconsole
./emctl start dbconsole
./emctl stop dbconsole

Managing agent
./emctl status agent
./emctl stop agent
./emctl start agent

To Re-Start OEM
opmnctl stopall
opmnctl startall

Re-Start OMS
oemctl start oms
oemctl status oms sysman/oem_temp
oemctl stop oms sysman/oem_temp
Windows NT/2000 users can just stop and start the required services. The default OEM administrator is “sysman” with a password of “oem_temp”.


Full Restart of OMS, GRID AGENT AND REPOSITORY DATABASE ON a-oem-1 (OMS Control) and a-oem-2 (Repository DB) Servers.
Login to a-oem-1 server as oracle user

1. STOP LOCAL GRID CONTROL AGENT.
cd /u01/app/oracle/product/10.2.0/em_1/agent10g/bin
./emctl status agent
./emctl stop agent
./emctl status agent

2. STOP GRID CONTROL OMS– (Oracle Management Server)
cd /u01/app/oracle/product/10.2.0/em_1/oms10g/bin
./emctl status oms
./emctl stop oms
./emctl status oms

Check for any leftover EM processes – and Kill them if needed
ps -ef | grep emagent
  oracle 1302690 1839200   0 04:24:33      -  5:22 /u01/oracle/product/grid/agent10g/bin/emagent
  oracle 1839200       1   0 04:24:27      -  0:04 /u01/oracle/product/grid/agent10g/perl/bin/perl /u01/oracle/product/grid/agent10g/bin/emwd.pl agent /u01/oracle/product/grid/agent10g/sysman/log/emagent.nohup

kill -9 1839200
kill -9 1302690

3.  Shutdown EMREP running on a-oem-2  (Repository Database ) .
Login to a-oem-2 server as oracle user
echo $ORACLE_SID
sqlplus / as sysdba
shutdown immediate
exit

Stop the Listener
lsnrctl stop

4. Go Back to a-oem-1 and Stop all processes
cd /u01/app/oracle/product/10.2.0/em_1/oms10g/opmn/bin
./opmnctl status – to check status
./opmnctl stopall
./opmnctl status – to check status

 
STARTUP ALL COMPONENTS OF GRID CONTROL.
1. Startup database emrep on a-oem-2
echo $ORACLE_SID
sqlplus / as sysdba
STARTUP
exit

Startup the Listener
lsnrctl start

Start the Agent
cd /u01/app/oracle/product/10.2.0/em_1/agent10g/bin
./emctl status agent
./emctl start agent
./emctl status agent

2 . Start GRID CONTROL OMS on a-oem-1 -
Startup the Listener
lsnrctl start

cd /u01/app/oracle/product/10.2.0/em_1/oms10g/bin
./emctl status oms
./emctl start oms
./emctl status oms


3. START LOCAL GRID CONTROL AGENT on a-oem-1
cd /u01/app/oracle/product/10.2.0/em_1/agent10g/bin
./emctl status agent
./emctl start agent
./emctl status agent

Get back into OMS environment –
cd /u01/app/oracle/product/10.2.0/em_1/oms10g/opmn/bin
./opmnctl status
./opmnctl startall
./opmnctl status – to check status.

Check if agent is uploading to OMS from local grid agent home –

cd /u01/app/oracle/product/10.2.0/em_1/agent10g/bin
./emctl status agent

Oracle Enterprise Manager 10g Release 5 Grid Control 10.2.0.5.0.
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
Agent Version     : 10.2.0.5.0
OMS Version       : 10.2.0.5.0
Protocol Version  : 10.2.0.5.0
Agent Home        : /u01/oracle/product/grid/agent10g
Agent binaries    : /u01/oracle/product/grid/agent10g
Agent Process ID  : 1302690
Parent Process ID : 1839200
Agent URL         : https://prdu010.bankwest.com:3872/emd/main/
Repository URL    : https://prdu010.bankwest.com:1159/em/upload
Started at        : 2010-01-06 04:24:33
Started by user   : oracle
Last Reload       : 2010-01-06 04:29:31
Last successful upload                       : 2010-01-06 11:32:49
Total Megabytes of XML files uploaded so far :    45.29
Number of XML files pending upload           :        0
Size of XML files pending upload(MB)         :     0.00
Available disk space on upload filesystem    :    17.60%
Last successful heartbeat to OMS             : 2010-01-06 11:32:50
---------------------------------------------------------------
Agent is Running and Ready.



Trobleshooting Agent Startup and Upload - Pending Status on OEM
When OEM shows agent is down and "./emctl status agent" shows it's up, and last upload date is current, Oracle says it could be the agent keeps uploading the old status.
Do the following to clean up the situation. (SR Number  7072052.994 )
Check status of agent to make sure it's working fine:
./emctl status agent

If that is up and running, it looks like there is a "Communication Problem" between the Agent and the OMS. Steps to fix this issue:

For LINUX
1) Stop the agent
echo $AGENT_HOME
./emctl stop agent

2) Clean out below files:
rm $AGENT_HOME/sysman/emd/lastupld.xml
rm $AGENT_HOME/sysman/emd/agntstmp.txt
rm -r $AGENT_HOME/sysman/emd/state/*
rm -r $AGENT_HOME/sysman/emd/collection/*
rm -r $AGENT_HOME/sysman/emd/upload/*

3) Start the agent
./emctl start agent

4) Issue an agent clearstate from the agent home
./emctl clearstate agent

5) Check status of agent to make sure it's working fine
./emctl status agent

6) Force an upload to the OMS
./emctl upload

Wait for sometime and then logout and login back to Grid Control and now check the status of agent

For Windows
set AGENT_HOME=D:\oracle\product\10.2.0\em_1\agent10g
cd %AGENT_HOME%

emctl stop agent

del %AGENT_HOME%\sysman\emd\lastupld.xml
del %AGENT_HOME%\sysman\emd\agntstmp.txt

del %AGENT_HOME%\sysman\emd\upload\*.*
del %AGENT_HOME%\sysman\emd\state\*.*
del %AGENT_HOME%\sysman/emd/collection\*.*

cd %AGENT_HOME%\bin
emctl start agent
emctl status agent

If the Last successful heartbeat to OMS is not shown as successful, then secure the agent .
cd %AGENT_HOME%\bin
emctl secure agent

Make sure the password prompted for matches the OMS password - usually the sysman password for the OMS URL -
Once agent is secured -

emctl status agent
emctl start agent
emctl status agent