oracle cannot allocate new log,Thread 1 cannot allocate new log
今天發(fā)現(xiàn)alter.log有以下信息:
Thread 1 cannot allocate new log, sequence 6166
Private strand flush not complete
對(duì)于這個(gè)錯(cuò)誤信息得解釋如下:
當(dāng)系統(tǒng)要重新利用某個(gè)日志文件的時(shí)候,系統(tǒng)需要將該日志文件所包括的buffer cache 中的dirty block
寫(xiě)到相應(yīng)的數(shù)據(jù)文件。由于對(duì)于一個(gè)數(shù)據(jù)庫(kù)操作而言,它可能產(chǎn)生的redo 量?jī)H僅是幾十字節(jié),但是對(duì)于buffer cache中確是一個(gè)block
(一般為8k)。所以,對(duì)于一個(gè)僅僅是幾百M(fèi)的日志文件,它所保護(hù)的buffer cache 可能是幾個(gè)G
一旦發(fā)生"Thread 1 cannot allocate new log",表明系統(tǒng)的checkpoint 沒(méi)有來(lái)得及完成,也就是說(shuō) buffer
cache 中的dirty data還沒(méi)有完全寫(xiě)到數(shù)據(jù)文件,就已經(jīng)有大量的日志需要寫(xiě)入到系統(tǒng)。而系統(tǒng)只能通知應(yīng)用:checkpoint
還沒(méi)有完成,你只能等待。這個(gè)時(shí)候,系統(tǒng)就基本處于hang 狀態(tài)了 When the database waits on checkpoints,redo
generation is stopped until the log switch is done
如果,我們?cè)谶@個(gè)時(shí)候查看系統(tǒng)信息,就會(huì)發(fā)現(xiàn):v$log中的日志狀態(tài)大多處于active 狀態(tài); v$session_wait 中會(huì)有很多l(xiāng)og file
switch 事件的發(fā)生
解決辦法: a. 添加更多的日志文件??b. 加大checkpoint 觸發(fā)的頻度??c. 減小redo log 的size d. 提高DBWR的效率
e. 為了更好的了解系統(tǒng)的運(yùn)行,可以設(shè)置
log_checkpoint_interval = 0
log_checkpoint_timeout = 0
log_checkpoints_to_alert=True
9i以后可能大家都喜歡通過(guò)設(shè)置fast_start_mttr_target來(lái)控制instance
recovery的粒度。但是仍然有兩個(gè)參數(shù)一直影響著我們的checkpoint,就是他們:
log_checkpoint_interval
Oracle8.1版本后log_checkpoint_interval指的是兩次checkpoint之間操作系統(tǒng)數(shù)據(jù)塊的個(gè)數(shù)。checkpoint時(shí)Oracle把內(nèi)存里修改過(guò)的數(shù)據(jù)塊用DBWR寫(xiě)到物理文件,用LGWR寫(xiě)到日志和控制文件(在8i的時(shí)候lgwr進(jìn)程在兼有ckpt進(jìn)程的作用,呵呵。為了減輕我們本來(lái)就可能在高壓情況下疲于奔命的LGWR兄弟的負(fù)擔(dān),Oracle引入了ckpt來(lái)更新我們的控制文件和數(shù)據(jù)文件頭的SCN信息)。
一般UNIX操作系統(tǒng)的數(shù)據(jù)塊為512bytes。
從性能優(yōu)化的角度來(lái)說(shuō),建議log_checkpoint_interval=redologfilesizebytes
/ 512bytes,根據(jù)我們的online redo?file的大小來(lái)指定我們數(shù)據(jù)塊的個(gè)數(shù).
from
concept:
LOG_CHECKPOINT_INTERVAL specifies the frequency of
checkpoints(用來(lái)指定檢查點(diǎn)發(fā)生的頻率) in terms of the number of redo log file blocks that
can exist between an incremental checkpoint and the last block written to the
redo log. This number refers to physical operating system blocks, not database
blocks.
Regardless of this value, a checkpoint always occurs when switching
from one online redo log file to another. Therefore, if the value exceeds the
actual redo log file size, checkpoints occur only when switching logs.
Checkpoint frequency is one of the factors that influence the time
required for the database to recover from an unexpected
failure.
log_checkpoint_timeout
Oracle8.1版本后log_checkpoint_timeout指的是兩次checkpoint之間時(shí)間秒數(shù)(單位是秒)。
Oracle建議不用這個(gè)參數(shù)來(lái)控制,因?yàn)槭聞?wù)(transaction)大小不是按時(shí)間等量分布的(事務(wù)的長(zhǎng)短并不是最重要的,重要的是我們的業(yè)務(wù)邏輯和數(shù)據(jù)的完整性)。那么我們用log_checkpoint_interval參數(shù)控制會(huì)更好一些。
我們可以通過(guò)log_checkpoint_timeout=0來(lái)禁用此參數(shù)或者按默認(rèn)的900。
LOG_CHECKPOINT_TIMEOUT
specifies (in seconds) the amount of time that has passed since the incremental
checkpoint at the position where the last write to the redo log (sometimes
called the tail of the log) occurred. This parameter also signifies that no
buffer will remain dirty (in the cache) for more than integer
seconds.
Specifying a value of 0 for the timeout disables time-based
checkpoints. Hence, setting the value to 0 is not recommended unless
FAST_START_MTTR_TARGET is set.
總結(jié)
以上是生活随笔為你收集整理的oracle cannot allocate new log,Thread 1 cannot allocate new log的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 石板切割问题c语言_广场地面铺装 仿古石
- 下一篇: 华为交换机s2700怎么重置_华为交换机