partn

Decodes partnum/tblsnum into database:owner.table[#index][%fragpart][,fragdbs] and appends to stdout.

There are many onstat options which print a partnum/tblnum in their output. It is helpful to translate these into something a human can read.

Requirements

partn needs to open connections to all of your databases. It will therefore need at least CONNECT permission.

Building

You'll need esql/c to complie.
$ tar xvzf partn-2.0.tgz
./partn-2.0/
./partn-2.0/README.html
./partn-2.0/slurp.ec
./partn-2.0/slurp.h
./partn-2.0/partn.c
./partn-2.0/str_dup.c
./partn-2.0/partn_info.h
./partn-2.0/Makefile
./partn-2.0/hash.h
./partn-2.0/malloc_err.h
./partn-2.0/malloc_err.c
./partn-2.0/hash.c
./partn-2.0/dblimident.c
./partn-2.0/partn_info.c
./partn-2.0/README
./partn-2.0/dblimident.h
./partn-2.0/Makefile.dev
./partn-2.0/str_dup.h

$ cd partn-2.0

$ make
cc  -c partn.c
cc  -c hash.c
cc  -c str_dup.c
cc  -c malloc_err.c
cc  -c partn_info.c
cc  -c dblimident.c
esql  -c slurp.ec
esql  partn.o hash.o str_dup.o malloc_err.o partn_info.o dblimident.o slurp.o -o partn

Usage

partn needs to know which column (-k n) is the partnum and whether it is in hex (-x) or decimal (-d). Defaults are column 1 and to guess.
$ partn -?
Usage:
partn [-k <key-field>] [{-d|-x}] [-f]
    where:
        -k <key-field> = the partnum is in column <key-field>. (default: 1)
        -d = the partnum column is in decimal
        -x = the partnum column is in hexadecimal
        -f = always print the dbspace, even if the table is not fragmented
        -h = no headings/blank-lines

Example

Typical usage is to pipe any onstat that prints a partnum thru partn, eg:
$ onstat -T | partn -xk5
$ onstat -P | partn
$ onstat -g ppf | partn
$ onstat -g opn | partn -k6
eg
$ onstat -T | ./partn -xk5 | head -20

IBM Informix Dynamic Server Version 11.50.UC6     -- On-Line -- Up 68 days 22:38:41 -- 483240 Kbytes 

Tblspaces 
 n address  flgs ucnt tblnum   physaddr         npages nused  npdata nrows  nextns 
 1 4ef886c8 8    0    6        0:0              0      0      0      0      0      sysmaster:informix.syscfgtab
 2 4edc83e0 8    0    a        0:0              0      0      0      0      0      sysmaster:informix.sysptnhdr
 3 4edc8738 8    0    f        0:0              0      0      0      0      0      sysmaster:informix.systabnames
 4 4f0b1670 8    0    10       0:0              0      0      0      0      0      sysmaster:informix.sysactptnhdr
 5 4f026888 8    0    17       0:0              0      0      0      0      0      sysmaster:informix.sysdbstab
 6 4ef69768 8    0    1a       0:0              0      0      0      0      0      sysmaster:informix.sysrstcb
 7 4f0d8530 8    0    1f       0:0              0      0      0      0      0      sysmaster:informix.sysshmhdr
 8 4ef6d3e0 8    0    26       0:0              0      0      0      0      0      sysmaster:informix.sysshmvals
 9 4ef88018 8    0    28       0:0              0      0      0      0      0      sysmaster:informix.sysscblst
10 4ef69ac0 8    0    29       0:0              0      0      0      0      0      sysmaster:informix.systcblst
11 4ef69018 8    0    2a       0:0              0      0      0      0      0      sysmaster:informix.sysvplst
12 4ef15018 8    0    2f       0:0              0      0      0      0      0      sysmaster:informix.sysseglst
13 4ef328d8 8    0    57       0:0              0      0      0      0      0      sysmaster:informix.syscheckpoint
14 4ef88370 8    0    58       0:0              0      0      0      0      0      sysmaster:informix.sysnetworkio
15 4f4a12c8 8    0    59       0:0              0      0      0      0      0      sysmaster:informix.sysenv

$ onstat -P | ./partn | head -20

IBM Informix Dynamic Server Version 11.50.UC6     -- On-Line -- Up 68 days 22:43:07 -- 483240 Kbytes 

Buffer pool page size: 2048 
partnum  total    btree    data     other    dirty    
0        26       0        7        19       0        UNUSED
1048577  341      0        330      11       0        informix.TBLSpace,rootdbs
1048578  4        1        2        1        0        sysmaster:informix.sysdatabases
1048580  35       13       21       1        0        sysmaster:informix.systables
1048581  5        2        3        0        0        sysmaster:informix.syscolumns
1048582  4        2        2        0        0        sysmaster:informix.sysindices
1048583  1        0        1        0        0        sysmaster:informix.systabauth
1048584  1        0        1        0        0        sysmaster:informix.syscolauth
1048585  4        2        2        0        0        sysmaster:informix.sysviews
1048586  2        1        1        0        0        sysmaster:informix.sysusers
1048595  9        5        4        0        0        sysmaster:informix.sysprocedures
1048596  5        2        3        0        0        sysmaster:informix.sysprocbody
1048597  3        2        1        0        0        sysmaster:informix.sysprocplan
1048598  3        2        1        0        0        sysmaster:informix.sysprocauth
1048604  3        1        1        1        0        sysmaster:informix.sysfragments
© Richard Harnden, 2012

Please report bugs: <richard.harnden@lineone.net>

Public Domain. Use/copy at will. No warranties, etc.