top of page

How to find and calculate Database size in DB2?

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"

jc_logo.png

Hi, thanks for stopping by!

Welcome! to my “Muse & Learn” blog.

This website will help you to learn useful queries/SQL, Tips to troubleshoot problem and their remediation, perform DB related activities etc... and don't forget to muse with us :)....

It cover few useful information on below topics :

 

MySQL, SQL Server, DB2, Linux/UNIX/AIX, HTML ....

Let the posts
come to you.

Thanks for submitting!

  • Instagram
  • Facebook
  • Twitter
© 2023 By ImJhaChandan

Subscribe to Our Newsletter

Thanks for submitting!

  • Facebook
  • Instagram
  • Twitter

© 2020-2023 By ImJhaChandan

bottom of page