Rotate partitions in DB2 on z
Rotating partitions
You can use the ALTER TABLE statement to rotate any logical partition to become the last partition. Rotating partitions is supported for partitioned (non-universal) table spaces and range-partitioned table spaces, but not for partition-by-growth table spaces.
About this task
When you create a partitioned table space, you do not need to allocate extra partitions for expected growth. Instead, you can use the ALTER TABLE ADD PARTITION statement to add partitions as needed. If rotating partitions is appropriate for your application, use the ALTER TABLE ROTATE PARTITION statement to avoid adding another partition. 
Nullable partitioning columns: DB2® lets you use nullable columns as partitioning columns. But with table-controlled partitioning, DB2 can restrict the insertion of null values into a table with nullable partitioning columns, depending on the order of the partitioning key. After a rotate operation, if the partitioning key is ascending, DB2 prevents an INSERT of a row with a null value for the key column. If the partitioning key is descending, DB2 allows an INSERT of a row with a null value for the key column. The row is inserted into the first partition.
Procedure
To rotate a partition to be the last partition:
- Issue the ALTER TABLE statement and specify the ROTATE PARTITION option.
- Optional: Run the RUNSTATS utility.

Example
| Partition | Limit value | Data set name that backs the partition |
|---|---|---|
| P008 | 12/31/2004 | catname.DSNDBx.dbname.psname.I0001.A008 |
| P009 | 12/31/2005 | catname.DSNDBx.dbname.psname.I0001.A009 |
| P010 | 12/31/2006 | catname.DSNDBx.dbname.psname.I0001.A010 |
To rotate the first partition for table TRANS to be the last partition, issue the following statement:
ALTER TABLE TRANS ROTATE PARTITION FIRST TO LAST
ENDING AT ('12/31/2007') RESET;
For a table with limit values in ascending order, the data in the ENDING AT clause must be higher than the limit value for previous partitions. DB2 chooses the first partition to be the partition with the lowest limit value.
For a table with limit values in descending order, the data must be lower than the limit value for previous partitions. DB2 chooses the first partition to be the partition with the highest limit value.
The RESET keyword specifies that the existing data in the first logical partition is deleted, and no delete triggers are activated. Because the oldest (or first) partition is P001, DB2 assigns the new limit value to P001. This partition holds all rows in the range between the new limit value of 12/31/2007 and the previous limit value of 12/31/2006. The RESET operation deletes all existing data. You can use the partition immediately after the ALTER completes. The partition is not placed in REORG-pending (REORP) status, if the table is large, or if the last partition before the rotation is empty.
The following table shows a representation of the table space after the first partition is rotated to become the last partition.
| Partition | Limit value | Data set name that backs the partition |
|---|---|---|
| P002 | 12/31/1997 | catname.DSNDBx.dbname.psname.I0001.A002 |
| P003 | 12/31/1998 | catname.DSNDBx.dbname.psname.I0001.A003 |
| P004 | 12/31/1999 | catname.DSNDBx.dbname.psname.I0001.A004 |
| P005 | 12/31/2000 | catname.DSNDBx.dbname.psname.I0001.A005 |
| P006 | 12/31/2001 | catname.DSNDBx.dbname.psname.I0001.A006 |
| P007 | 12/31/2002 | catname.DSNDBx.dbname.psname.I0001.A007 |
| P008 | 12/31/2003 | catname.DSNDBx.dbname.psname.I0001.A008 |
| P009 | 12/31/2004 | catname.DSNDBx.dbname.psname.I0001.A009 |
| P010 | 12/31/2005 | catname.DSNDBx.dbname.psname.I0001.A010 |
| P011 | 12/31/2006 | catname.DSNDBx.dbname.psname.I0001.A011 |
| P001 | 12/31/2007 | catname.DSNDBx.dbname.psname.I0001.A001 |
- Parent topic: Altering partitions
Rotate partitions in DB2 on z的更多相关文章
- DB2 for z: system catalog tables
http://www.ibm.com/support/knowledgecenter/SSEPEK_10.0.0/com.ibm.db2z10.doc.sqlref/src/tpc/db2z_cata ...
- 在DB2 for z/os上创建指定pagesize的数据库
ASNTDIFF的diff table有一列类型为varchar 15000,z上创建db默认的pagesize是4K,无法创建table,所以需要创建一个大pagesize的database. db ...
- Index on DB2 for z/OS: DB2 for z/OS 的索引
可以创建在任何表上的索引: Unique Index:An index that ensures that the value in a particular column or set of col ...
- DB2 for Z/os Statement prepare
The PREPARE statement creates an executable SQL statement from a string form of the statement. The c ...
- DB2 bind on z/os
BIND and REBIND options for packages and plans There are several options you can use for binding or ...
- OGG for DB2 z/OS 12.2版本发布
2016-04-15 Oracle发布了GoldenGate for DB2 z/OS 12.2.0.1.2.可以从OTN或eDelivery下载,该版本是ogg for DB2 z/OS的第一个1 ...
- 免费数据库(SQLite、Berkeley DB、PostgreSQL、MySQL、Firebird、mSQL、MSDE、DB2 Express-C、Oracle XE)
SQLite数据库是中小站点CMS的最佳选择 SQLite 是一个类似Access的轻量级数据库系统,但是更小.更快.容量更大,并发更高.为什么说 SQLite 最适合做 CMS (内容管理系统)呢? ...
- DB2调优摘要
感谢原博主 http://yishueitian326.blog.163.com/blog/static/2858637520106695733719/ 性 能是关系到随需应变型应用程序成功与否的关键 ...
- (转)调优 DB2 UDB v8.1 及其数据库的最佳实践
原文:https://www.ibm.com/developerworks/cn/data/library/techarticles/dm-0404mcarthur/index.html 简介 性能是 ...
随机推荐
- iOS企业级开发初级课程-UIView与控件(20集)
UIView与控件向大家介绍了视图和控件之间的关系以及应用画面的建构层次.然后是对标签.按钮.文本框.文本视图.开关.滑块.分段控件.网页控件.屏幕滚动控件.等待控件.进度条.警告.动作选单.工具栏. ...
- java代码和spring框架读取xml和properties文件
1.java文件读取properties文件 Properties props = new Properties(); try { //资源文件存放在类文件的根目录下.即是放在src下面.则不需要写路 ...
- bug-android之ActivityNotFoundException
应用场景:用于安卓的短信发送功能 异常名称:Caused by: android.content.ActivityNotFoundException: No Activity found to han ...
- zabbix之Nginx安装
转载自 http://www.ttlsa.com/nginx/nginx-install-on-linux/ Nginx下载 https://pan.baidu.com/s/1qXT54sO
- linux awk, xargs
awk , 很赞的教程:http://coolshell.cn/articles/9070.html xargs, http://blog.csdn.net/andy572633/article/de ...
- jQuery调用后台方法
前台: <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.as ...
- linux系统vsftpd登陆慢卡怎么办
linux系统vsftpd登陆慢卡怎么办 浏览:145 | 更新:2013-12-31 00:50 vsftpd是linux系统中的一款ftp软件,用它可以实现文件,数据上传与下载,但有些用户会发现v ...
- android SDK manager 无法获取更新版本列表
打开SDK Manager---Tools---Options,填入如下代理和端口,勾选选项也如下. 网址:mirrors.neusoft.edu.cn 端口:80 99%是成功的 参考:http:/ ...
- Java集合中List的用法
List接口是Collection接口的子接口,List有一个重要的实现类--ArrayList类,List中的元素是有序排列的而且可重复,所以被称为是序列. List可以精确的控制每个元素的插入位置 ...
- Storm自带测试案例的运行
之前Storm安装之后,也知道了Storm的一些相关概念,那么怎么样才可以运行一个例子对Storm流式计算有一个感性的认识呢,那么下面来运行一个Storm安装目录自带的测试案例,我们的Storm安装在 ...