日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

oracle分区表带入SQL语句,Oracle 分区表常用SQL语句 (转载)

發布時間:2023/12/10 数据库 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 oracle分区表带入SQL语句,Oracle 分区表常用SQL语句 (转载) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

*********

為分區表建立一個單獨的表空間

*********/create tablespace ts_partition datafile '/home/oracle/oradata/esales/partition.dbf' size 10M

extent management local uniform size 2M;

/*********

建立分區表

*********/create table bigtable

(

sale_date date,

product_id number,

sale_count number,

charge number,

sales_id number

)

tablespace ts_partition

pctfree 5

pctused 80

initrans 1

maxtrans 255

parallel(degree 2)

storage

(

initial 2M

next 2M

minextents 1

maxextents unlimited

pctincrease 0

)

partition by range(sale_date)

(

partition sale_date_20020101 values less than (to_date('20020102','yyyymmdd')),

partition sale_date_20020102 values less than (to_date('20020103','yyyymmdd'))

);

/*********

建立分區索引

*********/create index create index idx_bigtable_product_id on bigtable(product_id) parallel 2 local

tablespace users on bigtable(product_id) parallel 2 local tablespace users;

/*********

增加分區

*********/alter table bigtable add partition sale_date_20020103

values less than (to_date('20020104','yyyymmdd'));

/*********

截斷分區

*********/alter table bigtable truncate partition sale_date_20020103;

/*********

丟棄分區

*********/alter table bigtable drop partition sale_date_20020103;

/*********

交換分區

如果分區表里含有 LOCAL 的索引,此分區的索引將處于不可用狀態,需要重建:

alter index idx_bigtable_product_id rebuild partition sale_date_20020102 tablespace users;

如果被交換表和分區表的索引結構相同,可以用 including indexes 連同索引一起交換,不必重建索引。

*********/create table bigtable_temp tablespace users as select * from bigtable where 1=2;

insert into bigtable_temp values (to_date('20020102','yyyymmdd'),1,10,1,10);

commit;

alter table bigtable exchange partition sale_date_20020102 with table bigtable_temp;

/*********

移動分區

*********/alter table bigtable move partition sale_date_20020102 tablespace user2;

/*********

修改分區

*********/alter table bigtable modify partition

sale_date_20020102 storage(pctincrease 10);

/*********

重命名分區

*********/alter table bigtable rename partition

sale_date_20020102 to sale_date_20020103;

/*********

分割分區

*********/alter table bigtable add partition sale_date_20020104

values less than (to_date('20020105','yyyymmdd'));

alter table bigtable split partition sale_date_20020104

at (to_date('20020104','yyyymmdd'))

into (partition sale_date_20020103,partition sale_date_20040104);

/*********分區表數據的邏輯備份exp username/password file=bigtable20020103_4.dmp tables=(bigtable:sale_date_20020103,bigtable:sale_date_20020104)分區表數據的邏輯恢復imp username/password file=bigtable20020103_4.dmp tables=(bigtable:sale_date_20020103,bigtable:sale_date_20020104) ignore=y*********/

總結

以上是生活随笔為你收集整理的oracle分区表带入SQL语句,Oracle 分区表常用SQL语句 (转载)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。