Get the App
SLTechnology News&Howtos  ›  Database  › 

Shell script: database business monitoring

Shulou Source: shulou.com Published: 2022-06-01 09:09:51 10月03日 Update

#! / 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 ""

Tags: Program control data function password hour user user name business script time database monitoring three history month process AsiaInfo enter one store query Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Redmi Shulou Tech Info Xiaomi MySQL NVidia