Many times we have to cleanup some old targets from grid control. This happens because of host getting deprecated.
Example if you have database which was running on a host and is registered in grid. Because of scaling requirement you moved the database to bigger box. In that case you have to have agent installation done on new box and you have to remove old target from the grid.
Not doing this will make your grid stale with old data.
We can clean up grid from the Grid UI. Only problem with this approach is that this is time consuming.
When we have a database running on a host, its not just 1 target that agent discovers. We have multiple targets like host, database listeners etc. Deleting each target takes time.
Easiest approach for deleting the target is from backend database. We have grid database which stores complete grid information.
We can follow below steps to remove target from backend without using grid UI
1) Stop the management agent on the target database
% <AGENT_HOME>/bin/emctl stop agent
2) Log onto grid database (also called repository database) and search for target
SQL> select target_name from mgmt_targets where target_type = ‘oracle_emd’ and target_name like ‘<search_string>’;
This shows registered agents as per search string
3) Once you identify the target name, you below command to delete the target
exec mgmt_admin.cleanup_agent(‘<target_name>’);
Check the grid UI now for this target and you will not find it.
Hope this helps !!
Cool Tip…Very Nice…Keep it up!!!