Feb 12, 2018

Clearing Stateless Alerts in OEM 12c/13c using EM CLI

Here I will explain how to check /to see if you have alerts that can be cleared with an EMCLI command and then also take you through clearing out from the GUI, which is available in the OEM 12cR2/13c.

If you want to know what kinds of stateless alerts that can be cleared manually, then once logged into the EMCLI, (Enterprise Manager Command Line Interface) you can do the following:

./emcli login -username=<login name>
./emcli get_metrics_for_stateless_alerts  -target_type=osm_instance

$ emcli get_metrics_for_stateless_alerts  -target_type=osm_instance
Metric                                    Metric Internal Name                    
=======                                   =====================                   
Archive Hung Error Stack                  osm_instance:db_alert_log:archiveHungErrStack 
Data Block Corruption Error Stack
osm_instance:db_alert_log:blockCorruptErrStack
Alert Log Error Stack
osm_instance:db_alert_log:genericErrStack
Media Failure Error Stack
osm_instance:db_alert_log:mediaFailureErrStack
Session Terminated Error Stack
osm_instance:db_alert_log:sessTerminateErrStack
Archive Hung Error Stack
osm_instance:alertLog:archiveHungErrStack
Data Block Corruption Error Stack
osm_instance:alertLog:blockCorruptErrStack
Alert Log Error Stack
osm_instance:alertLog:genericErrStack
Media Failure Error Stack
osm_instance:alertLog:mediaFailureErrStack
Session Terminated Error Stack
osm_instance:alertLog:sessTerminateErrStack
Checker Failure Detected
osm_instance:adrAlertLogCheckerFailure:genericCheckerFailureErrStack
Access Violation
osm_instance:adrAlertLogIncidentError:accessViolationErrStack
ASM Block Corruption
osm_instance:adrAlertLogIncidentError:asmBlockCorruptionErrStack 
Cluster Error
osm_instance:adrAlertLogIncidentError:clusterErrStack 
Deadlock
osm_instance:adrAlertLogIncidentError:deadlockErrStack
File Access Error
osm_instance:adrAlertLogIncidentError:fileAccessErrStack
Generic Incident
osm_instance:adrAlertLogIncidentError:genericIncidentErrStack
Generic Internal Error osm_instance:adrAlertLogIncidentError:genericInternalErrStack 
Internal SQL Error
osm_instance:adrAlertLogIncidentError:internalSqlErrStack
Out of Memory
osm_instance:adrAlertLogIncidentError:outOfMemoryErrStack
Redo Log Corruption osm_instance:adrAlertLogIncidentError:redoLogCorruptionErrStack 
Session Terminated
osm_instance:adrAlertLogIncidentError:sessTerminateErrStack
Last Read Errors
osm_instance:Instance_Disk_Performance:last_read_errs
Data Block Corruption osm_instance:adrAlertLogOperationalError:dataBlockCorruptionErrStack
Generic Operational Error osm_instance:adrAlertLogOperationalError:genericOperationalErrStack
Media Failure
osm_instance:adrAlertLogOperationalError:mediaFailureErrStack
$

This command will return all metric types and alert types that can be cleared out for ASM alerts, (osm_instance).  You can do this for oracle_database or any of the other target_types.

As always, if you need help, EMCLI offers a good help option.  You can save off the file for reference and then gather more help info on specific verbs by doing the following:

-- creates the output file of the emcli verbs and descriptions.
./emcli help > emcli_verbs_help.txt
--gives you a descriptions, syntax and examples for a specific verb.
./emcli help <verb>  

If you aren’t sure of Target Type names, you can query the database or you can do wild card searches through the EMCLI:

./emcli get_targets -targets=%database% -- List all databases
./emcli get_targets -targets=%rac_database% -- List all RAC databases
./emcli get_targets -targets=%osm% -- List osm instances
./emcli get_targets -targets=% -- List all type of targets

This first option above returns a list of all targets that are database type targets.  The second returns all ASM targets and the third returns everything.  Some of the output from the third looks like the following:

ID      Status           Target Type           Target Name
0       Down             oracle_listener       LISTENER_SCAN2_exa1-cluster
1       Up               oracle_oms            oemdb.testdb.com:48
1       Up               oracle_oms_console    oemdb.testdb.com:48 
1       Up               oracle_oms_pbs        oemdb.testdb.com:48
1       Up               oracle_database       testdb_db3.world_testdb2
1       Up               oracle_database       testdb_db4.world_testdb1
1       Up               osm_cluster           +ASM_exa1-cluster
1       Up               osm_cluster           +ASM_exa1-cluster
1       Up               osm_instance          +ASM1_exa1db01.testdb.com

Before attempting to run a clearstate on incidents, lets look at how to check for these.Note that we use two arguments here with the clear_stateless_alerts verb:

Unacknowledged_only–  Only those alerts that have not been acknowledged, which helps distinguish from any that may be currently worked by someone.
Preview –  I want to just check and see how many are available to be cleared.  The command will not clear anything this way, only tell me how many!

$ ./emcli clear_stateless_alerts -older_than=0 -target_type=oracle_database -target_name=<target name> -unacknowledged_only -ignore_notifications -preview

e.g,
$emcli clear_stateless_alerts -older_than=0 -target_type=oracle_database -target_name=TESTDB -unacknowledged_only -ignore_notifications -preview
The following alerts can be cleared:

Total Alerts
==============
1
$

Now, if you want to clear the one alert that is available to be cleared as stateless, you can:

$  ./emcli clear_stateless_alerts -older_than=0 -target_type=oracle_database -target_name=<target_name>

e.g.,
$emcli clear_stateless_alerts -older_than=0 -target_type=oracle_database -target_name=TESTDB

1 alerts were cleared successfully.
$

if no alerts available, then following message will come:

$ emcli clear_stateless_alerts -older_than=0 -target_type=oracle_database -target_name=TESTDB

 No alert found.
$

Now if you have a huge quantity of alerts that are not available for clearing with this process, the EM12c/13c console Incident interface offers the ability to mass clear alerts in release 2,
From the EM12c/13c console, there are a number of ways to access alerts, via the Incident Manager from the Enterprise drop down or from a database target summary page, but for this example, we will work from groups.

By clicking on All Targets, then Groups, we are brought to the groups summary page.

Remember-  Any incidents that are still an incident and need attention will recreate on the next metric collection for the target.


No comments:

Post a Comment

Translate >>