cancel
Showing results for 
Search instead for 
Did you mean: 

DB monitor script

SOLVED
Go to solution
Arturo Galbiati
Esteemed Contributor

DB monitor script

Hi mates,
I need to put in place a script to monitor:
1. if the databse is up and running
2. if the listener is up and running
3. to how tablepscae over a passed percentage
I go back to perform some DBA activities and I'm quite rusty with new feature in 9i as lke as autoextend and so on.
Someone do already have something?
TIA.
Happy 2007!
Art
4 REPLIES
Peter Godron
Honored Contributor

Re: DB monitor script

Art,
you don't state your preferred solution (shell,perl,C etc...) or database type (Oracle, Sybase...), so here a few starters:

1. and 2. http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=813741

3.
You can modify:
http://www.oracle.com/technology/oramag/code/tips2006/050106.html
or
http://forums.oracle.com/forums/thread.jspa?messageID=1475295
Oviwan
Honored Contributor

Re: DB monitor script

Hy

1:
check wheter the db is down:
ps -ef | grep ora_pmon_${ORACLE_SID}$
otherwise
select status from v$instance

2:
lsnrctl status

3:
i wouldn't look for the percentage. the difference of a 100MB tablespace and a 200GB tablespace is too much if you look for the percentage. i have a query with section --> see attachement

Regards
spex
Honored Contributor
Solution

Re: DB monitor script

Hi Arturo,

1) # cat check_pmon.sh
#!/usr/bin/sh
[[ -z "$(UNIX95= ps -C ora_pmon_ -o pid=)" ]] && mailx -m -s "ora_pmon_ is not running!" your@email.addr < /dev/null
exit 0

2) # cat check_pmon.sh
#!/usr/bin/sh
[[ -z "$(UNIX95= ps -C tnslsnr -o pid=)" ]] && mailx -m -s "tnslsnr is not running!" your@email.addr < /dev/null
exit 0

3) See 'free.sql' located on this page:
http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:438818052470

PCS
Arturo Galbiati
Esteemed Contributor

Re: DB monitor script

thanks for your contribution