Shell script: database business monitoring
#! / bin/bash
# write a simple script first, and then use the script to call the stored procedure
# by: AsiaInfo-Zhang Yan
Export ORACLE_HOME=/opt/oracle/app/oracle_base/product/11.2.0/db_1
Export PATH=$ORACLE_HOME/bin:$PATH
# DATE_STR saves three values returned from the database: the year and month before 1 hour, the time string from 12 hours ago, and the current time string
DATE_STR= (`sqlplus-s username / password sysdate
And c.expire_date > sysdate
And c.effective_date < a.create_date
And c.create_dateTO_DATE ('${DATE_STR [2]}', 'YYYYMMDDHH24MISS')
Commit
Exit
Eof
Done
Echo "`date` this check is complete!"
Echo ""