普通表轉換為分割槽表 oracle9i

2021-04-18 22:55:54 字數 1172 閱讀 4381

以下為在乙個專案中寫的解決**(資料庫為oracle9i,在執行下面的**時,系統需要停掉):

-- *****其他資訊mt表*****=

create table t_other_mt_new

partition by list(send_request_status)

(partition part_no         values    (0),

partition part_send_suc   values    (1),

partition part_send_fail  values    (2),

partition part_sending    values    (3),

partition part_rcv_fail   values    (4),

partition part_rcv_succ   values    (5),

partition part_expt_stop  values    (8)

)as select *

from t_other_mt;

drop  table t_other_mt;

alter table t_other_mt_new rename  to t_other_mt;

alter table t_other_mt enable row movement;

-- 給表新增約束

alter table t_other_mt

add constraint pk_other_mt primary key (mt_pk);

-- 給該錶新增索引

create index i_other_mt_push_pk

on t_other_mt(push_pk desc)

tablespace kts_index local

;create bitmap index i_other_mt_sendrequeststatus

on t_other_mt(send_request_status)

tablespace kts_index local

;create bitmap index i_other_mt_sync_status

on t_other_mt(sync_status)

tablespace kts_index local

;

Oracle建立普通表轉換為分割槽表

在oracle中要把表名重名名為字串加上日期格式 使用下面命令 begin execute immediate alter table old table name rename to new table name to char sysdate,yyyymmdd end commit 利用交換表把...

普通表轉換分割槽表操作步驟

普通表轉換分割槽表操作步驟 1.轉分割槽表原因 生產資料庫,一張表,一億多行資料,絕大部分查詢按月為維度做時間範圍查詢,未分割槽狀態下,查詢io量大,計畫以分割槽截剪的方式減少io量,提公升前前台查詢效能 2.實施目的 3.注意事項 1 資料庫若是雙節點,只需在其中乙個節點的資料庫上實施。2 實施中...

oracle將普通表改為分割槽表

oracle的普通表沒有辦法通過修改屬性的方式直接轉化為分割槽表,必須通過重建的方式進行轉變,下面介紹三種效率比較高的方法,並說明它們各自的特點。方法一 利用原表重建分割槽表。步驟 sql create table t id number primary key,time date 表已建立。sql...