Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-03-2011, 12:21 AM   #1
LQ Newbie
Registered: Mar 2011
Posts: 2

Rep: Reputation: 0
Oracle - Reading alert log file.

Hi All,

My requirement is that I wanted a shell script which should read the alert.log(oracle) and should send the alert to my email if any error encountered on daily basis.
Note: I have a script which does the same job but at the same time it creates a new alert.log whenever any error occur. But I don't want the new alert log I wanted to read the same alert log daily and if any new error come should alert as email.
Old 03-03-2011, 01:36 AM   #2
LQ Guru
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
Oracle Enterprise Manager has that capability built-in.

A Google search turned up lots of alternatives, including these:

And worst case, you can simply write a quick'n'dirty script that does a "grep | diff" of your alert log.
Old 03-03-2011, 05:11 AM   #3
LQ Newbie
Registered: Mar 2011
Posts: 2

Original Poster
Rep: Reputation: 0



#get the errors out of the logfile.
grep -hw "$ALERT" $LOGFILE >> $MYFILE

#count number of lines in myfile, and print.
VAR=`wc -l $MYFILE | awk -F" " '{print $1}'`
echo $VAR

# if the amount of lines is greater than 0, then cat the file and send it to me. if not then echo all clear.

#size variable is the number of errors the last time the script ran
cd /opt/app/oracle/admin/TECHDATA/bdump/
size=`wc -l ora_error.last | awk -F" " '{print $1}'`
echo $size

# if the amount of lines is greater than 0, then cat the file and send it to me. if not then echo all clear

if [[ $VAR -gt $size ]]; then

cat $MYFILE | mail -s "Oracle Error - Following Error Occured" "" ;

cd /opt/app/oracle/admin/TECHDATA/bdump/
echo `date` >> alert_check_dump.log
echo "All is Well" >> alert_check_dump.log


cd /opt/app/oracle/admin/TECHDATA/bdump/
rm ora_error.last
mv ora_error.log ora_error.last
touch ora_error.log

Note: I am interested to see only the new error each time I run the script. But this does not does the entire error .

Last edited by myounusn; 03-03-2011 at 05:18 AM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
oracle alert log script dxangel Programming 17 12-28-2014 07:27 AM
[SOLVED] Need some help reading part of a log file agangsto Linux - General 5 07-09-2010 03:14 AM
Reading a CSV text file and storing the values in Oracle Database table shafi2all Linux - Newbie 3 04-17-2008 01:19 PM
Log file reading Garak Linux - General 5 07-08-2003 07:55 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration