top of page

How to find and calculate Database size in DB2?

  • Nov 17, 2020
  • 1 min read

We can use follow below four methods to find and calculate database size in DB2:


METHOD 1 : GET_DBSIZE_INFO

db2 connect to <database_name> db2 "CALL GET_DBSIZE_INFO (?, ?, ?, -1)"

METHOD 2 : snapshot_tbs_cfg


snapshot_tbs_cfg (in MB)

db2 connect to <database_name> db2 "select (sum(total_pages)* 4096)/(1024*1024) Tot_allocat_spceinMB from table(snapshot_tbs_cfg(' ',-1)) TBS_SPCE"

snapshot_tbs_cfg (in GB)

db2 "select (SUM(total_pages)*4)/(1024.0*1024) TOTAL_ALLOCATED_SPACE_IN_GB from table (snapshot_tbs_cfg('',-1)) TBS_SPCE" db2 connect reset


METHOD 3 : systools.stmg_dbsize_info

db2 "SELECT db_size, db_capacity FROM systools.stmg_dbsize_info"
db2 "select db_size/1073741824 as SIZE_GB, db_capacity/1073741824 as CAPACITY_GB from systools.stmg_dbsize_info"


METHOD 4 : sysibmadm.TBSP_UTILIZATION

db2 "select sum(TBSP_USED_SIZE_KB) as DATABASE_SIZE from sysibmadm.TBSP_UTILIZATION"

Comments


jc_logo.png

Hi, thanks for stopping by!

Welcome to my “Muse & Learn” blog!
Muse a little, learn a lot.✌️

 

Here you’ll find practical SQL queries, troubleshooting tips with fixes, and step-by-step guidance for common database activities. And of course, don’t forget to pause and muse with us along the way. 🙂
 

I share insights on:​​

  • Db2

  • MySQL

  • SQL Server

  • Linux/UNIX/AIX

  • HTML …and more to come!
     

Whether you’re just starting out or looking to sharpen your DBA skills, there’s something here for you.

Let the posts
come to you.

Thanks for submitting!

  • Instagram
  • Facebook
  • X
2020-2025 © TechWithJC

Subscribe to Our Newsletter

Thanks for submitting!

  • Facebook
  • Instagram
  • X

2020-2025 © TechWithJC

bottom of page