Practical operations on DB2 to evaluate the size of the remaining database space

Source: Internet
Author: User

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

 
 
  1. select substr(TABLESPACE_NAME,1,20) as TBSPC_NAME,bigint(TOTAL_PAGES * PAGE_SIZE)/1024/1024 as  
  2. "TOTAL(MB)",used_pages*PAGE_SIZE/1024/1024 as "USED(MB)", free_pages*PAGE_SIZE/1024/1024 as  
  3. "FREE(MB)" from table(snapshot_tbs_cfg('DB_NAME', -2)) as snapshot_tbs_cfg  

View tablespace usage

 
 
  1. select substr(tbsp_name,1,20) as TABLESPACE_NAME,substr(tbsp_content_type,1,10)   
  2. as TABLESPACE_TYPE,sum(tbsp_total_size_kb)/1024 as TOTAL_MB,sum(tbsp_used_size_kb)/1024 as USED_MB,  
  3. sum(tbsp_free_size_kb)/1024 as FREE_MB,tbsp_page_size AS PAGE_SIZE from SYSIBMADM.  
  4. TBSP_UTILIZATION group by tbsp_name,tbsp_content_type,tbsp_page_size  
  5. order by 1  
  6. 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

 
 
  1. unit=byte, byte/1024/1024=m 
  2. 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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.