Monday, August 22, 2011

Simple shell scripts for periodical monitoring of db status

  Simple shell scripts for periodical monitoring of db status

All you need is to write 2 shell scripts ...
This is the main file containing commands to connect to the db and run SQL Query :



bash-3.00$ cat check2.sh
#!/usr/bin/ksh


#-- Execute the SQL
sqlplus system/oracle <<+ENDOFSQL+
select * from v\$instance;

select name,open_mode from v\$database;
exit
+ENDOFSQL+

exit 0
============= Then call this file periodically from another shell script ( below) ============


cat check_loop2.sh
while true
do
./check2.sh
sleep 10
done

No comments:

Post a Comment