Sunday, May 22, 2011

How to reset time zone of management agent due to inconsistency of time zones

While installing the Management Agent, the Oracle software attempts to obtain the current time zone from the host computer. If successful, the installation procedure updates the agentTZRegion property setting in the $AGENT_HOME/sysman/config/emd.properties configuration file.

The agentTZRegion property can be set to any of the values listed in the $AGENT_HOME/sysman/admin/suportedtzs.lst file, which is installed in the Management Agent home directory.

In fact you need to reset the time zone of the Management Agent when both of the following situations are true:

1) The Management Agent has been running with a particular time zone.
2) Subsequently a change occurs to the time zone of the host where the Management Agent is running.

In order to propagate the time zone changing information to the emd.properties file you need to do following:

1) $ $ORACLE_HOME/bin/emctl resetTZ agent
This script updates $ORACLE_HOME/sysman/config/emd.properties so that the value of agentTZRegion matches that of the current time zone setting of the machine.

Note that, the location of the emd.properties file depends on the Control Console being used.
For the Database Control Console, the location is: $ORACLE_HOME/<host>_<sid>/sysman/config

For the Application Server Control Console, the location is: $ORACLE_HOME/sysman/config

For the Grid Control Management Agent, the location is: $ORACLE_HOME/sysman/config

For the Real Application Cluster central Management Agent, the location is: $ORACLE_HOME/<host>/sysman/config

2) Next, run the script mgmt_target.set_agent_tzrgn as SYSMAN user.

SQL> exec mgmt_target.set_agent_tzrgn('hostname','Africa/Cairo');
Note that you have to use your machine hostname instead of hostname here and instead of Africa/Cairo you have to enter your time zone.

SQL> commit;
SQL> exit


Sometimes, during the Management Agent installation, the time zone detected by the Management Agent configuration tool is not recognized by the Management Agent. In other words, the time zone obtained by the configuration tool is not listed in the Management Agent list of supported time zones.

In this scenario, we will get the following error message:
Could not determine agent time zone. Please refer to the file:
ORACLE_HOME/sysman/admin/supportedtzs.lst and pick a timezone region with a
standard offset of +5:0 from GMT and update the property 'agentTZRegion' in the
file: ORACLE_HOME/sysman/config/emd.properties


If you are using Grid Control Console then look for the Time Zone error in the file emagent.nohup

If you are using Application Server Control Console then look for the Time Zone error in the file em.nohup

If you are using Database Control Console then look for the Time Zone error in the file emdb.nohup

To configure the Management Agent to use a valid time zone do the following:

1) Enter the following command in the Management Agent home directory to identify the time zone currently being used by the host computer:

$AGENT_HOME/bin/emctl config agent getTZ

2) Note the time zone that is returned by the emctl config agent getTZ command. This is the time zone of the host computer.

3) Use a text editor to open the following file in the Management Agent home directory:
$AGENT_HOME/sysman/admin/supportedtzs.lst
This file contains a list of all the time zones supported by the Management Agent.

4. Browse the contents of the supportedtzs.lst file and note the supported time zone closest to the time zone of the host computer.

5. Use a text editor to open the following Management Agent configuration file:
$AGENT_HOME/sysman/config/emd.properties

6. Locate the following property near the end of the emd.properties file:
agentTZRegion=

7. Set the value of this property to the time zone you identified as closest to the host time zone in the supportedtzs.lst file.

For example:
agentTZRegion=Asia/Decca
or,
agentTZRegion=GMT-7

8. Save your changes and close the emd.properties file.
You should now be able to start the Management Agent without generating the error in the log file.