Cleanup agent of Cloud Control 12c from SQL

Cleanup of agent from cloud control is necessary when the installed agent is not available any more, In my case i used virtual machines and after the installation of agent performed flashback to old snapshot of the oracle virtual box feature but the target information will be still available in OMS.  In order to cleanup there are may ways i.e. using emcli and also command prompt(SQL).

agent unrechable

 

 

 

In order to clean up you may consider emcli to use attributes “delete targets”, but from SQL prompt also it looks me more easier to clean up with just single command.

SQL> select target_name from mgmt_targets where target_type='oracle_emd';
TARGET_NAME
--------------------------------------------------------------------------------
192.168.0.120:3872
oradb01.ckpt.com:3872
SQL>

Please note that, when you run below command first time it may ends with error then retry again with same command.

SQL> exec mgmt_admin.cleanup_agent('192.168.0.120:3872');
PL/SQL procedure successfully completed.
SQL> select target_name from mgmt_targets where target_type='oracle_emd';
TARGET_NAME
--------------------------------------------------------------------------------
oradb01.ckpt.com:3872
SQL>

After confirming whether target is removed or not by using mgmt_targets, you may logout and login to cloud control to check whether still agent is viewable or not.

agent removed

 

 

 

 

Now agent is not available any more.