11.2之前,oracle的lgwr写入模式为post/wait

11.2之后新增了polling模式,可以与post/wait模式自动切换

通过隐藏参数 _use_adaptive_log_file_sync 参数来控制

查看该隐藏参数的方法:SELECT x.ksppinm NAME, y.ksppstvl VALUE, x.ksppdesc describ  FROM SYS.x$ksppi x, SYS.x$ksppcv yWHERE x.indx = y.indx  AND x.ksppinm LIKE '%_use_adaptive_log_file_sync%';

当参数设置为false时,lgwr还是采用post/wait方式将日志从buffer写入磁盘

当参数设置为true是,lgwr写入方式会自动在post/wait和polling模式之间进行切换,可能会造成比较严重的log file sync (当使用polling模式时)

建议关闭此参数:

alter system set "_use_adaptive_log_file_sync"=FALSE;

参数立即生效,无需重启实例。

模式切换时,lgwr的trace中会记录类似如下的信息:

RACDB1_lgwr_27890.trc-6094-Warning: log write elapsed time 649ms, size 11252KB

RACDB1_lgwr_27890.trc-6095-

RACDB1_lgwr_27890.trc-6096-*** 2016-05-10 13:28:41.481

RACDB1_lgwr_27890.trc-6097-Warning: log write elapsed time 654ms, size 16877KB

RACDB1_lgwr_27890.trc:6098:kcrfw_update_adaptive_sync_mode: post->poll long#=2 sync#=9 sync=1031 poll=1961 rw=574 ack=0 min_sleep=1961

--

RACDB1_lgwr_27890.trc-6115-Warning: log write elapsed time 532ms, size 16479KB

RACDB1_lgwr_27890.trc-6116-

RACDB1_lgwr_27890.trc-6117-*** 2016-05-10 18:22:14.255

RACDB1_lgwr_27890.trc-6118-Warning: log write elapsed time 781ms, size 316KB

RACDB1_lgwr_27890.trc:6119:kcrfw_update_adaptive_sync_mode: poll->post current_sched_delay=0 switch_sched_delay=1 current_sync_count_delta=2 switch_sync_count_delta=9

--

RACDB1_lgwr_27890.trc-6168-Warning: log write elapsed time 855ms, size 9153KB

RACDB1_lgwr_27890.trc-6169-

RACDB1_lgwr_27890.trc-6170-*** 2016-05-11 06:29:28.814

RACDB1_lgwr_27890.trc-6171-Warning: log write elapsed time 568ms, size 10345KB

RACDB1_lgwr_27890.trc:6172:kcrfw_update_adaptive_sync_mode: post->poll long#=2 sync#=7 sync=964 poll=1961 rw=969 ack=0 min_sleep=1961

两种模式的理解:(两种模式主体都是前台进程,post/wait是等待lgwr通知,polling是主动轮序lgwr)

Post/wait:用户会话被动等待LGWR通知redo写入到log file完毕,这种方式响应速度比较快。若cpu空闲时采用这种方式可以体验到更好的响应时间。

Polling:用户会话主动轮询LGWR,观测是否完成写入(轮询的间隔是10ms)。这种方式比Post/wait方式响应速度慢,但LGWR不直接把完成的消息通知到很多用户会话,可以节约CPU资源。若cpu繁忙时采用这种方式可以降低cpu资源的消耗。

官方对两种模式的解释:

Adaptive Log File sync was introduced in 11.2. the feature is exactly enabled since release 11.2.0.3 , It’s enabled through an underscore parameter called _use_adaptive_log_file_sync and the description of this parameter is: adaptively switch between post/wait and polling.

Oracle can switches between the 2 methods:

Post/wait, traditional method for posting completion of writes to redo log

LGWR explicitly posts all processes waiting for the commit to complete.

The advantage of the post/wait method is that sessions should find out almost immediately when the redo has been flushed to disk.

Polling, a new method where the foreground process checks if the LGWR has completed the write.

Foreground processes sleep and poll to see if the commit is complete. The advantage of this new method is to free LGWR from having to inform many processes waiting on commit to complete thereby freeing high CPU usage by the LGWR.If post/wait is selected and the foreground processes fail to receive a post from LGWR, an incident is recorded.diagnostic traces are performed, and polling is used instead of post/wait.

Oracle uses semaphores extensively, If you look for references to “commit” in the Oracle docs, you’ll find the word “post” everywhere when they talk about communication between the foreground processes and LGWR. Now, remember that a COMMIT has two options: first, IMMEDIATE or BATCH and second, WAIT or NOWAIT. It looks like this to me:

Immediate: FG process will post to LGWR, triggering I/O (default)

Batch: FG process will not post LGWR

Wait: LGWR will post FG process when I/O is complete (default)

NoWait: LGWR will not post FG process when I/O is complete

参考:https://blog.csdn.net/rgb_rgb/article/details/72804143

原文链接:https://www.cnblogs.com/nathon-wang/p/10284687.html

oracle轮询方式循环输出,LGWR的两种模式(POST/WAIT和POLLING)相关推荐

  1. ajax循环输出,Ajax轮询 select循环输出

    弹出层 .del{color:red} .addname{color:#337ab7} 款项名目操作 {$vo.name} 删除 添加... $(".addname").on(&q ...

  2. STM32CUBEMX(9)--ADC通过轮询方式读取,USART打印

    STM32CUBEMX--ADC通过轮询方式读取,USART打印 概述 硬件准备 选择芯片型号 配置时钟源 配置时钟树 串口配置 ADC配置 生成工程设置 生成代码 配置keil 代码 演示效果 视频 ...

  3. 使用轮询方式进行ADC转换(野火STM32 MINI开发板)

    实验器材:野火STM32 MINI开发板 任务目标:利用ADC采集电位器的电压,并通过串口调试助手输出变化的电压值 任务内容:调整开发板上的滑动变阻器,将电压值通过开发板到PC进行显示 开发板原理图: ...

  4. 选中断还是轮询方式?深究其中的区别

    作者 | 肖遥 来源 | 技术让梦想更伟大 摸水了一周,准备在家里好好敲敲代码,赶赶稿子,正当我专心输出的时候,被老婆打断了. 娃拉臭了,赶紧过来!语气中带着一丝丝我害怕的味道. 怎么办?没办法只有过 ...

  5. Tiny4412裸机程序,按键检测(轮询方式)

    由于前几天出差,博客没有更新,今天看了看Tiny4412的原理图,把按键扫描程序写了一下,用的是轮询方式,后面会有中断方式的实现,闲话少说,进入正题,程序由前一个实验Tiny4412之C语言实现流水灯 ...

  6. STM32F1与STM32CubeIDE快速入门-ADC轮询方式实现PWM调光器

    ADC轮询方式实现PWM调光器 在模拟输入通道上使用 ADC 执行模数转换的最简单的代码方法. 然而,这并不是所有情况下的有效方式,因为它被认为是使用 ADC 的一种阻塞方式. 通过这种方式,我们开始 ...

  7. DW1000开发笔记(五)DW1000使用轮询方式接收数据

    系列文章 DW1000开发笔记(一)DW1000芯片概览 DW1000开发笔记(二)使用STM32硬件SPI+STM32cubeMX+HAL库测试DW1000通信 DW1000开发笔记(三)基于STM ...

  8. mysql安装文件格式_一、安装方式       MySQL安装文件分为两种,一种是MSI格式的,一种是ZIP格式的。下面来看看这两种方式:       MSI格式的可以直接点击安...

    一.安装方式 MySQL安装文件分为两种,一种是MSI格式的,一种是ZIP格式的.下面来看看这两种方式: MSI格式的可以直接点击安装,按照它给出的安装提示进行安装,Windows操作系统下一般MyS ...

  9. java 产生随机数的两种方式,Java产生随机数的两种方式

    Java产生随机数的两种方式 Java产生随机数的两种方式 在java中,我们可以通过两种方式来获取随机数(generating a random number)一种是大家熟悉的java.lang.M ...

最新文章

  1. Linux Linux程序练习十一(网络编程大文件发送UDP版)
  2. IEEE Access latex 图片caption无法换行的问题
  3. spring + redis 实现数据的缓存
  4. 20201014 《人工智能与大数据》第1节课 笔记
  5. 分布式ID-数据库多主模式
  6. 安卓动画知识总结 Animation AnimationSet LayoutAnimation
  7. socket异步处理问题
  8. 决策树(二)--C4.5
  9. Python文学家为Python写的一首词?(附中英文版)
  10. 面向对象-类与对象、关键字、异常使用
  11. Install Air Conditioning HDU - 4756(最小生成树+树形dp)
  12. java选择题库_java选择题库
  13. canpro脚本_shell脚本实现-----自动巡检脚本.sh
  14. 小技巧2:Python 实现阿拉伯数字转化为中文数字
  15. 未来人类殡葬一览:太空中正飘着上千个骨灰盒
  16. 原神 Android 教程 —安卓版
  17. Go-boomer-locust
  18. MATLAB中内置的BP神经网络函数 help newff翻译【学习笔记】
  19. 基于C++的坦克动荡游戏
  20. 如何实现高速卷积?深度学习库使用了这些「黑魔法」

热门文章

  1. fastcgi java_FastCGI
  2. 点击事件为什么会失效_1917年的法蒂玛事件,为什么会被称为最为惊悚的UFO目击事件?...
  3. Last Theorem CodeForces - 1325F(dfs树找最大环+思维)
  4. [蓝桥杯][算法提高VIP]项链(dfs)
  5. B - Greg's Workout CodeForces - 255A(思维)
  6. 达拉斯大学计算机硕士专业排名,美国大学研究生专业排名:人机交互
  7. wdcp 去掉index.php,Nginx环境下Oneindex去除网址内的“?”
  8. 【计算机组成原理】浮点数运算及其流水线
  9. oracle怎么优化动态sql语句,oracle动态sql语句处理
  10. 『数据库』数据库的查询可不是只知道Select就可以的--关系数据库系统的查询处理