#!/bin/ksh # Program: db_requests # Purpose: This script gathers database request information and then # displays the information to the user. # Author: Adam Backman # Syntax: db_requests [all] # If the "all" option is given you will get a list of all # users otherwise, you will only get the top ten db requestors # Date Written: 03/09/98 # # Setup the environment SCRIPTS=${SCRIPTS-/u3/users/adamb/scripts} TMP=$SCRIPTS/tmp/tmp.user PARAM_2=${2-TOPTEN} # Setup database specific variables . $SCRIPTS/live/read_registry $1 case $? in 2) echo "Database $1 is not in database registry" exit 1 ;; 3) echo "Database $1 is on $HOST not on this host" exit 1 ;; esac # Check to see if the database is up or down proutil $DB_DIR/$DB -C busy 2>/dev/null >/dev/null if [ $? -eq 0 ] then echo "The database is not running - Cannot monitor" exit 1 else promon $DB_DIR/$DB << $END$ > $TMP 2>/dev/null 3 1 q q $END$ fi # Do you want all or only top 10 case $PARAM_2 in ALL|all|All) cat $TMP | sort -k 2,2 -u | sort +3 -n -u -r | more ;; *) cat $TMP | sort -k 2,2 -u | sort +3 -n -u -r | head -20 ;; esac # Cleanup rm $TMP