拆分Table 為Partition Table
---直接看例子
--drop table partt;
CREATE TABLE Partt
(logid number(*) NOT NULL,
name VARCHAR2(100),
lasterddl date)
select * from dba_objects where mod(object_id,10)=0
insert into partt select object_id,object_name,last_ddl_time from dba_objects where mod(object_id,10)=0
select * from partt order by logid
drop table sppartt
CREATE TABLE Sppartt
(logid number(*) NOT NULL,
name VARCHAR2(100),
lasterddl date)
partition by range(logid)
(
--PARTITION P0801 VALUES LESS THAN (1500),
--PARTITION P0901 VALUES LESS THAN (3000),
--PARTITION P1001 VALUES LESS THAN (5000),
PARTITION Pmax VALUES LESS THAN (MAXVALUE)
)
select * from Sppartt
select * from partt
alter table Sppartt exchange partition Pmax with table partt;
select count(*) from sppartt
select count(*) from partt
select count(*) from sppartt partition(pmax);
---拆分Partition Table 需要一個拆兩個,並且從大到小拆。
alter table sppartt split partition Pmax AT (5000) into (partition P1001,partition pmax);
select count(*) from sppartt partition(P1001)
select count(*) from sppartt partition(pmax)
alter table sppartt split partition P1001 AT (3000) into (partition P0901,partition P1001);
select count(*) from sppartt partition(P0901)
select count(*) from sppartt partition(P1001)
alter table sppartt split partition P0901 AT (1500) into (partition P0801,partition P0901);
select count(*) from sppartt partition(P0801)
select count(*) from sppartt partition(P0901)
select * from dba_objects where object_name=upper('sppartt')
select * from v$tablespace
TS_LIS2
TS_LIS3
TS_LIS1
---move partition table 到不同的Tablespace
alter table sppartt move partition p0801 tablespace ts_lis1;
alter table sppartt move partition p0901 tablespace ts_lis2;
alter table sppartt move partition p1001 tablespace ts_lis3;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/34596/viewspace-614977/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 普通table 轉換為partition tableOracle
- partition table and partition indexIndex
- [Oracle] Partition table exchange Heap tableOracle
- partition table test
- partition table(1)
- partition table(2)
- When to Partition a Table
- create a partition table using a exsit table
- 分割槽表PARTITION table
- db2 partition table testDB2
- Interval Partition table 11G
- Oracle分割槽表(Partition Table)Oracle
- How to partition a non-partitioned table
- 分割槽表PARTITION table(轉)
- partition table中truncate應用
- partition table update partition-key result in changing tablespace
- mysql partition table use to_days bugMySql
- 關於partition table import的問題Import
- doesn't contain a valid partition tableAI
- add hash partition , default tablespace for patitioned table
- 【DB】Direct Path EXP Corrupts The Dump If An Empty Table Partition Exists
- Applying “Incremental Statistic” for Oracle Big Partition TableAPPREMOracle
- Data Warehouse Guide閱讀筆記(七):partition tableGUIIDE筆記
- ext4 lvreduce報錯superblock or the partition table is likely to be corruptVRBloC
- TiDB 原始碼閱讀系列文章(二十)Table PartitionTiDB原始碼
- css中display設定為table、table-row、table-cell後的作用及其注意點CSS
- 今天測試了一下update partition table的part key
- html~table、table cell的使用HTML
- 如何修改table及partitions Table
- User defined table type and table valued parameters
- audit drop table為什麼不行
- SNMP TABLE ERROR : Requested table is empty or does not existError
- TABLE size (including table,index,lob,lobindex)Index
- drop table和truncate table的區別
- best practice of rebuild your partition table local index online by using: "update indexes"RebuildIndex
- Table Monitor
- JavaScript動態為table表格新增行JavaScript
- Flink Table/SQL API 規劃 —— Dynamic TableSQLAPI