{"id":357,"date":"2009-05-22T18:13:59","date_gmt":"2009-05-22T12:13:59","guid":{"rendered":"http:\/\/techsatwork.com\/blog\/?p=357"},"modified":"2016-01-07T11:31:12","modified_gmt":"2016-01-07T05:31:12","slug":"troubleshooting-with-db2-snapshots","status":"publish","type":"post","link":"https:\/\/techsatwork.com\/?p=357","title":{"rendered":"Troubleshooting with DB2 snapshots"},"content":{"rendered":"<p>Multiple db2 snapshots can reveal performance issue, but its going to difficult to execute multiple snapshots while troubleshooting, so here is a script that will take various snapshots and db2pd information in a loop while you are looking at the system. Modify it to suit your needs :<\/p>\n<p><span style=\"color: #3366ff;\">#!\/bin\/ksh\u00c2\u00a0<br \/>\ntypeset -i maxCount=10<br \/>\ntypeset -i intervalCount=1<br \/>\ntypeset -i sleeptime=120<br \/>\nif [ $# -eq 0 ] ; then<br \/>\necho &#8220;Usage: snaps.ksh &lt;database&gt;&#8221;<br \/>\n\u00c2\u00a0exit<br \/>\nfi<br \/>\nDB=$1<br \/>\ndb2 terminate 2&gt;&amp;1<br \/>\ndb2 connect to $DB<br \/>\ndb2 update monitor switches using bufferpool on lock on sort on statement on table on uow on timestamp on<br \/>\nwhile (( intervalCount &lt;= maxCount)) ; do<br \/>\ndatestamp=`date +&#8221;%m%d&#8221;`.`date +&#8221;%H%M&#8221;`<br \/>\n\u00c2\u00a0\u00c2\u00a0ps -kelf &gt; pself.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2pd -edus &gt; db2pd.edus.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for database manager &gt; \u00c2\u00a0dbmsnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 list applications show detail &gt; \u00c2\u00a0listapps.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for database on $DB &gt; \u00c2\u00a0$DB.dbsnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for applications on $DB &gt; \u00c2\u00a0$DB.appsnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for tables on $DB &gt; \u00c2\u00a0$DB.tablesnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for tablespaces on $DB &gt; \u00c2\u00a0$DB.tbspsnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for locks on $DB &gt; \u00c2\u00a0$DB.locksnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for bufferpools on $DB &gt; \u00c2\u00a0$DB.bpsnap.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2 get snapshot for dynamic sql on $DB &gt; \u00c2\u00a0$DB.dynsql.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0db2pd -inst -alldbs &gt; db2pd.inst.alldbs.$datestamp 2&gt;&amp;1<br \/>\n\u00c2\u00a0\u00c2\u00a0intervalCount=intervalCount+1<br \/>\nsleep $sleeptime<br \/>\ndone<br \/>\ndb2 terminate<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Multiple db2 snapshots can reveal performance issue, but its going to difficult to execute multiple snapshots while troubleshooting, so here is a script that will take various snapshots and db2pd information in a loop while you are looking at the system. Modify it to suit your needs : #!\/bin\/ksh\u00c2\u00a0 typeset -i maxCount=10 typeset -i intervalCount=1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","site-transparent-header":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[3],"tags":[220,219,186,218],"class_list":["post-357","post","type-post","status-publish","format-standard","hentry","category-db2","tag-db2-performance","tag-db2-snapshot","tag-db2pd","tag-snapshots"],"_links":{"self":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=357"}],"version-history":[{"count":3,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions"}],"predecessor-version":[{"id":1540,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/357\/revisions\/1540"}],"wp:attachment":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}