oracle切换日志的条件,求助:哪些条件会触发日志切换呢?

force archive SCN

"Log switches may also be forced automatically in relatively idle threads of an Oracle parallel server database, to secure recoverability. Whenever a log file is reused in any thread, the force SCN recorded in the database entry of the controlfile is advanced to 1 beyond the high SCN of the reused log file (unless the force SCN was already higher). If the low SCN for the current log file in any enabled thread thereby falls behind the force SCN, a log switch is forced in that thread. This allows that log file to be archived. Until that log file is archived, newer redo in the archived copy of the recently reused log file might not be able to be applied in some recovery scenarios, or to a standby database.

If a thread requiring a forced log switch is not open, the instance that raised the force SCN will perform the log switch on behalf of the closed thread, and the first available ARCn process in any instance will archive the log file. However, if the thread is open, its instance is prompted to perform these actions itself. This is done by taking a KK instance lock. The LGWR process in each instance holds the KK instance lock on its own thread. The id2 field identifies the thread number. When this lock is taken by another instance, LGWR recognizes that a forced log switch is required. "

为了保证可恢复性,OPS自动会使用相对空闲的线程来进行log switch,每次log被重用,记录在控制文件的forceSCN比重用的redo的 high SCN大1,如果任何线程(OPS下多个thread)当前log的low SCN落后于forceSCN,那个线程会进行强制log switch。这允许那个线程可以对log进行归档。在重用的log里的新redo不能被使用在一些恢复的场景或者standby,直到那个log归档了-----------这句话的意思就是一些情况下,只有redo被归档,才能用来做恢复,master用arch或者lgwr传输归档到standby进行恢复。

如果需要进行log switch的线程没打开,记录force SCN的实例会用那个关闭的线程的名义进行log switch,任何实例上空闲的ARC process会对switch的那个log file进行归档,但是如果线程打开了,拥有这个线程的实例就会自己完成这些工作,会在上面加KK锁,每个实例的LGWR会在它自己的线程加KK实例锁,id2表示实例号,这个锁被其他实例持有,LGWR就会知道要进行log switch了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值