Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    26

    Unanswered: 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

  2. #2
    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

  3. #3
    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

  4. #4
    Join Date
    Oct 2005
    Posts
    26

    nevermind

    It would help if I used my database name.

    Thanks for all the help.

  5. #5
    Join Date
    Jan 2003
    Posts
    1,605
    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!!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •