DB2多次抓取快照指令碼

fjzcau發表於2015-03-28
#!/bin/ksh93
maxcount=10
intervalcount=1
sleeptime=120
if [ $# -eq 0 ] ; then
  echo "Usage snap.ksh "
  exit 1
fi

DB=$1
db2 terminate 2>&1
db2 connect to $DB
db2 reset monitor all
db2 update monitor switches using bufferpool on lock on sort on statement on table on uow on timestamp on
while (( intervalcount <=  maxcount )) ;
do
     datestamp=`date +"%Y%m%d%H%M"`
     db2 get snapshot for database manager > dbmsnap.${datestamp} 2>&1
     db2 get snapshot for database on $DB > $DB.dbsnap.${datestmap} 2>&1
     db2 get snapshot for applications on $DB > $DB.appsnap.${datestmap} 2>&1
     db2 get snapshot for tables on $DB > $DB.tablesnap.${datestmap} 2>&1
     db2 get snapshot for tablespaces on $DB > $DB.tbssnap.${datestmap} 2>&1
     db2 get snapshot for locks on $DB > $DB.locksnap.${datestmap} 2>&1
     db2 get snapshot for bufferpools on $DB > $DB.bufferpoolsnap.${datestmap} 2>&1
     db2 get snapshot for dynamic sql on $DB > $DB.dynsqlsnap.${datestmap} 2>&1
     ((intervalcount=intervalcount+1))
     sleep $sleeptime
done
db2 terminate

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22661144/viewspace-1477194/,如需轉載,請註明出處,否則將追究法律責任。

相關文章