ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 提取DB2多分区环境当前的状态

提取DB2多分区环境当前的状态

原创 Linux操作系统 作者:myamor 时间:2013-06-03 15:03:12 0 删除 编辑
##最近整理了一下先前主机的内容,竟然发现好多的内容都没有备份,失误呀
########################################################################
##echo "本脚本是提取DB2多分区环境当前的状态"
##echo "主要是每个分区中对应的表空间和容器的信息"
##echo "使用方法:db2_check_dpf_status.sh dbname"
##echo "CopyRight  "
########################################################################
#!/bin/sh
check_time=`date '+%Y%m%d'`
FILEPATH=$0
FILENAME=${FILEPATH##*/}
echo
    usage()
    {
        echo "Invalid parameter,you must use it like this:${FILENAME} dbname !"
        exit 3
    }
if [ $# -ne 1 ]
then
  usage
fi
dbname=$1
db2level >> db2status.${dbname}.log.$check_time
db2 list db directory >> db2status.${dbname}.log.$check_time
db2 get dbm cfg show detail>> db2status.${dbname}.log.$check_time
db2 connect to $dbname >> db2status.${dbname}.log.$check_time
db2 list database partition groups >> db2status.${dbname}.log.$check_time
db2 "select * from syscat.bufferpools" >> db2status.${dbname}.log.$check_time
db2 list DBPARTITIONNUMS | grep "      " >> /tmp/DBPARTITIONNUMS.$dbname.log
cat /tmp/DBPARTITIONNUMS.$dbname.log | while read line
do
   db_partnum=`echo $line | awk '{print $1}'`
   if [ "$db_partnum" = "" ]
   then
       break
   fi
   echo "Begin to get Information of partition Node $db_partnum " >> db2status.${dbname}.log.$check_time
   export DB2NODE=$db_partnum >> db2status.${dbname}.log.$check_time
   db2 terminate >> db2status.${dbname}.log.$check_time
   db2 connect to $dbname >> db2status.${dbname}.log.$check_time
   db2 "values (current dbpartitionnum)" >> db2status.${dbname}.log.$check_time
   db2 get db cfg for $dbname show detail >> db2status.${dbname}.log.$check_time
   db2 list tablespaces show detail >> db2status.${dbname}.log.$check_time
   db2 list tablespaces | grep "Tablespace ID" | while read line2
   do
      tbsp_id=`echo $line2 | awk '{print $4}'`
      if [ "$tbsp_id" = "" ]
      then
         break
      fi
      db2 list tablespace containers for $tbsp_id show detail  >> db2status.${dbname}.log.$check_time    
   done
   sleep 2
done
rm -rf /tmp/DBPARTITIONNUMS.$dbname.log
echo "Get Information successful!"
exit 0

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/177006/viewspace-762832/,如需转载,请注明出处,否则将追究法律责任。

下一篇: TSM概念笔记(转)
请登录后发表评论 登录
全部评论

注册时间:2012-03-20

  • 博文量
    20
  • 访问量
    138285