Using emctl.log File to Troubleshoot

The emctl.log file is a file that captures the results of all EMCTL commands you run. For Management Agent, the log file resides in the $AGENT_INSTANCE_HOME/sysman/log directory of the Management Agent, and for OMS, the log file resides in the $OMS_INSTANCE_HOME/em/EMGC_OMS<n>/sysman/log/ directory. The file is updated every time you run an EMCTL command. If your EMCTL command fails for some reason, access this log file to diagnose the issue.

For example, run the following command from the Oracle home directory of the Management Agent to check its status:

For Unix:

<agent_instance_home>/bin/emctl status agent

For Windows:

<agent_instance_home>\bin\emctl status agent

After running the command, navigate to the log directory to view the following information in the emctl.log file:

13809 :: 2024-12-03 07:54:26,158::Initializing the agent command locking system
13809 :: 2024-12-03 07:54:26,185::AgentLifeCycle.pm: Processing status agent
13809 :: 2024-12-03 07:54:26,185::AgentStatus.pm:Processing status agent
13809 :: 2024-12-03 07:54:28,608::AgentStatus.pm:emdctl status returned 3
13809 :: 2024-12-03 07:54:28,611::Cleaning up agent command lock
13809 :: 2024-12-03 07:54:28,611::AgentCommandLock:closed file handle of emctl lockfile

Here, the first column, that is, 1114306, is the PID that was used to check the status. The second column shows the date and time when the command was run. The third column mentions the Perl script that was run for the command. The last column describes the result of the command, where it shows the progress made by the command and the exit code returned for the command. In this case, the exit code is 3, which means that the Management Agent is up and running.

Similarly, for the OMS, you can run the following command from the Oracle home directory of the Management Service to check its status:

For Unix:

<OMS_HOME>/bin/emctl status oms

For Windows:

<OMS_HOME>\bin\emctl status oms

Example 7-1 Sample Log Content for OMS

2024-12-02 20:27:58,830 [main] INFO wls.OMSController - Executing emctl command : status
2024-12-02 20:28:05,023 [main] INFO commands.BaseCommand - Oracle Management Server is Up
2024-12-02 20:28:05,179 [main] INFO commands.BaseCommand - statusOMS message printed via new method for zdt apps.
2024-12-02 20:28:05,179 [main] INFO commands.BaseCommand - statusOMS finished with result: 0

In another example, run the following command from the Oracle home directory of the Management Agent to upload data:

For Unix:

<Agent_Instance_Home>/bin/emctl upload agent

For Windows:

<Agent_Instance_Home>\bin\emctl upload agent

After running the command, navigate to the log directory to view the following information in the emctl.log file:

14882 :: 2024-12-03 08:01:24,988::AgentLifeCycle.pm: Processing upload agent
14882 :: 2024-12-03 08:01:24,988::AgentStatus.pm:Processing upload agent
14882 :: 2024-12-03 08:01:26,801::AgentStatus.pm:emdctl status agent returned 3
14882 :: 2024-12-03 08:01:28,796::AgentStatus.pm:/u01/em/agt24/agent_24.1.0.0.0/bin/emdctl upload agent returned 0

Here, the entries are similar to the entries in the first example, but the exit code returned is 6, which means the upload operation is failing for some reason.

The exit codes returned depend on the emctl command executed. In general, exit code of zero means success and any exit code other than zero means failure. For details about the cause of failure, view the error message.