fragmentation on OnLine v5
Posted in 1997
This is a multi-part message in MIME format. --------------60962CC15B2C Content-Type: text/plain; charset=iso-8859-2 Content-Transfer-Encoding: 7bit Hi men, do you want to see table fragmentation on your OnLine 5 ? Try this script : (this is only header, script is to be attachment:) Michal ################################################### ## author ## ## Michal Hajek, Uherske Hradiste, (c) 1997 ## ## hajek@nspuh.cz ## ################################################### ## Shows fragmentation of your database chunks. ## ## With table as parameter it shows only where ## ## the table is located. ## ## example: dbfrag systables ## ################################################### ## For (and tested on) OnLine v5.01 ## ################################################### ## It is only a 'working-beta'. ## ## You may change this script any way you like ## ## just let me know if it helped to you somehow. ## ## Improvement will be gladly appreciated ! ## ################################################### ## I do not have any responsibility if using of ## ## this script will make you any troubles ## ################################################### ## !! WARNING !! ## ## the script is STRONGLY dependent on tbcheck ## ## output. It works with tbcheck ver 9.1.1.1 ## ## (from unix command 'what tbcheck') ## ## on HP-UX 9.04. ## ## Let me know, if it works on other versions. ## ################################################### -- -------------------------------------------------------------- Michal Hajek mailto:hajek@nspuh.cz Sprava NIS http://www.nspuh.cz NsP Uherske Hradiste phone : voice +420 0632 529 204 Purkynova 365 fax +420 0632 551 014 686 68 Uherske Hradiste Czech Republic -------------------------------------------------------------- --------------60962CC15B2C Content-Type: text/plain; charset=iso-8859-2; name="dbfrag" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="dbfrag" ################################################### ## author ## ## Michal Hajek, Uherske Hradiste, (c) 1997 ## ## hajek@nspuh.cz ## ################################################### ## Shows fragmentation of your database chunks. ## ## With table as parameter it shows only where ## ## the table is located. ## ## example: dbfrag systables ## ################################################### ## For (and tested on) OnLine v5.01 ## ################################################### ## It is only a 'working-beta'. ## ## You may change this script any way you like ## ## just let me know if it helped to you somehow. ## ## Improvement will be gladly appreciated ! ## ################################################### ## I do not have any responsibility if using of ## ## this script will make you any troubles ## ################################################### ## !! WARNING !! ## ## the script is STRONGLY dependent on tbcheck ## ## output. It works with tbcheck ver 9.1.1.1 ## ## (from unix command 'what tbcheck') ## ## on HP-UX 9.04. ## ## Let me know, if it works on other versions. ## ################################################### tbcheck -pe | awk -v TAB=$1 ' BEGIN { CH_START=0 RX=70 RY=60 MAPLEN=RX*RY OLD_END=-1 if (TAB=="") { Z_FREE="F" } else { Z_FREE="."} } function print_map(MAP) { print "CHUNK: "CH_NR" "CH_DEV", size "CH_SIZE", used "CH_USED", free "CH_FREE print "" for (y=0;y<RY;y++) { for (x=0;x<=RX;x++) { printf "%c",MAP[RY*y+x] } printf "\\n" } printf "\\f" } function clear_map(MAP) { for (x=0;x<=MAPLEN;x++) { MAP[x]="?" } } { if ( $1 == "Chunk:" ) { if (CH_START==0) { ## it is 1. chunk clear_map(MAP) OLD_END=-1 } else { ### it is next chunk - listing of previous print_map(MAP) clear_map(MAP) OLD_END=-1 } CH_START=1 CH_NR=$2 CH_DEV=$3 getline CH_SIZE=$1 CH_USED=$2 CH_FREE=$3 KF=MAPLEN/CH_SIZE }} { if ($1 == "-------------------------------------------") { DAT_START=1 getline } else if ($0 == "") { DAT_START=0 }} { if ((DAT_START == 1 ) && (length($0) > 10)) { B_START=substr($0,54,9) B_END=B_START+substr($0,64,10)-1 OLD_END=B_END M_START=B_START*KF M_END=B_END*KF if (TAB=="") { if (substr($0,9,21) == "ROOT DBSpace RESERVED") { ZNAK="R" } else if (substr($0,9,20) == "CHUNK FREE LIST PAGE") { ZNAK="C" } else if (substr($0,9,17) == "TBLSPACE TBLSPACE") { ZNAK="T" } else if (substr($0,9,18) == "PHYSICAL LOG Pages") { ZNAK="P" } else if (substr($0,9,17) == "LOGICAL LOG Pages") { ZNAK="L" } else if (substr($0,9,17) == "DATABASE TBLSPACE") { ZNAK="D" } else if (substr($0,9,4) == "FREE") { ZNAK=Z_FREE } else if (substr($0,9,20) == "OTHER RESERVED Pages") { ZNAK="O" } else { ZNAK="U" } } ### end of determining the char (without table) else { ### is it the table ? if (index($0,"."TAB" ") != 0) { ZNAK="X" } else { ZNAK="." } } #### end of determining of char for (x=int(M_START+0.5);x<=int(M_END+0.5);x++) { Z_OLD=MAP[x] if (Z_OLD=="?") { MAP[x]=ZNAK } ## nothing yet else { if (Z_OLD==ZNAK) { } ## something, but the same else { if (Z_OLD != ZNAK) { ## something else if (ZNAK=="F") { MAP[x]="f" } ## something else, but free