Wednesday 28 April 2010

Everything about DB2 tables

Two SQL based ways to get detailed information on a DB2 table:

For example, we may want to know how much disk space has been allocated for a particular table, or what state it is in. Should it be reorganized? Has the last load job finished loading data in to it and so on

First Method:
using ADMINTABINFO view is one

SELECT * FROM SYSIBMADM.ADMINTABINFO;

The query is returning about 29 columns and this is for every table in the database.


Second Method:
The other is a to use SYSPROC.ADMIN_GET_TAB_INFO_V95 table function.


It accepts table schema and table name as parameters and returns exactly the same information as the ADMINTABINFO view.


SELECT * FROM TABLE (SYSPROC.ADMIN_GET_TAB_INFO_V95('ADMINISTRATOR', 'SALES'));

No comments:

Post a Comment