With default regular expression warning =ORA-0* Critical=ORA-0*. This will create all ORA-* errors from alert log file as critical alerts to avoid that ORACLE suggested use to regular expression to build you own expression based on the database behavior. If your environment is huge number databases then it is so painful to change in the monitoring templates, apply to all databases and test it. To avoid these ORACLE provide the perl script to test you regular expression and test through the command line.

##!/bin/perl

## Source : ORACLE MSO

##Title:alerthd12c.pl

##Author: Sandeep Narani 

my ($filter_expression, $warning_threshold, $critical_threshold,$error)=@ARGV;

if ($error =~ /$filter_expression/ && $filter_expression ne "" ) {

print "The error would not be collected by the Alert Log Metric as it would be filtered\n";

} elsif ($error =~ /$critical_threshold/ && $critical_threshold ne "") {

print "This error would raise a Critical Alert\n";

} elsif ($error =~ /$warning_threshold/ && $warning_threshold ne "") {

print "This error would raise a Warning Alert\n";

} else {

print "This line will not raise an alert\n";

};

Filter log Expression .*ORA-0*(20011|20000|29400|3136|0060)\D.*
Warning NULL
Critical ORA-0*(600?|7445|54|1142|1146|27300|27301|27302|603|4030|4031|227
|239|240|255|353|355|204|206|210|257|345|485|440|1578|1135|162|165|4031|3113|356
|445|494|1578|3113|3137|4036|24982|25319|29740|29770|29771|32701|32703|32704
|56729|3106|01001|02050|03150|02063|4[0-9][0-9][0-9])[^0-9]

Script Execution

Perl alerthd12c.pl “.*ORA-0*(3136|0060)\D.*” “ “ “ORA-0*(600?|7445|54|1142|4[0-9][0-9][0-9])” “ORA-00600: TEST”
 This error would raise a Critical Alert

perl alerthd12c.pl “.*ORA-0*(3136|0060)\D.*” “ “ “ORA-0*(600?|7445|54|1142|4[0-9][0-9][0-9])” “ORA-00060: TEST”
 This error would not be collected by the Agent Log Metric as it would be filtered

perl alerthd12c.pl “.*ORA-0*(3136|0060)\D.*” “ “ “ORA-0*(600?|7445|54|1142|4[0-9][0-9][0-9])” “ORA-3136: TEST”
 This error would raise a Warning Alert
Note: We can’t make deadlock alert has warning since the oracle error is 00060 to capture the 00600 errors regular expression should be ORA-0*(600?) so here it automatically takes 00060 error has critical alert which is not necessary so you can use filter expression to avoid the deadlock.

Leave a comment