归档日志激增的危害是巨大的,最严重的结果就是数据库无法正常工作,导致整个系统无法正常工作,其次就算数据库可以正常工作,但激增的归档会对磁盘产生大量消耗,导致性能下降。 select to_char(first_time,'mmdd hh24'),count(*) from v$log_history group by to_char(first_time,'mmdd hh24') order by 1;
col program for a30 col machine for a30 select a.sid,a.logon_time,a.username,a.program,a.machine,a.status,round(b.value/1024/1024) mb from v$session a,(select * from (select * from v$sesstat where statistic# = (select statistic# from v$statname where name='redo size') order by value desc) where rownum<=100) b where a.sid=b.sid;
3.截取归档日志激增时候的AWR报告,在sql统计中仔细排查dml类型sql,并查询嫌疑的sql的执行计划、统计信息等(@?/rdbms/admin/awrsqrpi),还可以找出嫌疑sql所对应的表信息是否有异常。还可以对应之前正常时候其sql的统计信息进行对比。
select sql_id,sql_text from v$open_cursor where sid=xxx;
5.查看异常表的信息: select avg_row_len from dba_tables where table_name=upper('table_name'); /*表的长度(字节)*/ select index_name from dba_indexes where table_name=upper('table_name'); /*其拥有的索引,索引越多,归档越多*/
6.挖掘归档内容: exec dbms_logmnr.ADD_LOGFILE('/datavg/archive/1_11111.dbf'); exec DBMS_LOGMNR.START_LOGMNR; select substr(sql_redo,1,30),count(*) from v$logmnr_contents group by substr(sql_redo,1,30) ;
通过以上的步骤,异常的sql、异常的会话、异常的表,和实施人员或者开发人员共同探讨一下,基本可以确定是什么问题导致,然后修正即可。 |
|