If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Space Monitoring Script

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-17-05, 15:13
cougartrace cougartrace is offline
Registered User
 
Join Date: Oct 2005
Posts: 26
Space Monitoring Script

Any of the DB2 UDB AIX DBA's out there have any good scripts for monitoring space usage on tablespaces? I'm looking for some good examples that I can tweak for DMS tablespaces.

Thanks,

CougarTrace
Reply With Quote
  #2 (permalink)  
Old 10-18-05, 02:22
przytula przytula is offline
Registered User
 
Join Date: Nov 2004
Posts: 374
space

we use the table function to monitor
drop view db2monitor.ts_space;
create view db2monitor.ts_space as select * from table(snapshot_tbs_cfg('PLDA',-1)) as sntable;
--
drop view db2monitor.ts_free_space ;
create view db2monitor.ts_free_space (tsname,type,state,size_meg,pct_free,meg_free) as
select substr(tablespace_name,1,30) ,
case (tablespace_type)
when 0 then 'DMS'
else 'SMS'
end ,
case (tablespace_state)
when 0 then 'Normal'
else 'Other' || char(tablespace_state)
end ,
int((total_pages*page_size)/1024/1024) ,
case (total_pages)
when 0 then 0
else smallint((float(free_pages) / float(total_pages))*100)
end ,
int((free_pages*page_size) / 1024 /1024 )
from db2monitor.ts_space ;

then monitor this
db2 "connect to $DBNAME "
db2 -x "select count(*) from db2monitor.ts_free_space where SIZE_MEG>1 and type='DMS' and pct_free < 21" |tr -d ' ' | read WARNTOT
db2 -x "select count(*) from db2monitor.ts_free_space where SIZE_MEG>1 and type='DMS' and pct_free between 11 and 20" |tr -d ' ' | read WARNCNT
db2 -x "select count(*) from db2monitor.ts_free_space where SIZE_MEG>1 and type='DMS' and pct_free < 11" |tr -d ' ' | read ERRCNT
# -----------------------------------------------------------------------
# no warnings/error -----------------------------------------------------
# -----------------------------------------------------------------------
if [[ $WARNTOT -eq 0 ]]; then
$SCRDIR/sendfile.sh -s "NO_WARNING_ON_TS_SPACE_USAGE_FOR_$HOSTNAME.$DB2IN STANCE.$DBNAME" ...
fi
if [[ $WARNCNT -ne 0 ]]; then....

ship mail if any alerts...
__________________
Best Regards, Guy Przytula
DB2/ORA/SQL Services
DB2 DBA & Advanced DBA Certified
DB2 Dprop Certified
http://users.skynet.be/przytula/dbss.html
Reply With Quote
  #3 (permalink)  
Old 10-19-05, 14:27
cougartrace cougartrace is offline
Registered User
 
Join Date: Oct 2005
Posts: 26
thanks for the info,but

The views create successfully, but when I try to run a query against the views, this is the error I'm seeing:

Error: [IBM][CLI Driver][DB2/6000] SQL0443N Routine "*_TBS_CFG" (specific name "") has returned an error SQLSTATE with diagnostic text "SQL1013 Reason code or token: PLDA ". SQLSTATE=38553
(38553,-443), Batch 1 Line -1
Reply With Quote
  #4 (permalink)  
Old 10-19-05, 15:05
cougartrace cougartrace is offline
Registered User
 
Join Date: Oct 2005
Posts: 26
nevermind

It would help if I used my database name.

Thanks for all the help.
Reply With Quote
  #5 (permalink)  
Old 10-20-05, 04:42
grofaty grofaty is offline
Registered User
 
Join Date: Jan 2003
Posts: 1,570
I use DB2 monitor simple freeware tool. It is so simple just one to two clicks and the results are displayed.
You can download for free from:
http://members.tripod.com/chuzhoi_files/index.html

If you have some new requirements that are not supported in tool, just mail the author of program, he made included several things in program to help me out. But the beauty is is free!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On