Here, we will share with you the practical operation skills for DB2 to calculate the size of the remaining database space, including statistics on the tablespace usage of all nodes, the following describes how to view the tablespace usage and output parameter values.
1. Count the tablespace usage of all nodes
- select substr(TABLESPACE_NAME,1,20) as TBSPC_NAME,bigint(TOTAL_PAGES * PAGE_SIZE)/1024/1024 as
- "TOTAL(MB)",used_pages*PAGE_SIZE/1024/1024 as "USED(MB)", free_pages*PAGE_SIZE/1024/1024 as
- "FREE(MB)" from table(snapshot_tbs_cfg('DB_NAME', -2)) as snapshot_tbs_cfg
View tablespace usage
- select substr(tbsp_name,1,20) as TABLESPACE_NAME,substr(tbsp_content_type,1,10)
- as TABLESPACE_TYPE,sum(tbsp_total_size_kb)/1024 as TOTAL_MB,sum(tbsp_used_size_kb)/1024 as USED_MB,
- sum(tbsp_free_size_kb)/1024 as FREE_MB,tbsp_page_size AS PAGE_SIZE from SYSIBMADM.
- TBSP_UTILIZATION group by tbsp_name,tbsp_content_type,tbsp_page_size
- order by 1
- db2 call GET_DBSIZE_INFO (?,?,?,0)
Output parameter value
Parameter Name: SNAPSHOTTIMESTAMP
Parameter Value: 2008-05-26-10.53.06.421000
Parameter Name: DATABASESIZE
Parameter Value: 1203863552
Parameter Name: DATABASECAPACITY
Parameter Value: 4281493504
- unit=byte, byte/1024/1024=m
- db2 call GET_DBSIZE_INFO (?,?,?,0)
Yes, v9 and above are supported. This storage process is very convenient to view the database size and capacity. If it is convenient to view the SQL above the table space usage, haha
In the DPF environment, db2 call GET_DBSIZE_INFO (?,?,?, 0) You can only view the dbsize, but not the db capacity. The above content is an introduction to DB2's skills for finding the remaining database space. I hope you will have some gains.
The above content is a description of DB2's residual database space skills, hoping to help you in this regard.