故障现象:应用报告入库慢,
处理步骤:
1.检查数据库等待事件,发现全表扫描比较多;
2.检查此事件对应的SQL,发现都是在Insert同一张表;
3.检查此表的segment,发现此表是个分区表,此表总数据量才5W条,居然一个分区就占用了200M空间,而且此表没有大字段;
分析来看,表上肯定碎片多,和应用确认也是,他们经常delete.这里也就清晰了解决方法,可以对表move,或重建表,将数据导入,是表空间更紧凑。
我这里采用的是简单的move来实现:
alter table t_alarm_state move partition T_ALARM_STATE1 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE2 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE3 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE4 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE5 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE6 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE7 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE8 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE9 move tablespace users;
alter table t_alarm_state move partition T_ALARM_STATE10 move tablespace users;
最后对此表上的索引进行重建。重建后应用启动应用,系统恢复正常。