Showing posts with label Grid Control. Show all posts
Showing posts with label Grid Control. Show all posts

Tuesday, 9 December 2014

Forced remove of targets from OEM repository


[oracle@Sunil -01 bin]$ ./emctl upload agent
Oracle Enterprise Manager 11g Release 1 Grid Control 11.1.0.1.0
Copyright (c) 1996, 2010 Oracle Corporation.  All rights reserved.
---------------------------------------------------------------
EMD upload error: Failed to upload file A0000001.xml: Fatal Error.
Response received: 500|ORA-20618: The specified agent is in the process of being                      deleted from the repository, wait for deletion to complete before restarting the agent.(agent name = Sunil.speechmachines.biz:3872)(agent guid = E16A                     7D58F0F8FF622D8F7DCDB885C540)

Initially I tried to clean up as like below But it didn't worked 

exec mgmt_admin.cleanup_agent('mq1-racs-dep-01.speechmachines.biz:3872');

You may receive below error while running “mgmt_admin.cleanup_agent”

ERROR at line 1:
ORA-20206: Target does not exist: Target1:3673'
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 846

ORA-06512: at line 1

After I tried below statement

execute sysman.mgmt_admin.delete_target_internal ('Sunil:3872','oracle_emd');


For Dynamic Sql for above one is :- 


select 'execute sysman.mgmt_admin.delete_target_internal ('''||target_name||''','''||target_type||'''); ' fro

m sysman.mgmt_targets_delete;

How to cleanup agent from GC 11g

Recently, I had have to clean up agents from  Em 11g, after deinstall procedure where agents resides,
 toy have to cleanup agents from Agents page in EM. How you can do this? It’s simple:

Step 1. Connect to OMS database at SYSMAN user.

Step 2. Locate name for agent and port:

select target_name from mgmt_targets where target_type='oracle_emd';

Step 3. Simple remove agent:

exec mgmt_admin.cleanup_agent('servername:3872');

In some cases I saw this:

*
ERROR at line 1:
ORA-20206: Target does not exist:
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 630
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 417
ORA-06512: at "SYSMAN.MGMT_ADMIN", line 1188
ORA-06512: at line 1

But re-run mgmt_admin.cleanup_agent help me, miracle :)