Results 1 to 4 of 4
  1. #1
    Join Date
    May 2003
    Posts
    369

    Unanswered: automating reorgs and runstats

    Does anyone have a good script for AIX that will help me to automate reorg tables and runstats? Thanks!

    Scott

  2. #2
    Join Date
    Jun 2003
    Posts
    127

    Re: automating reorgs and runstats

    db2 "select tbcreator,tbname,creator,name from sysibm.sysindexes \
    where tbcreator = 'WHATEVER' and iid = 1 order by tbcreator, tbname" |
    awk 'NR > 3 && NF == 4 {print $1"."$2" "$3"."$4}' |
    while LINE=`line`
    do
    set $LINE
    TABLE=$1
    INDEX=$2
    echo $TABLE
    db2 -v reorg table $TABLE index $INDEX use TEMPSPACE1
    done

    db2 "select creator,name from sysibm.systables \
    where type='T' order by creator, name" |
    tee $LIST2 | awk 'NR > 3 && NF == 2 {print $1"."$2}' |
    while LINE=`line`
    do
    set $LINE
    TABLE=$1

    echo "Starting RUNSTATS: Table $TABLE @ `date`" >> $STATUS
    db2 -v runstats on table $TABLE and indexes all shrlevel reference
    done

    If u want to , u can change options on your runstats. Using these two loops, you should be able to come up with a shell script.

    Hope this helps.

  3. #3
    Join Date
    May 2003
    Posts
    369

    thanks!

    just what I needed I will play around and test it. Thanks again

    Scott

  4. #4
    Join Date
    Jan 2003
    Posts
    1,605

    Re: automating reorgs and runstats

    Originally posted by Kota
    db2 -v runstats on table $TABLE and indexes all shrlevel reference
    Hi,

    Be careful with "shrlevel reference" - this makes table read only.
    Try also "shrlevel change" - table read/write allowed.

    Hope this helps,
    Grofaty

Posting Permissions

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