DB2 - 将表从一个表空间 move 到另一个表空间

标签 db2 move tablespace

在 DB2 版本 10 及以上版本中,如何将表从一个表空间(16K 页大小) move 到另一个表空间(32K 页大小)?我想避免重命名、创建另一个表、复制数据、删除重命名的表等选项。

在 Oracle 世界中,通过简单的 ALTER 语句也可以实现相同的目的。我的问题是 DB2 有类似的东西吗?

最佳答案

如果在 DB2 10 for z/OS 上,手册会建议以下内容

https://www.ibm.com/support/knowledgecenter/en/SSEPEK_10.0.0/admin/src/tpc/db2z_movetabledifferentpagesize.html

To move a table to a table space of a different page size:

  1. Unload the table using UNLOAD FROM TABLE or REORG UNLOAD EXTERNAL FROM TABLE.
  2. Use CREATE TABLE LIKE on the table to re-create it in the table space of the new page size.
  3. 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.
  4. Drop the original table.
  5. Rename the new table to the name of the old table using RENAME TABLE.
  6. Re-create all dependent objects.
  7. Rebind plans and packages.
  8. 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

https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.5.0/com.ibm.db2.luw.sql.rtn.doc/doc/r0055069.html

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/

相关文章:

c++ - boost move 编译错误

oracle - PL/SQL 开发人员导入转储

docker - 在 Mac 上从 Docker 使用 Db2 Developer-C Edition 时出现问题

sql - 检查是否存在于 SQL CASE 语句中

带有 .NET Core 2.1 的 DB2

c++ - 为什么我不能 move map 的元素?

C++ move 具有整数成员的对象的语义

Oracle 表空间 maxsize "unlimited"并不是真正无限

oracle11g - 更改表移动命令 - ORACLE

jdbc - 在哪里可以下载与 JDK 1.5 兼容的 DB2 JDBC 驱动程序?