oracle表如何进行分区

摘要:递归查询,记录一下,CREATETABLE[abc]([id][int]NULL,[pid][int]NULL,[name][nchar](10))GOINSERTINTO[abc]VALUES(1,a)INSERTINTO[abc]VALUES(2,b)INSERTINTO[abc]V

摘要:递归查询,记录一下,CREATETABLE[abc]([id][int]NULL,[pid][int]NULL,[name][nchar](10))GOINSERTINTO[abc]VALUES(1,a)INSERTINTO[abc]VALUES(2,b)INSERTINTO[abc]V

oracle表如何进行分区

1、by range

示例:

–手台轨迹表
CREATE TABLE HandSetTrack(
recordID VARCHAR2(36) NOT NULL,
HandSetID VARCHAR2(36) NOT NULL,
longitude VARCHAR2(128) NOT NULL,
latitude VARCHAR2(128) NOT NULL,
recordTime DATE DEFAULT sysdate,
CONSTRAINT PK_HandSetTrack PRIMARY KEY (recordID)
)
partition by range(recordTime)
interval(numtoymInterval(1,MONTH))
(
partition handset_trace_deadData values less than(to_date(2017-07-25,yyyy-mm-dd))
)

2、by hash

示例:

–车台轨迹表
CREATE TABLE CarSetTrack(
recordID VARCHAR2(36) NOT NULL,
CarSetID VARCHAR2(36) NOT NULL,
CONSTRAINT PK_CarSetTrack PRIMARY KEY (recordID)
)
partition by hash(CarSetID)
(
partition carset_trace_001,
partition carset_trace_002,
partition carset_trace_003,
partition carset_trace_004,
partition carset_trace_005,
partition carset_trace_006,
partition carset_trace_007,
partition carset_trace_008,
partition carset_trace_009,
partition carset_trace_010
)

3、查看分区

select table_name,partition_name from user_tab_partitions;

SELECT * FROM ALL_PART_TABLES WHERE TABLE_NAME = CARSETTRACK

4、删除分区

ALTER TABLE HANDSETTRACK DROP PARTITION PART_01

5、删除表

drop table HandSetTrack drop table CarSetTrack purge recyclebin

总结

以上是为你收集整理的oracle表分区全部内容,希望文章能够帮你解决oracle表分区所遇到的程序开发问题。

0 条回复 A 作者 M 管理员
    所有的伟大,都源于一个勇敢的开始!
欢迎您,新朋友,感谢参与互动!欢迎您 {{author}},您在本站有{{commentsCount}}条评论