Oracle 普通table 轉換為partition table
1.建立eg table
SQL> create table pp (id int,dt date);
Table created.
SQL> create index pp_index on pp(id);
index created.
begin
for i in 1..10000000 loop
if mod(i,3)=1 then
insert into pp values(i,to_date('2013/6/6','yyyy/mm/dd'));
elsif mod(i,3)=2 then
insert into pp values(i,to_date('2014/6/6','yyyy/mm/dd'));
else
insert into pp values(i,to_date('2015/5/5','yyyy/mm/dd'));
end if;
end loop;
commit;
end;
/
現在將pp錶轉換為partition table.
2.create partition table
SQL> edit
Wrote file afiedt.buf
1 create table pp_copy
2 (id int,dt date)
3 partition by range(dt)
4 (partition p1 values less than(to_date('2014/01/01','yyyy/mm/dd')) tablespace users,
5 partition p2 values less than(to_date('2015/01/01','yyyy/mm/dd')) tablespace users,
6 partition p3 values less than(to_date('2016/01/01','yyyy/mm/dd')) tablespace users,
7* partition p4 values less than(maxvalue) tablespace users)
SQL> /
SQL> insert into pp_copy select * from pp;
10000000 rows created.
SQL> commit;
Commit complete.
SQL> drop table pp purge;
Table dropped.
SQL> alter table pp_copy rename to pp;
Table altered.
SQL> create index pp_index on pp(id) tablespace users local;
Index created.
如果有package,procedure,view則需要重新編譯。
alter package package_name compile;
alter procedure procedure_name compile;
alter view view_name compile;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-1852252/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 拆分Table 為Partition Table
- [Oracle] Partition table exchange Heap tableOracle
- partition table and partition indexIndex
- Oracle分割槽表(Partition Table)Oracle
- 分割槽表PARTITION table(轉)
- partition table test
- partition table(1)
- partition table(2)
- When to Partition a Table
- Oracle 普通Table進行ReorgOracle
- create a partition table using a exsit table
- 分割槽表PARTITION table
- oracle cache table(轉)Oracle
- Applying “Incremental Statistic” for Oracle Big Partition TableAPPREMOracle
- db2 partition table testDB2
- Interval Partition table 11G
- How to partition a non-partitioned table
- partition table中truncate應用
- partition table update partition-key result in changing tablespace
- Oracle Pipelined Table(轉)Oracle
- 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
- Oracle 將普通錶轉換為分割槽表Oracle
- Oracle Pipelined Table Functions(轉)OracleFunction
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- oracle temporary tableOracle
- oracle shrink tableOracle
- Oracle Table LocksOracle
- Alter table for ORACLEOracle
- Oracle Table FunctionOracleFunction
- js 將xml轉換為table表格簡單程式碼例項JSXML
- layui將table轉化表單顯示(即table.render轉為表單展示)UI
- 【DB】Direct Path EXP Corrupts The Dump If An Empty Table Partition Exists
- Oracle -- 深入體會PLAN_TABLE、PLAN_TABLE$Oracle
- Oracle --- PLAN_TABLE$和PLAN_TABLE區別Oracle
- Oracle table selectOracle