Link to home
Start Free TrialLog in
Avatar of helloyip
helloyip

asked on

Get DB2 tablespace during runtime

Dear all,

Is there any method to know the DB2 tablespace during runtime? I am using Java application and SQLJ to access IBM DB2 V7.  My table is partitioned and I want my program to know if one partition is full, it can insert record to the next partition.  Does SQLJ provide any function to do so?

Thanks all.

Avatar of askanivg
askanivg

try using db2 list tablespaces. I dont know about SQLJ.

Basically paritioning key if defined, (feature of V8) distributes the load across various nodes. So it does not mean that the first tablespace is filled and it starts filling up the different nodes/tablespaces. If you wish to do it manually then you can think doing on these lines. ie.. checking the range of the partitioning key and inserting into the respective node/tablespace that houses that range of partitioning key values. This would help your performance also.

HtH
Avatar of helloyip

ASKER

Thanks for your reply.  However, what I am seeking is the way to know the tablespace utilization at runtime using Java, so that I can avoid inserting record to the partition which is already or nearly out of disk space.  

Any other suggestion?


I suppose you cannot do this manually. It should be done by the database.
Or
if you wish to do it manually you should have access to use 'list tablespaces show detail'. Then looking at the upper water level mark you should decide whether the tablespace is filled. Then use some commands like use node1, export node1 and then load to that node.
Did you try using SYSCAT.TABLESPACES catalog table to retrieve those informations ?
ASKER CERTIFIED SOLUTION
Avatar of BigSchmuh
BigSchmuh
Flag of France image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial