龙空技术网

oracle表分区(range,hash)分区--笔记

在水一方357159258 205

前言:

当前姐妹们对“oraclehash子分区”大致比较珍视,大家都想要学习一些“oraclehash子分区”的相关知识。那么小编也在网摘上汇集了一些关于“oraclehash子分区””的相关内容,希望各位老铁们能喜欢,兄弟们一起来了解一下吧!

/* range 分区,*/

create table sale(	product_id varchar2(5);	sale_count number(10);)partition by range(sale_count)(	partition p1 values less than(1000),	partition p2 values less than(2000),	partition p3 values less than(3000),	-- partition p4 values less than(maxvalue);)

select * from sale;

select * from sale partition(p1);

select * from sale partition(p2);--查看分区数据select * from user_tab_partitions;--查看分区情况alter table sale add partition p4 values less than(maxvalue);--添加alter table sale drop partition p4;--删除

更改数据时,不能跨分区操作,会出现错误,需要设置可移动的分区才能进行跨分区查询

alter table sale enable row movement;

/* hash 分区,*/

create table sale2(	product_id varchar2(5);	sale_count number(10);)partition by hash(product_id)(	partition p1,	partition p2 );

2021-11-04

标签: #oraclehash子分区