I highly recommend the O'Reilly library of books for Perl.
"Walking on water and developing software from a specification are easy if
both are frozen."
Christopher R. Spence
Oracle DBA
Fuelspot
-----Original Message-----
Sent: Monday, July 30, 2001 10: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." <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
>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
>[EMAIL PROTECTED]
>
>
>
>#!/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: [EMAIL PROTECTED]
>
>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: [EMAIL PROTECTED] (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: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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: Christopher Spence
INET: [EMAIL PROTECTED]
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: [EMAIL PROTECTED] (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).