doyoudb2

DB2 UDB for LUW (Linux, Unix and Windows)

 
  • Increase font size
  • Default font size
  • Decrease font size

Quick Command to calculate the DB Size

E-mail Print PDF
User Rating: / 2
PoorBest 
A quick command to find out the database size is:

db2 "call get_dbsize_info(?,?,?,0)"

GET_DBSIZE_INFO is a stored procedure which calculates the size of the database (used space) and its maximum capacity (allocated space).

The DBSIZE is calculated as:


dbsize = SUM (Used pages in a tablespace X Page Size) for each tablespace and is returned in bytes

The DBCAPACITY is calculated as:

dbcapacity = SUM (DMS usable pages X Page Size) + SUM (SMS container size + file system free size per container) + Transaction LOG Size

These computed values are cached in the table SYSTOOLS.STMG_DBSIZE_INFO. The procedure can be invoked such that it will try to fetch the cached values(based on the refresh-window parameter) from this table instead of re-computing them.

for example:

To get the cached value not older than the system default of 30 minutes give the following command:


db2 "call get_dbsize_info(?,?,?,-1)"

If the value cached in the table SYSTOOLS.STMG_DBSIZE_INFO is older than 30 mins, db2 will compute the new values and populate them into the table, else it will display the old values.

To get the cached value not older than 12 hours (720 minutes) give the following command:


db2 "call get_dbsize_info(?,?,?,720)"


Note: For some reasons there is much variance in the value calculated for DBCAPACITY. In three runs of the procedure within 3 minutes, I got three different values 8368693302784 (7793 GB), 9007135917568 (8388 GB) and 9643684177408 (8981 GB). The value calculated for DBSIZE is consistent though.
Comments
Add New Search
+/-
Write comment
Name:
Email:
 
Website:
Title:
UBBCode:
[b] [i] [u] [url] [quote] [code] [img] 
 
 
Please input the anti-spam code that you can read in the image.

3.25 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

Search Site

Subscribe

Enter your email address to receive new posts directly in your Inbox:

Relax! We hate SPAM as much as you do.

Sign In/Register

Syndicate Feeds - Subscribe