最近检查生产环境,alert日志中出现
Checkpoint not complete
private strand flush not complete
对于这个错误信息得解释如下:
当系统要重新利用某个日志文件的时候,系统需要将该日志文件所包括的buffer cache 中的dirty block 写到相应的数据文件。由于对于一个数据库操作而言,它可能产生的redo 量仅仅是几十字节,但是对于buffer cache中确是一个block (一般为8k)。所以,对于一个仅仅是几百M的日志文件,它所保护的buffer cache 可能是几个G
一旦发生"Thread 1 cannot allocate new log",表明系统的checkpoint 没有来得及完成,也就是说 buffer cache 中的dirty data还没有完全写到数据文件,就已经有大量的日志需要写入到系统。而系统只能通知应用:checkpoint 还没有完成,你只能等待。这个时候,系统就基本处于hang 状态了 When the database waits on checkpoints,redo generation is stopped until the log switch is done
如果,我们在这个时候查看系统信息,就会发现:v$log中的日志状态大多处于active 状态; v$session_wait 中会有很多log file switch 事件的发生
解决办法: a. 添加更多的日志文件 b. 加大checkpoint 触发的频度 c. 减小redo log 的size d. 提高DBWR的效率 e. 为了更好的了解系统的运行,可以设置
log_checkpoint_interval = 0
log_checkpoint_timeout = 0
log_checkpoints_to_alert=True
归档与非归档
http://blog.sina.com.cn/s/blog_646927650100vapd.html
http://wenku.baidu.com/view/7facdf22192e45361066f589.html
----------------------------------------------------------------------------
改变online redo log文件的大小:
select * from v$log;select * from v$logfile;
v$log的status字段有三种状态:
ACTIVE
CURRENT
INACTIVE
其中active表示正在归档,current表示当前的online redo,inactive表示已经归档。
切换日志(改变current):
alter system switch logfile; (
增量检查点 )
alter system switch checkpoint;
(full checkpoint)
如何让active变成inactive呢?1,等待归档进程完成归档操作。2,使用命令alter system checkpoint.
要想改变online redo的大小,只能改变inactive的文件,改变的步骤是 先drop 再reuse(也可以不reuse生成新的online redo文件)
alter database drop logfile group 1;
alter database add logfile group 1 'D:\oracle\....redo1.log' size 200M reuse;
如果一个OS中有多个库,千万不要把 online redo搞串了这样 会很杯具的。-----------------------------------------------------------------------------
查看参数:
db_writer_processes ,默认为cpu个数/8
dbwr_io_slaves 这二个参数和DBWn有关,DBWn有二种:多个 DBWn进程,1个DBWn带多个slave。
同时也可以修改参数
log_checkpoints_to_alert=true 查看alter对于checkpoint的情况。
-----------------------------------------------------------------------------
Alert Log Messages: Private Strand Flush Not Complete [ID 372557.1] http://blog.csdn.net/amber112/article/details/6292171
-----------------------------
1) Give the checkpoint process more time to cycle through the logs - add more redo log groups - increase the size of the redo logs2) Reduce the frequency of checkpoints - increase LOG_CHECKPOINT_INTERVAL - increase size of online redo logs3) Improve the efficiency of checkpoints enabling the CKPT processwith CHECKPOINT_PROCESS=TRUE4) Set LOG_CHECKPOINT_TIMEOUT = 0. This disables the checkpointingbased on time interval.5) Another means of solving this error is for DBWR to quickly writethe dirtybuffers on disk. ---------------------------------------------------------
经验总结:
http://space.itpub.net/11447732/viewspace-628532
good way:
http://shenblog.com/2010/11/26/thread-1-cannot-allocate-new-log-sequence-19-checkpoint-not-complete/
ways:
http://linux.net527.cn/fuwuqiyingyong/Oracle/2012/0109/45359.html