oramon
上传用户:rjj0351
上传日期:2007-01-07
资源大小:9k
文件大小:3k
源码类别:

Oracle数据库

开发平台:

SQL

  1. Syntax()
  2. {
  3. echo 'oramon 2.1 beta by Raymond Vermeern'
  4. echo 'Usage: oramon [ses cpu|disk      [interval count records]]'
  5. echo '       oramon [usr sid statistic [interval count records]]'
  6. echo '       oramon [sql sid           [interval count records]]'
  7. echo '       oramon [tbs               [interval count records]]'
  8. echo '       oramon [dbf               [interval count records]]'
  9. echo '       oramon [fio nodelta|delta [interval count records]]'
  10. echo '       oramon [rbs               [interval count records]]'
  11. echo 'n'
  12. echo '       ses = session information'
  13. echo '       usr = user information'
  14. echo '       sql = user sql information'
  15. echo '       tbs = tablespace information'
  16. echo '       dbf = datafile information'
  17. echo '       fio = datafile io information'
  18. echo '       rbs = rollback information'
  19. echo 'n'
  20. echo '       default => oramon 5 99999999999999 20 ses disk'
  21. exit 0
  22. }
  23. DISPLAY=$1
  24. case $DISPLAY in
  25. '-h'|'-H'|'-?') Syntax
  26.                 ;;
  27.          'ses') INTERVAL=$3
  28.                 COUNT=$4
  29.                 NUMBER=$5
  30.                 case "${2}" in 
  31.                 'CPU'|'cpu')   PAR1=6
  32.                                ;;
  33.                 'DISK'|'disk') PAR1=5
  34.                                ;;
  35.                 *)             PAR1=5
  36.                                ;;
  37.                 esac
  38.                 ;;
  39.          'usr') INTERVAL=$4
  40.                 COUNT=$5
  41.                 NUMBER=$6
  42.                 PAR1=$2
  43.                 PAR2=$3
  44.                 if [ "${PAR1}" = "" -o "${PAR2}" = "" ]
  45.                  then
  46.                    Syntax
  47.                 fi
  48.                 ;;
  49.          'sql') INTERVAL=$3
  50.                 COUNT=$4
  51.                 NUMBER=$5
  52.                 PAR1=$2
  53.                 if [ "${PAR1}" = "" ]
  54.                  then
  55.                    Syntax
  56.                 fi
  57.                 ;;
  58.          'fio') PAR1=$3
  59.                 PAR2=$4
  60.                 PAR3=$2
  61.                 if [ "${PAR3}" = "" ]
  62.                  then
  63.                    Syntax
  64.                 fi
  65.                 if [ "${PAR1}" = "" ]
  66.                  then
  67.                    PAR1=4
  68.                 fi
  69.                 if [ "${PAR2}" = "" ]
  70.                  then
  71.                    PAR2=99999999999999
  72.                 fi
  73.                 ;;
  74.          *)     INTERVAL=5
  75.                 COUNT=99999999999999
  76.                 NUMBER=20
  77.                 if [ "${1}" = "" ]
  78.                  then
  79.                    DISPLAY=ses
  80.                    PAR1=5
  81.                 fi
  82.                 ;;
  83. esac
  84. [ "${INTERVAL}" = "" ] && INTERVAL=5
  85. [ "${COUNT}" = "" ] && COUNT=99999999999999
  86. [ "${NUMBER}" = "" ] && NUMBER=20
  87. ##echo "@${DISPLAY}mon ${NUMBER} ${PAR1} ${PAR2} ${PAR3}"
  88. ##exit
  89. typeset -Z12 TELLER=0
  90. while [ "$TELLER" -lt ${COUNT} ]
  91. do
  92.    (( TELLER = TELLER + 1 ))
  93.    clear
  94.    sqlplus -s / << EOF
  95.     @hdrmon
  96.     @${DISPLAY}mon ${NUMBER} ${PAR1} ${PAR2} ${PAR3}
  97. EOF
  98.    if [ ${COUNT} -gt 1 ]
  99.     then
  100.       sleep ${INTERVAL}
  101.    fi
  102. done