db2 partition table test
db2 => CREATE TABLE carsales(sale_date DATE, VIN char(30)) PARTITION BY RANGE(sale_date) (part q113 STARTING MINVALUE ENDING '3/31/2013' EXCLUSIVE, part q213 STARTING '3/31/2013' ENDING '6/30/2013' EXCLUSIVE, part q313 STARTING '6/30/2013' ENDING '9/30/2013' EXCLUSIVE, part q413 STARTING '9/30/2013' ENDING '12/31/2013')
DB20000I The SQL command completed successfully.
db2 => describe data partitions for table carsales show detail
PartitionId PartitionName TableSpId PartObjId IndexTblSpId LongTblSpId AccessMode
Status
----------- ------------------------------- ----------- ----------- ------------ ----------- - ------
0 Q113 2 523 2 2 F
1 Q213 2 524 2 2 F
2 Q313 2 525 2 2 F
3 Q413 2 526 2 2 F
4 record(s) selected.
PartitionId Inclusive (y/n) Inclusive (y/n)
Low Value High Value
----------- - ------------------------------- - -------------------------------
0 Y MINVALUE N '2013-03-31'
1 Y '2013-03-31' N '2013-06-30'
2 Y '2013-06-30' N '2013-09-30'
3 Y '2013-09-30' Y '2013-12-31'
4 record(s) selected.
db2 => alter table carsales detach partition q113 into tblq113
DB20000I The SQL command completed successfully.
db2 => describe data partitions for table carsales show detail
PartitionId PartitionName TableSpId PartObjId IndexTblSpId LongTblSpId AccessMode
Status
----------- ------------------------------- ----------- ----------- ------------ ----------- - ------
1 Q213 2 524 2 2 F
2 Q313 2 525 2 2 F
3 Q413 2 526 2 2 F
3 record(s) selected.
PartitionId Inclusive (y/n) Inclusive (y/n)
Low Value High Value
----------- - ------------------------------- - -------------------------------
1 Y '2013-03-31' N '2013-06-30'
2 Y '2013-06-30' N '2013-09-30'
3 Y '2013-09-30' Y '2013-12-31'
3 record(s) selected.
db2 => insert into tblq113 values('2013-01-01','Jan')
db2 => ALTER TABLE carsales ATTACH PARTITION STARTING MINVALUE ENDING ('3/31/2013') EXCLUSIVE FROM tblq113
SQL3601W The statement caused one or more tables to automatically be placed
in the Set Integrity Pending state. SQLSTATE=01586
db2 => set integrity for carsales immediate checked
DB20000I The SQL command completed successfully.
db2 => select * from carsales
SALE_DATE VIN
---------- ------------------------------
01/01/2013 Jan
1 record(s) selected.
db2 =>
DB20000I The SQL command completed successfully.
db2 => describe data partitions for table carsales show detail
PartitionId PartitionName TableSpId PartObjId IndexTblSpId LongTblSpId AccessMode
Status
----------- ------------------------------- ----------- ----------- ------------ ----------- - ------
0 Q113 2 523 2 2 F
1 Q213 2 524 2 2 F
2 Q313 2 525 2 2 F
3 Q413 2 526 2 2 F
4 record(s) selected.
PartitionId Inclusive (y/n) Inclusive (y/n)
Low Value High Value
----------- - ------------------------------- - -------------------------------
0 Y MINVALUE N '2013-03-31'
1 Y '2013-03-31' N '2013-06-30'
2 Y '2013-06-30' N '2013-09-30'
3 Y '2013-09-30' Y '2013-12-31'
4 record(s) selected.
db2 => alter table carsales detach partition q113 into tblq113
DB20000I The SQL command completed successfully.
db2 => describe data partitions for table carsales show detail
PartitionId PartitionName TableSpId PartObjId IndexTblSpId LongTblSpId AccessMode
Status
----------- ------------------------------- ----------- ----------- ------------ ----------- - ------
1 Q213 2 524 2 2 F
2 Q313 2 525 2 2 F
3 Q413 2 526 2 2 F
3 record(s) selected.
PartitionId Inclusive (y/n) Inclusive (y/n)
Low Value High Value
----------- - ------------------------------- - -------------------------------
1 Y '2013-03-31' N '2013-06-30'
2 Y '2013-06-30' N '2013-09-30'
3 Y '2013-09-30' Y '2013-12-31'
3 record(s) selected.
db2 => insert into tblq113 values('2013-01-01','Jan')
db2 => ALTER TABLE carsales ATTACH PARTITION STARTING MINVALUE ENDING ('3/31/2013') EXCLUSIVE FROM tblq113
SQL3601W The statement caused one or more tables to automatically be placed
in the Set Integrity Pending state. SQLSTATE=01586
db2 => set integrity for carsales immediate checked
DB20000I The SQL command completed successfully.
db2 => select * from carsales
SALE_DATE VIN
---------- ------------------------------
01/01/2013 Jan
1 record(s) selected.
db2 =>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/725820/viewspace-2125516/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- TiDB 原始碼閱讀系列文章(二十)Table PartitionTiDB原始碼
- [20191203]enq: ZA - add std audit table partition.txtENQ
- ext4 lvreduce報錯superblock or the partition table is likely to be corruptVRBloC
- 今天測試了一下update partition table的part key
- ESP32 編譯報錯 57) boot: no bootable app partitions in the partition table編譯bootAPP
- 教你解決ghost win10開機出現invalid partition table的方法Win10
- Partition Pruning和Partition-Wise Joins
- Clique Partition
- oracle partition by group by,詳解partition by和group by對比Oracle
- 分割槽Partition
- 如何解決acer電腦安裝win10開機出現invalid partition table的問題Win10
- test
- 7.74 DATAOBJ_TO_PARTITIONOBJ
- 86. Partition List
- oracle partition by 語法Oracle
- B. Range and Partition
- fdisk時WARNING: Re-reading the partition table failed with error 16: 裝置或資源忙 的問題解決方案AIError
- test_NO
- Unit test
- Peace or partition? Cyprus - Espresso EconomistEspresso
- 7.73 DATAOBJ_TO_MAT_PARTITIONOBJ
- 3-Partition 問題
- 【Android Test】糟心的“Empty test suite ”異常AndroidUI
- DB2 WLMDB2
- AB test 中的AA test有什麼作用?
- db2 -attribute of key are miss in result set . db2 錯誤DB2
- Codeforces 1948E Clique Partition
- 分割槽partition知識點
- Partition|Disk Utility 如何分割磁碟
- ROWNUMBER() OVER( PARTITION BY COL1
- test easyui with nodejsUINodeJS
- Test Oracle triggerOracle
- test123
- test日記
- test2024.3.21
- Shell test 命令
- test6
- test4
- test2