Saturday, February 12, 2005

Quick Howto

Download the latest release and uncompress on your unix oracle account home directory. Put all the files in the same directory (/home/oracle/OraAlertCheck for example).

Rename OraAlertCheck_config.sh.sample to OraAlertCheck_config.sh. Edit the file and change the variables to suit your needs. It's important to set the WORKDIR to where the scripts are located.

OraAlertCheck look for your instances on /etc/oratab by default, so if this does not exists you should create it or link it to the real path.

Check to see if the script can find your alert.log files running:
$ ./OraAlertCheck.sh test

You should see the ORACLE_SID followed by the alert.log path. If you can't and you discover a bug in the program, let me know, if it does then skip to the next paragraph. The script connects to the database "/ as sysdba" to get the value of the background_dump_dest parameter (where alert_SID.log file should be). Sometimes this parameter has characters like "?" to indicate the ORACLE_HOME. Be sure to have the full path there.

Now that the log file was found you can run the script with no parameters. NOTE: Since it's the first time, it will run through all your log file and email you with a lot of errors. The script will generate a hidden file where it will set the current line number so next time it will start just where it finished.

If all worked fine, you can add the script to your crontab, every five minutes should be fine.

The script needs some work yet so please don't hesitate to send me your opinions.

NOTE: We need your help!!! In order to develop a good error detection we need every DBA using this script to send new errors that the script does not have. So please send us every error you find! You can email me to newalertlogerrors (at) jluis.com.ar

6 comments:

Anonymous said...

Jose,

My name is Raghu, Oracle DBA working in California, USA. As i am planning to automate this alerting jon on alert log file I found this link and found looks promising because you mentioned it will maintain couple of files to track how many lines the script processed for continuation purpose which is very cool. Because the script checks only last "n" lines of alert log file ( of course we can the change the value of "n" in the script if we prefer).

Now coming to your script. Here is my input:

We are using Sun Solaris and Oracle 9i/10g. I downloaded your the script and unzipped. Initially it has given few problems with awk command level then I implemented following changes then found it went well.
--------------------------------
Then edit the configure script

search for 'awk'

remove the space between the -F and the '.' like this:

-F'.'

then save and run the ./configure script again.
--------------------------------

Secondly, I found some issues with "v\\\$" after replacing "\\\" with "\" even those errors gone.

Then i tested the script by passing "test" as input then it displayed appropriate SID and its background_dump_dest. So far everything looks good.

Finally, when I am running the script with passing any value like ". ./OraAlertCheck.sh" it generated ".alert_pilot1.curline" in the current directory and contains the only number ( I understand it scanned/processed upto this line) but it didn't send any mail and more over it has given following errors :
-----------------------------------
usage: tail [+/-[n][lbc][f]] [file]
tail [+/-[n][l][r|f]] [file]
-----------------------------------

So, please let me know what you want me do ? if you are using the same script still.

Thanks for sharing your knowledge with others.

Have a wonderful day.

regds
Raghu
rnraomaddula@yahoo.com

Jose Canciani said...

Hello Raghu, nice to receive some feedback. It's been several years since I don't modify the script... I was using it on HPUX, so that's probably why it has so many issues in Solaris.

I've stopped using it becouse in my new jobs I had since then was not necesary. Whats more in 10g there is a view where you can see each line of the alert.log as a row of the view.

Anyway, I can test it in Solaris and review your comments if you want to use it. It can be improved a lot, and has several advantages over a view (if database is down, the view won't help much, right? :)

Another insteresting thing is the customize of behaviour for each error, which allows to bypass common know errors... And also customize the error text send, which would be a great help for the dbas if other dbas contribute with some more errors...

About you don't receiving mails, there is a mail funcion I gthink, you could try the function alone and see.

I'll give it a shot as soon as I have time in a Solaris box. Now that you write maybe I start working and using it again.

Regards,
Jose.

Anonymous said...

I have the problem:

bash-2.05b$ ./OraAlertCheck.sh test
Detected comqas but it won't be checked (becouse oratab startup is disabled)

Any sugestions?
Pablo Quadros
pqaudros@gmail.com

Jose Canciani said...

Edit your oratab file and change the automatic startup to Y (you should have a line like this: "comqas:/path/to/your/orahome:N", so just change N to Y.
You can use the mailing list for this questions too, more people could answer.
Jose.

Anonymous said...

Hi Jose, I don't know if this blog is active yet. Anyway, I have a question. I don't have sendmail in my server (Solaris), so I have to use mailx instead of that. Where can I replace in the files that you were provide us ??
thanks a lot

Jose Canciani said...

After renaming the sample config file to OraAlertCheck_config.sh, you can edit it. This is the variable you need to change:

export SENDMAIL_COMMAND="/usr/sbin/sendmail -t -oi"

Change for any command that will accept a full raw email text (probably mailx accepts them somehow).

I have not used this script for years, but anyone is welcome to improve it in Google Code. There's a project there anyone can fork or better request access to improve it.