归档模式下,IO有可能会因归档过快而产生瓶颈;
解决思路:
一、查看单天归档频率是否全天比较均匀,语句如下:
select sequence#,
first_time,
nexttime,
round(((first_time - nexttime) * 24) * 60, 2) diff
from (select sequence#,
first_time,
lag(first_time) over(order by sequence#) nexttime
from v$log_history
where thread# = 1 and to_char(first_time,'yyyymmdd')=':1')
order by sequence# desc;
二、如每小时归档频率差异性不大,改动联机重做日志大小
1、添加新的日志组:
alter database add logfile group {0} '{1}/redo{0}.log' size {2}M;
2、切换日志组,使旧日志组为非激活状态:
alter system switch logfile;
3、删除旧日志组:
alter database drop logfile group {0};
alter database add logfile group {0} '{1}/redo{0}.log' size {2}M;
2、切换日志组,使旧日志组为非激活状态:
alter system switch logfile;
3、删除旧日志组:
alter database drop logfile group {0};
三、如切换频率波动过大,需要与开发沟通对应DML语句的情况,下方提供根据归档日志挖掘出数量过大的DML语句(数据库版本:11.2.0.4)
1、执行oracle脚本:
@$ORACLE_HOME/rdbms/admin/dbmslm.sql
@$ORACLE_HOME/rdbms/admin/dbmslmd.sql;
2、使用归档切换频繁时期的归档文件,进行语句挖掘
exec sys.dbms_logmnr.add_logfile(logfilename => '{归档文件路径/归档文件名}
',options => dbms_logmnr.new);
exec sys.dbms_logmnr.start_logmnr(options => sys.dbms_logmnr.dict_from_online_catalog);
3、查看每个用户该时段的DML操作次数:
select seg_owner,count(*) from v$logmnr_contents group by seg_owner;
4、查看具体语句执行次数:
select count(1),substr(sql_redo,1,50) from v$logmnr_contents group by substr(sql_redo,1,50) order by count(1) desc ;
5、结束挖掘
exec sys.dbms_logmnr.end_logmnr;