How can I change the size of a tablespace in db2?
To adjust the size of the tablespace, you can follow these steps:
- Firstly, log in to the DB2 database system.
- View the current size of the tablespace using the following command:
SELECT TBSP_NAME, TBSP_USED_PAGES, TBSP_TOTAL_PAGES
FROM SYSIBMADM.TBSP_UTILIZATION
WHERE TBSP_TYPE = 'DMS';
- Identify the tablespace you want to modify, and then use the following command to adjust the tablespace size:
ALTER TABLESPACE <表空间名称> RESIZE <新的页数>;
For example, to increase the size of tablespace “USERSPACE1” to 100,000 pages, you can use the following command:
ALTER TABLESPACE USERSPACE1 RESIZE 100000;
- Use the following command to confirm that the tablespace size has been successfully modified:
SELECT TBSP_NAME, TBSP_USED_PAGES, TBSP_TOTAL_PAGES
FROM SYSIBMADM.TBSP_UTILIZATION
WHERE TBSP_TYPE = 'DMS';
Please note that altering the tablespace size may impact the database performance, so make sure to back up and perform the operation during off-peak hours.