Re: Can I find out what's in a dbspace ???
Posted in 1996
: > A week ago I came across a problem I cpuldn't solve 'til today. One dbspace
: > filled up and no one knew why. I tried to figure out what tables, blobs or so was
: > put in there but I couldn't find out how to do that.
: > So can anyone tell me how to find out what is in a dbspace ?
Besides the previously-covered tbcheck option, you can also select the dbspace
from systables or sysmaster (if you're on 6.0+).
For non-fragmented tables, systables.partnum contains the dbspace in the first
2 or 3 nibbles (hex digits). If you SELECT hex(partnum) FROM systables, you
will see a number like 0x100002e (pre-DSA) or 0x10002e (DSA). The 1 indicates
that the table was built in dbspace 1. So if you SELECT partnum/0x100000
(with the correct number of 0's for your version, and converted into decimal
-- sorry I don't have a hex calculator handy so you'll have to do it yourself)
you get the dbspace number.
So, for example, if your dbspace 5 fills up, something like:
SELECT tabname FROM systables WHERE partnum BETWEEN 0x500000 and 0x600000
or
SELECT tabname FROM systables WHERE trunc(partnum/0x100000) = 5
(do we have a trunc function? I forget)ought to work. Remember, the hex numbers must first be converted, and DSA has
5 0's whereas pre-DSA has 6.
Of course, this only works for one database at a time - if you have multiple
databases, you'll have to do all of them.
If you have fragmented tables, you have to get sysfragments into the equation.
If you're on DSA, you can get this from sysmaster for all your databases, but
unfortunately I can't remember how, off the top of my head.
June
---- June Tong Informix Software ----
---- Senior Consultant (415) 926-6140 ----
---- International Support junet@informix.com ----
---- Location-du-jour: Beijing ----