When using the DB2 database, if the tablespace is full, how can we resize it? The following describes how to expand the tablespace of a DB2 database for your reference.
1) Example of directly adding a container:
Db2 "alter tablespace payroll add (DEVICE '/dev/rhdisk9' 10000 )"
After adding a container, DB2 will have an automatic balance process, which may last for several hours !!! Be sure to pay attention to this option. check whether this option can meet your business needs before modification!
2) change the size of the existing container (this method does not trigger the balance, but if the tablespace is created on the bare device, the space of the bare device will be expanded ):
Db2 "alter tablespace TS1 RESIZE (FILE '/conts/cont0' 2000, devic'/dev/rcont1 '2000, FILE 'cont2' 2000 )"
Note that this method is to change the size of the original container to 2000 pages.
Db2 "alter tablespace TS1 RESIZE (ALL 2000 )"
This method is to change the size of all containers in the tablespace to 2000 pages.
Db2 "alter tablespace TS1 EXTEND (FILE '/conts/cont0' 1000, devic'/dev/rcont1 '1000, FILE 'cont2' 1000 )"
This method expands the corresponding containers by 1000 pages, that is, by 1000 pages.
Db2 "alter tablespace DATA_TS EXTEND (ALL 1000 )"
This method adds 1000 pages to all containers.