Thursday, 16 January 2014

DB2 V9.7 How to calculate Database Size

Most of the time " GET_DBSIZE_INFO" should suffice in getting DB size. However, sometimes DB2 gives '-1' as it is shown below (don't know why it is ).

db2 "CALL GET_DBSIZE_INFO(?, ?, ?, -1) "

  Value of output parameters
  --------------------------
  Parameter Name  : SNAPSHOTTIMESTAMP
  Parameter Value : 2014-01-16-09.22.03.122236

  Parameter Name  : DATABASESIZE
  Parameter Value : 122732959662080

  Parameter Name  : DATABASECAPACITY
  Parameter Value : -1

  Return Status = 0

Recently, I started using below SQL.

db2 "select sum(TBSP_TOTAL_SIZE_KB)/1024/1024 allocated_GB, sum(TBSP_USED_SIZE_KB)/1024/1024 Used_GB, 
sum(TBSP_FREE_SIZE_KB)/1024/1024 free_GB 
from sysibmadm.TBSP_UTILIZATION with ur"

No comments:

Post a Comment