#!/bin/ksh
#

# A script that defines environment variables like
# $DLC etc...

. /usr/local/sysadmin/config

# Set this to the name of the database being
# monitored

DBNAME=$1 ; export DBNAME

# Set this to the directory that the db is located
# in

DBDIR=/db

# Write the log files to /var/log/dbname/mm.dd
# This helps keep them organized.
#

DT=`date "+%m.%d"`
TM=`date "+%H.%M"`
TMP=/var/log/$DBNAME/$DT

mkdir -p $TMP
chmod 775 $TMP

cd $DBDIR/$DBNAME

# Go to the R&D menu, set the page size
#    1 status
#	7 buffer cache
#	4 processes
#	    3 active transactions
#    2 activity
#	13 shared resources

$DLC/bin/promon $DBNAME > $TMP/mon.$TM <<- "EOF" 2> /dev/null
R&D
5
1
9999
p
4
60
p
1
13
p
p
1
7
p
4
3
p
p
p
2
1
p
3
x
EOF

# Go to the R&D menu, set the page size
#    3 other
#	2 io by process

$DLC/bin/promon $DBNAME > $TMP/iop.$TM <<- "EOF" 2> /dev/null
R&D
5
1
9999
p
3
2
x
EOF

## Go to the R&D menu, set the page size
##    debghb -- secret menu  -- 9.1d has a nasty bug -- don't run this there
##
#$DLC/bin/promon $DBNAME > $TMP/waits.$TM <<- "EOF" 2> /dev/null
#R&D
#5
#1
#9999
#p
#4
#60
#p
#debghb
#4
#4
#2
#p
#p
#6
#8
#s
#p
#9
#p
#11
#p
#p
#4
#4
#2
#x
#EOF

# Go to the R&D menu, set the page size & sampling
# interval
#    2 activity
#	1 summary
#	sample for 60 seconds
#	various summary stats

$DLC/bin/promon $DBNAME > $TMP/sample.$TM <<- "EOF" 2> /dev/null
R&D
5
1
9999
3
60
p
2
1
s
p
3
p
4
p
5
p
6
p
7
p
8
p
10
p
11
p
12
p
13
x
EOF

# Get some helpful data from the OS

ps -elf > $TMP/ps.$TM

# iostat -x 10 2 > $TMP/iostat.$TM
#
# vmstat 10 10 > $TMP/vmstat.$TM

