王朝网络
分享
 
 
 

Oracle 10g分区表维护中的两个注意事项

王朝oracle·作者佚名  2008-06-01
宽屏版  字体: |||超大  

Oracle 10g分区表维护中的两个注意事项:

1.全局索引

SQL> alter table analyse_content truncate subpartition DATA0712_DEYANG;

Table truncated

truncate分区后,修改或者插入数据报错:

ORA-01502: index 'phs.pk' or partition of such index is in unusable state

这个时候只能rebuild index

SQL> alter index phs.pk rebuild;

Index altered

执行以后恢复正常,或者使用如下语句:

SQL> alter table analyse_content truncate subpartition DATA0712_ZIGONG UPDATE

GLOBAL INDEXES;

Table truncated

这样它会自动恢复索引。

2.物化视图

对于已经建有fast refresh view的分区表来说,truncate和drop分区/表会导致物化视图出错。

SQL> alter table analyse_content drop subpartition DATA0712_MIANYANG;

Table altered

SQL> alter table analyse_content truncate subpartition DATA0712_LUZHOU;

Table truncated

再次查询物化视图,这个两个分区的数据仍然存在,说明物化视图不能对这种DDL语句进行更新。

尝试在基础表插入数据,报错:

ORA-32313: REFRESH FAST of " " unsupported after PMOPs

这时候必须手工刷新MV

SQL> exec dbms_mview.refresh('mv_analyse_content','f');

begin dbms_mview.refresh('mv_analyse_content','f'); end;

ORA-32313: PMOP 之后不支持 "PHS"."MV_ANALYSE_CONTENT" 的 REFRESH FAST

ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2255

ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2461

ORA-06512: 在 "SYS.DBMS_SNAPSHOT", line 2430

ORA-06512: 在 line 1

看来快速刷新'f'是不行,还是得完全刷新'c'

SQL> exec dbms_mview.refresh('mv_analyse_content','c');

PL/SQL procedure successfully completed

执行完后,MV里面的数据恢复正常,基表不再报错。

实际10g里面,truncate分区后,某些物化视图可以执行fast refresh,具体有很多限制,

要查询doc,反正select * from table这种视图肯定可以'f',不过却没有什么意义。

---2008 04 22 在doc上找到了PCT特性的限制,如下:

At least one of the detail tables referenced by the materialized view must be

partitioned.

Partitioned tables must use either range, list or composite partitioning.

The top level partition key must consist of only a single column.

The materialized view must contain either the partition key column or a partition

marker or ROWID or join dependent expression of the detail table. See Oracle

Database PL/SQL Packages and Types Reference for details regarding the DBMS_

MVIEW.PMARKER function.

If you use a GROUP BY clause, the partition key column or the partition marker or

ROWID or join dependent expression must be present in the GROUP BY clause.

If you use an analytic window function or the MODEL clause, the partition key

column or the partition marker or ROWID or join dependent expression must be

present in their respective PARTITION BY subclauses.

Data modifications can only occur on the partitioned table. If PCT refresh is being

done for a table which has join dependent expression in the materialized view,

then data modifications should not have occurred in any of the join dependent

tables.

The COMPATIBILITY initialization parameter must be a minimum of 9.0.0.0.0.

PCT is not supported for a materialized view that refers to views, remote tables, or

outer joins.

PCT-based refresh is not supported for UNION ALL materialized views.

对于海量数据库,如果不能使用DROP分区,则delete相当慢。

如果使用了,又会导致完全刷新MV,同样慢。

在物化视图的时候要认真考虑PCT特性。

对于分区表 已经相关索引,快照的维护,建议还是参考Oracle的DOC,在admin guide和

dataware house guide里有非常完善描述。虽然没有涉及internal,但完全可以满足应用。

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
>>返回首页<<
推荐阅读
 
 
频道精选
 
静静地坐在废墟上,四周的荒凉一望无际,忽然觉得,凄凉也很美
© 2005- 王朝网络 版权所有