Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> RE: Perl Script for Alert Log

RE: Perl Script for Alert Log

From: Smith, Ron L. <rlsmith_at_kmg.com>
Date: Tue, 31 Jul 2001 06:00:55 -0700
Message-ID: <F001.00359E03.20010731054114@fatcity.com>

The book is "Teach yourself Perl in 21 days" It's is written so anyone can understand it. The book was first published in 1996 and is out of print but I found it at www.AllBooks4Less.com for $11.99. The original price was $39.95. Our company has bought at least 6 of the books.

Ron

-----Original Message-----
Sent: Monday, July 30, 2001 9:00 PM
To: Multiple recipients of list ORACLE-L

Ron,

thanks for the script, but what was the name of the book that taught you this!

Rachel

>From: "Smith, Ron L." <rlsmith_at_kmg.com>
>Reply-To: ORACLE-L_at_fatcity.com
>To: Multiple recipients of list ORACLE-L <ORACLE-L_at_fatcity.com>
>Subject: Perl Script for Alert Log
>Date: Mon, 30 Jul 2001 13:50:29 -0800
>
>A few weeks ago I was looking for a script that would combine the date
>records with the detail records on the Oracle alert_log.
>I didn't get any responses so I decided to do it myself. (I hate it when
>that happens!). Anyway, everyone here tells me how great
>Perl is at handling things like this so I bought a book and wrote a short
>Perl script. The book was great and the script does what
>it was supposed to do so I thought I would pass it along. Please don't
>critisize my poor coding. It works!
>
>The perl script is actually called by another script that looks in
>/etc/oratab and figures out where the OORACLE_BASE and thus
>the alert_log is located. The script combines the records into an output
>file and then returns control to the calling program. The
>calling program does a grep on the combined records looking for ORA, etc...
>errors and sends an email if they are found.
>
>Hope someone else can use this.
>
>Ron Smith
>Database Administrator
>rlsmith_at_kmg.com
>
>
>
>#!/usr/local/bin/perl
>$eNV{"PATH"} = "/bin:/usr/bin:/usr/local/bin"; # for security
>reasons
>$ENV{"SHELL"} = "/usr/bin/sh";
>
>$inlog = $ARGV[0];
>shift(@ARGV);
>$sid = $ARGV[0];
>
>unless (open(LOGOUT, ">$sid.temp.alert.log")) {
> die ("Cannot open output log file\n");
> exit 8;
>}
>
>if (open(LOGIN, "$inlog")) {
> $line = <LOGIN>;
> $dateline = "No Date";
> $sdateline = "No Date";
> while ($line ne "" ) {
> $abbrev = substr ($line, 0, 3);
> if ($abbrev eq "Mon") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Tue") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Wed") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Thu") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Fri") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Sat") {
> $dateline = $line;
> $sdateline = $line;
> } elsif ($abbrev eq "Sun") {
> $dateline = $line;
> $sdateline = $line;
> } else {
> select (LOGOUT);
> $~ = "OUTREC";
> write;
> }
> $dateline = $sdateline;
> $line = <LOGIN>;
> $abbrev = " ";
> }
>}
>
>format OUTREC =
>^<<<<<<<<<<<<<<<<<<<<<<<<
>^<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
<
><<<<<<<<<<
><<<<<<<<
>$dateline $line
>.
>exit 0
>
>--
>Please see the official ORACLE-L FAQ: http://www.orafaq.com
>--
>Author: Smith, Ron L.
> INET: rlsmith_at_kmg.com
>
>Fat City Network Services -- (858) 538-5051 FAX: (858) 538-5051
>San Diego, California -- Public Internet access / Mailing Lists
>--------------------------------------------------------------------
>To REMOVE yourself from this mailing list, send an E-Mail message
>to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
>the message BODY, include a line containing: UNSUB ORACLE-L
>(or the name of mailing list you want to be removed from). You may
>also send the HELP command for other information (like subscribing).



Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Rachel Carmichael
  INET: carmichr_at_hotmail.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: Smith, Ron L.
  INET: rlsmith_at_kmg.com

Fat City Network Services    -- (858) 538-5051  FAX: (858) 538-5051
San Diego, California        -- Public Internet access / Mailing Lists
--------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: ListGuru_at_fatcity.com (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).
Received on Tue Jul 31 2001 - 08:00:55 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US