Manas,

I use a perl script to bring the snapshot-output for tables and tablespaces 
into a comma delimited format:

db2_all db2 get snapshot for tables on <DB_NAME>      | fmt_table_tablespace > 
file1.del
db2_all db2 get snapshot for tablespaces on <DB_NAME> | fmt_table_tablespace > 
file1.del


Quick and dirty, but it works.

Hope this help

Daniel

[EMAIL PROTECTED]

-----Original Message-----
From: manas.dasgupta [mailto:[EMAIL PROTECTED]]
Sent: Mittwoch, 11. April 2001 21:50
To: db2eug
Subject: DB2EUG: Formatting snapshot/event monitor outputs:DB2/AIX


I am currently working on setting up a process of extracting performance
data from DB2/AIX (snapshot and event monitors) and putting them in tables
so that we have a record of DB2 activity that we can query against.
I was wondering if anyone had done similar work parsing through
snapshot/event monitor output and would like to share scripts or have any
advice or pointers on this topic.

Thanks,
Manas.



=====
To unsubscribe, send 'unsubscribe' to [EMAIL PROTECTED]
For other info (and scripts), see http://people.mn.mediaone.net/scottrmcleod

#!/usr/bin/perl
# table o.k.
# tablespace o.k.

   $cDelimiter = "";

   switch: while (<STDIN>) {
      next if /^\s*(#|$)/;
      
#_____________________________________________________________________________________
      # skip unimportant header , table related
      
#_____________________________________________________________________________________

      next if /^\s*Table Snapshot/;
      next if /^\s*Tablespace Snapshot/;
      next if /Table List/;
      next if /^\s*Number of accessed tables/;
      next if /^\s*Number of accessed tablespaces/;
      next if /SQL1611W/;
      next if /^\s*Last reset timestamp/;   # only for tablespace
      next if /db2 get snapshot for/;

      
#_____________________________________________________________________________________
      # header for table and tablespace
      
#_____________________________________________________________________________________

      /First database connect timestamp/ && do { s/.*=\s(.*)\/(.*)\/(.*) 
(.*)\s*/$3-$2-$1-$4/; $szPrefix = $_;                   next switch; };
      /Snapshot timestamp/               && do { s/.*=\s(.*)\/(.*)\/(.*) 
(.*)\s*/$3-$2-$1-$4/; $szPrefix = $szPrefix . "," . $_; next switch; };
      /Database name/                    && do { s/.*=\s(.*)\s*/$1/;         $szPrefix 
= $szPrefix . "," . $_; next switch; };
      /Database path/                    && do { s/.*=\s(.*)\s*/$1/;         $szPrefix 
= $szPrefix . "," . $_; next switch; };
      /Input database alias/             && do { s/.*=\s(.*)\s*/$1/;         $szPrefix 
= $szPrefix . "," . $_; next switch; };

      
#_____________________________________________________________________________________
      # group change tablespace
      
#_____________________________________________________________________________________

      /Tablespace name/ && $cDelimiter !~ /^$/ && do {  printf "\n" ; };
      /Tablespace name/ && do {
         $cDelimiter=",";
         printf "%s" , $szPrefix;
      };

      
#_____________________________________________________________________________________
      # group change table
      
#_____________________________________________________________________________________

      /Table Schema/ && $cDelimiter !~ /^$/ && do {  printf "\n" ; };
      /Table Schema/ && do {
         $cDelimiter=",";
         printf "%s" , $szPrefix;
      };


      /Table Name/ && do { tr/,/./ ; };
 
      s/.*?=\s(.*)\s*/$1/;
      printf "%s%s" , $cDelimiter, $_;

   }

   printf "%s\n",$szOutputBuffer;

Reply via email to