• 通过CONTRAB 执行脚本进行监控


    切换到ORACLE执行SH的脚本

    root@tha11db1:~# crontab -l
    #ident "%Z%%M% %I% %E% SMI"
    #
    # Copyright 2007 Sun Microsystems, Inc. All rights reserved.
    # Use is subject to license terms.
    #
    # The root crontab should be used to perform accounting data collection.

    01 1 * * * su - oracle "/u01/backup/scripts/monscript.sh"

    编写SH文件

    /u01/scripts/script.rcv >/u01/scripts/script.log

    .rcv文件

    echo '/u01/app/oracle/diag/rdbms/*/trace/alert_*.log
    '
    tail -500 /u01/app/oracle/diag/rdbms/*/trace/alert_*.log
    echo ' '
    echo '集群警告文件crsd.log '
    echo '==============================================================='
    echo '/u01/app/crs_home/log/*/crsd/crsd.log'
    tail -100 /u01/app/crs_home/log/*/crsd/crsd.log
    sqlplus -s /nolog<<EOF
    conn / as sysdba
    @script.sql
    exit
    EOF

    编写查询.SQL,这里就根据需要执行的语句自行编写就好了。

    oracle@tha11db1:/u01/scripts$ more script.sql

    host echo ' '
    host echo '数据库状态'
    host echo 'select name,log_mode,open_mode from v$database;'
    select name,log_mode,open_mode from v$database;
    host echo ' '
    host echo '数据库登陆记录数量trial_login'
    host echo 'select count(0) from trial_login;'
    select count(0) from trial_login;
    host echo ' '

  • 相关阅读:
    HTTP概述
    【HTTP权威指南】第二章URL与资源
    【HTTP权威指南】第三章HTTP报文
    列表生成式
    六一问候
    NYOJ 528 找球号(三)
    NYOJ 138 找球号(二)
    HDU3790 最短路径问题
    NYOJ 228 士兵杀敌(五)
    NYOJ3 3 多边形重心问题
  • 原文地址:https://www.cnblogs.com/druck/p/10113097.html
Copyright © 2020-2023  润新知