Friday, November 1, 2019

OEM Agent Timezone Change



On November 3, 2019 daylight saving time ends. If you are an on-call DBA, your phone will be going fiasco late at night with all the OEM alerts triggering at once. Keep the commands handy which will get you some sleep. Here I will be changing the timezone to America/New_York from a different timezone, you can edit it as per your environmental setup.

[oracle@sajidserver]$ Set the agent bash profile
[oracle@sajidserver]$ more /usr../config/emd.properties|grep agentTZRegion
agentTZRegion=US/Pacific
[oracle@sajidserver]$ emctl stop agent
[oracle@sajidserver]$ export TZ=America/New_York
[oracle@sajidserver]$ emctl resetTZ agent

It will give a detailed output, about what the next steps that need to be executed and from the OEM repository database.


[oracle@sajidserver]$ emctl start agent
[oracle@sajidserver]$ emctl upload agent
[oracle@sajidserver]$ emctl status agent

[oracle@sajidserver]$ more /usr../config/emd.properties|grep agentTZRegion
agentTZRegion=America/New_York

Now login into the OEM Repository database.

SYS>alter session set container=SAJID_PDB;
Session altered.

SYS>alter session set current_schema = SYSMAN;
Session altered.

SYS>exec mgmt_target.set_agent_tzrgn('<Hostname>:3872','America/New_York');
PL/SQL procedure successfully completed.

SYS>commit;
Commit complete.

Check the Timezone now in OEM Repository Database it might have been reflected.

SYS>select target_name, timezone_region from sysman.mgmt_targets where target_name='<Hostname>:3872';

TARGET_NAME        TIMEZONE_REGION
-----------        ---------------
<Hostname>:3872    America/New_York

Hopefully OEM alerts should get subsided after this :).