Tuesday, June 22, 2021

EM 12c/13c How to find out new discovered targets with SQL

 When agent is deployed to new host, or new targets is installed or created on existing hosts, Oracle Enterprise Manger (EM) Cloud Control can discover the targets automatically. However, EM does not promote the new discovered targets automatically.

Although, the new discovered targets can be found from EM console -> Setup -> Add Target -> Auto Discovery Results, many DBAs like command line to do that. It is more efficient and flexible.

Log into EM repository database as sysman, run following sql,
col entity_name for a20
col entity_type for a20
col host_name for a50
select entity_name,entity_type,host_name,
       decode (manage_status, 0, 'Ignored', 
                              1, 'Not managed yet', 
                              2, 'Managed', 
                              3, 'Managed target component',
                                 'Unknown') "Manage Status", 
       decode (promote_status, 0, 'Cannot promote (existence only entity)', 
                              1, 'Eligible for promotion', 
                              2, 'Promotion in progress', 
                              3, 'Promoted',
                                 'Unknown') "Promote Status"
from mgmt$manageable_entities
where promote_status=1;

Example output,
sysman@OEMR> col entity_name for a20
sysman@OEMR> col entity_type for a20
sysman@OEMR> col host_name for a50
sysman@OEMR>
sysman@OEMR> select entity_name,entity_type,host_name,
  2         decode (manage_status, 0, 'Ignored',
  3                                1, 'Not managed yet',
  4                                2, 'Managed',
  5                                3, 'Managed target component',
  6                                   'Unknown') "Manage Status",
  7         decode (promote_status, 0, 'Cannot promote (existence only entity)',
  8                                1, 'Eligible for promotion',
  9                                2, 'Promotion in progress',
 10                                3, 'Promoted',
 11                                   'Unknown') "Promote Status"
 12  from mgmt$manageable_entities
 13  where promote_status=1;

ENTITY_NAME   ENTITY_TYPE          HOST_NAME                Manage Status     Promote Status
------------- -------------------- ------------------------ ----------------- -------------
dbtest        oracle_database      host01.lab.dbaplus.ca    Ignored           Eligible for promotion
db02          oracle_database      host01.lab.dbaplus.ca    Not managed yet   Eligible for promotion

Two databases are discovered, dbtest is ignored because it was created for temporary testing purpose and does not need to be promoted, and db01 is candidate for promotion.

No comments: