Scripts for finding errors Oracle/Unix

There are some ways which we can automate the things, either scripting or any realted tools. Here I have used some scripts for finding errors Oracle/Unix:

 

  • Below is the csh scripts to find out ORA- errors and get that errors triggered to your mail id:
#!/bin/csh
setenv MAILLIST="test@mail.com"
setenv EXEDIR $ORACLE_HOME/bin
setenv TRIGGER_MAIL /tmp/ora_errors.log
setenv LOG /tmp/ora_errors.log

#set alert file locaion as below, your environment may have different location
setenv ALERT_LOG /u01/oracle/diag/rdbms/db_name/trace/alert_dbname.log

#Connect to database for finding the path of alert log(this step jsu for knowing path of alert log):
${EXEDIR}/sqlplus -s /nolog < ${LOG}
connect / as sysdba
select value from v\$diag_info where name='Diag Trace';
EOF

grep -i ORA- $ALERT_LOG >>/tmp/ora_errors.log
cat $TRIGGER_MAIL | mailx -s "Errors detected in Alert Log for $ORACLE_SID" $MAILLIST
exit

 




  • Below csh script is to check Errors in SYSLOG file at OS level and get that errors trigger to mail id.
#Date in Format Current Day-Month-Year@Timing.
#!/bin/csh
setenv CURDATE `date "+%d-%m-%Y@%H:%M:%S"`
setenv LOG /home/testadm/test.log
setenv TRIGGER_MAIL /home/testadm/test1.log
setenv MAILLIST "mail_id@test.com"

#You can add any word you wanted to find in below egrep command, also below i have used to to tail last 100 lines 
#you can add any number as per your wish
tail -100 test.log | egrep -n "error|fail" > $TRIGGER_MAIL

#Check whether file is empty
if ( -z $TRIGGER_MAIL) then
 echo "Currently there is no errors upto $CURDATE in SYSLOG File" | mailx -s "NO Errors in SYSLOG File" $MAILLIST
 exit (1)
else
  cat $TRIGGER_MAIL | mailx -s "Errors detected nearly at $CURDATE in SYSLOG File" $MAILLIST
endif
Please share If you like..Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInShare on Yummly

35 Comments

Add a Comment
  1. Hello, everything is going perfectly here and ofcourse every one is sharing information, that’s really fine, keep
    up writing.

  2. Appreciation to my father who told me on the topic of this blog, this website is
    really amazing.

  3. wonderful submit, very informative. I wonder why the opposite specialists of
    this sector don’t understand this. You should proceed your writing.
    I am confident, you’ve a huge readers’ base already!

  4. Hello there! This blog post could not be written much better!

    Reading through this article reminds me of my previous roommate!
    He always kept preaching about this. I will send this post to him.
    Fairly certain he’s going to have a very good read.
    I appreciate you for sharing!

  5. I loved the way you discuss the topic great work thanks for the share Your informative post.

  6. Yours is a clever way of thikinng about it.

  7. That’s 2 clever by half and 2×2 clever 4 me. Thksna!

  8. Thanks for sharing such a good opinion, article is nice, thats why i have read
    it entirely

  9. Really very happy to say,your post is very interesting to read.I never stop myself to say something about it.You’re doing a great job.Keep it up

  10. Your style is so unique in comparison to other folks I have read
    stuff from. Many thanks for posting when you have the opportunity, Guess I will
    just bookmark this site.

  11. I know this if off topic but I’m looking into starting
    my own weblog and was curious what all is required to get set up?
    I’m assuming having a blog like yours would cost a pretty penny?
    I’m not very web smart so I’m not 100% positive. Any recommendations or advice would be greatly appreciated.
    Thank you

    1. Take good theme and always update the content which mostly users not find on other blog …also yes your are right during startup you have to spend pretty penny

  12. Very soon this web site will be famous among all blog visitors,
    due to it’s fastidious posts

  13. “Greetings! Very helpful advice within this post! It is the little changes which will make the greatest changes. Thanks for sharing!”

  14. Im grateful for the article post. Cool.

  15. Well I definitely enjoyed reading it. This article procured by you is very practical for correct planning.

  16. “You made some good points there. I did a search on the subject and found most persons will go along with with your website.”

  17. “I loved up to you will receive performed right here. The article is delightful tasting, your very own authored subject is terrific.”

  18. Muchos Gracias for your blog.Really looking forward to read more. Much obliged.

  19. Im obliged for the article post.Much thanks again. Awesome.

  20. I truly appreciate this blog article.Really thank you! Cool.

  21. Muchos Gracias for your blog article.Really thank you! Keep writing.

  22. I appreciate you sharing this article.Thanks Again. Want more.

  23. I really liked your post.Really thank you! Keep writing.

  24. I have to express my appreciation to this writer just for rescuing me from this type of instance. Right after looking out through the the web and coming across tips that were not beneficial, I was thinking my life was well over. Living minus the answers to the issues you’ve fixed all through the posting is a crucial case, as well as the kind that could have in a negative way damaged my entire career if I had not come across your blog post. Your good understanding and kindness in touching every aspect was priceless. I am not sure what I would’ve done if I had not come upon such a subject like this. I can at this point look forward to my future. Thanks a lot so much for your reliable and sensible help. I won’t hesitate to refer the blog to anybody who will need support on this problem.

  25. I want to point out my appreciation for your kindness in support of men and women that require help on this niche. Your very own dedication to getting the message all around became exceptionally valuable and have always enabled professionals much like me to arrive at their desired goals. The invaluable tutorial entails this much to me and still more to my peers. With thanks; from all of us.

  26. Hi there, just became aware of your blog through Google, and found that it’s really informative.
    I am going to watch out for brussels. I’ll be grateful if
    you continue this in future. Many people will be benefited from your writing.
    Cheers!

  27. This blog was… how do I say it? Relevant!!
    Finally I’ve found something that helped me. Thank you!

  28. I really enjoy the article post.Really thank you! Keep writing.

Leave a Reply

Your email address will not be published. Required fields are marked *

Fariddin Shaikh's Oracle DBA Blog © 2016 Being DBA
Go Back