18 June 2019

OEM repository commands


OEM13c occasionally leaves orphaned alerts or targets in suspended mode, that clearstate can't remove.  After some investigation, I've created and used these commands for few years, and they are working well.  

Get targets out of suspended mode

select * from sysman.em_current_availability  where current_status in (4,5,6) and SEVERITY_GUID is not null;
update sysman.em_current_availability set CURRENT_STATUS=1,SEVERITY_GUID=null  where current_status in (4,5,6) and SEVERITY_GUID is not null;

Clear up orphaned alerts

col msg for a50
select TARGET_GUID, EVENT_SEQ_ID, msg, REPORTED_DATE,CLOSED_DATE  from sysman.GC$EVENTS where event_seq_id in (select event_seq_id from sysman.EM_EVENT_SEQUENCES_E where open_status=1 and msg like '%&msg_text%');
update sysman.EM_EVENT_SEQUENCES_E set open_status=0, closed_date=sysdate, severity=0, prev_severity=16 where (TARGET_GUID = '&target_id' or  EVENT_SEQ_ID='&event_seq_id' ) and open_status=1; 
--or
update sysman.EM_EVENT_SEQUENCES_E set open_status=0, closed_date=sysdate, severity=0, prev_severity=16 where open_status=1 and event_seq_id in (select EVENT_SEQ_ID from sysman.GC$EVENTS where event_seq_id in  (select event_seq_id from sysman.EM_EVENT_SEQUENCES_E where open_status=1 and msg like '%&msg_text%'));





Labels:


Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?