After the structure of a table is changed, You Need To reorg the table and reorganize its directory statistics to provide information for the database access plan, so as to perform operations on it efficiently.
When a column of a table is added to a database for maintenance, the reorg operation is performed on it. An error occurs "? The error cause for sql0xxx "check is that the physical space is full. Then, check $ db2_install_dir/sqllib/db2dump/and view db2diag. log to find that the tablespace size is insufficient. If reorg table does not specify the tablespace to use for reorg operations, the tablespace where the table is located will be used by default. reorg table and index XXX means that the table and its indexes are reorg together, the system temporary tablespace is used by default.
My table has a large amount of data, so I created a new temporary tablespace named mytempspace1 on a disk with a large space, then use the tablespace for reorg operation reorg table $ tablename index $ indexname use mytempspace1
This table space will be created here. Its pagesize must match the pagesize of the table. Then, the maintenance personnel can use the statements used to create the table space in the original DB2 to refer to creating their own new table space. Use db2look-d $ dbname-l-e-x-o $ db. Layout
In this way, you can view dB. layout to copy some parameters of the originally created tablespace.
At the end of the execution, because my table is too big, there is still a problem. When my temporary tablespace is reduced by about 40 GB, I don't need this space (I still have more than 50 GB space. I don't know if it restricts this space when I create a tablespace. I haven't checked it yet ), when the default temporary system tablespace (30 GB) is used up, the system reports that the error space is insufficient.
At that time, it was about to crash. I tried to only execute reorg table $ tablename use mytempspace1. After one hour of execution, the execution was successful !!!