在 DB2 版本 10 及以上版本中,如何将表从一个表空间(16K 页大小) move 到另一个表空间(32K 页大小)?我想避免重命名、创建另一个表、复制数据、删除重命名的表等选项。
在 Oracle 世界中,通过简单的 ALTER 语句也可以实现相同的目的。我的问题是 DB2 有类似的东西吗?
最佳答案
如果在 DB2 10 for z/OS 上,手册会建议以下内容
To move a table to a table space of a different page size:
- Unload the table using UNLOAD FROM TABLE or REORG UNLOAD EXTERNAL FROM TABLE.
- Use CREATE TABLE LIKE on the table to re-create it in the table space of the new page size.
- Use DB2® Control Center, DB2 Administration Tool for z/OS®, or catalog queries to determine the dependent objects: views, authorization, plans, packages, synonyms, triggers, referential integrity, and indexes.
- Drop the original table.
- Rename the new table to the name of the old table using RENAME TABLE.
- Re-create all dependent objects.
- Rebind plans and packages.
- Reload the table using data from the SYSRECnn data set and the control statements from the SYSPUNCH data set, which was created when the table was unloaded.
对于 Db2(对于 LUW),使用 ADMIN_MOVE_TABLE
The
ADMIN_MOVE_TABLE
stored procedure moves the data in an active table into a new table object with the same name, while the data remains online and available for access.
关于DB2 - 将表从一个表空间 move 到另一个表空间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61479518/