merge_partition

本文介绍如何在Oracle数据库中合并分区并重新构建索引,包括调整会话设置、合并指定分区到新分区、释放未使用的存储空间及在线重建索引等操作。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

set echo on time on timing on spool 01_merge_partition.log

@/testdb/change/env/env_test.sql connect &V_testDATA_UN/&V_testDATA_PW

show user

select index_name from user_indexes where status='UNUSABLE'; select index_name , partition_name from user_ind_partitions where status !='USABLE';

set echo on termout on feedback 1 set timing on time on

alter session set sort_area_size=300000000;

whenever sqlerror exit;

------------------------------     TABLE: test_MOVEMENT     ------------------------------

alter table test_MOVEMENT merge partitions  part144, part145 into partition part145 tablespace TSP_L;

alter table test_MOVEMENT deallocate unused;

alter index test_MOVE_PK1 rebuild online tablespace IDX_L;

alter index test_MOVE_IDX1 rebuild PARTITION part145 TABLESPACE IDX_L;

alter index test_MOVE_IDX2 rebuild PARTITION part145 TABLESPACE IDX_L;

alter index test_MOVE_IDX3 rebuild PARTITION part145 TABLESPACE IDX_L;

alter index test_MOVE_IDX4 rebuild PARTITION part145 TABLESPACE IDX_L;

alter index test_MOVE_IDX5 rebuild PARTITION part145 TABLESPACE IDX_L;

------------------------------     TABLE: test_CONT_AUDIT_LOG     ------------------------------

alter table test_CONT_AUDIT_LOG merge partitions  part147, part148 into partition part148 tablespace TSP_L;

alter table test_CONT_AUDIT_LOG deallocate unused;

alter index test_CONT_AUDIT_LOG_PK rebuild online tablespace IDX_L;

------------------------------     TABLE: test_test     ------------------------------

alter table test_test merge partitions part144, part145 into partition part145 tablespace TSP_L;

alter table test_test deallocate unused;

alter index test_test_PK rebuild tablespace IDX_L;

alter index test_test_IDX5 rebuild tablespace IDX_L;

alter index test_test_IDX7 rebuild tablespace IDX_L;

alter index test_test_IDX1 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX2 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX3 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX4 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX6 rebuild partition part145 tablespace IDX_L;

 

------------------------------     TABLE: test_test     ------------------------------

alter table test_test merge partitions part150, part151 into partition part151 tablespace TSP_L;

alter table test_test deallocate unused;

alter index test_test_IDX1 rebuild partition part151 tablespace IDX_L;

alter index test_test_PK rebuild tablespace IDX_L;

------------------------------     TABLE: test_test     ------------------------------

alter table test_test merge partitions part144, part145 into partition part145 tablespace TSP_L;

alter table test_test deallocate unused;

alter index test_test_PK rebuild tablespace IDX_L;

alter index test_test_IDX1 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX2 rebuild partition part145 tablespace IDX_L;

alter index test_test_IDX3 rebuild partition part145 tablespace IDX_L;

----------------------------------------------------------------------------------------------

select index_name , partition_name from user_ind_partitions where status !='USABLE';

select index_name from user_indexes where status='UNUSABLE';

select distinct status from user_indexes; select distinct status from user_ind_partitions;

spool off

转载于:https://www.cnblogs.com/feiyun8616/p/5893191.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值