去年一个故障案例经过时间的沉淀问题没在发生今天有时间简单的总结一下,当时正时午睡时分,突然告警4库8个实例同时不可用,这么大面积的故障多数是有共性的关连,当时查看数据库DB ALERT日志都是I/O错误写失败,后确认8个实例都是使用了存储层的同步容灾技术,且存储为同一品牌日立。

  1. 2017-01-22 13:02:14.213000 +08:00
  2. KCF: read, write or open error, block=0x1ad85 online=1
  3. file=443 '/dev/anbob_oravg01/ranbob_lv15_062'
  4. error=27063 txt: 'HPUX-ia64 Error: 11: Resource temporarily unavailable
  5. Additional information: -1
  6. Additional information: 32768'
  7. Errors in file /oracle/app/oracle/diag/rdbms/anbob/anbob1/trace/anbob1_dbw7_17700.trc:
  8. Errors in file /oracle/app/oracle/diag/rdbms/anbob/anbob1/trace/anbob1_lgwr_17702.trc:
  9. ORA-00345: redo log write error block 95667 count 10
  10. ORA-00312: online log 4 thread 1: '/dev/anbob_oravg02/ranbob_redo04'
  11. ORA-27063: number of bytes read/written is incorrect
  12. HPUX-ia64 Error: 11: Resource temporarily unavailable
  13. Additional information: -1
  14. Additional information: 10240
  15. KCF: read, write or open error, block=0x5c699 online=1
  16. KCF: read, write or open error, block=0x168297 online=1
  17. file=29 '/dev/anbob_oravg01/ranbob_lv15_024'
  18. file=142 '/dev/anbob_oravg04/ranbob_lv30_273'
  19. error=27063 txt: 'HPUX-ia64 Error: 11: Resource temporarily unavailable
  20. error=27063 txt: 'HPUX-ia64 Error: 11: Resource temporarily unavailable
  21. Additional information: -1
  22. Additional information: -1
  23. Additional information: 8192'
  24. Additional information: 8192'
  25. Errors in file /oracle/app/oracle/diag/rdbms/anbob/anbob1/trace/anbob1_dbw1_17688.trc:

再回头看一下这些数据库的环境, 使用的是同步的异地容灾技术,也就是存储上层的应用I/O一次要写两处,本地和远程都写成功才算完成,这里的应用也就是ORACLE DB,这算是过去容灾环境中常用技术,对于存储同步通常也有异步技术需要购买更贵的license. 这些环境中的DB 因为远程的链路抖动导致I/O写失败导致HPUX平台的数据库重启。

不过有意思的时同样异地容灾的数据库还有其它环境并未重启,如下

OS Storage IS_Restart
AIX EMC NO
AIX HDS NO
HPUX EMC NO
HPUX HDS YES

Note:
这里看到只有HPUX和HDS的配合重启了数据库,在存储上EMC工程师当时说从日志发现错了错误和切换链路,但HDS工程师说并未发现错误日志,但是提出日立存储判断是当链路发生问题时, 切换的超时时间为30+10 秒。那么再回到上层OS层,HPUX主机的IO timeout时间为30秒, AIX主机为60秒. 所以存在日立存储切换链路前HPUX已I/O 超时,返回了I/O失败. 而故障时间也可能刚好>30 <60秒所以在AIX timeout前存储已恢复正常, AIX可以继续并未重启。

当然假设以上都是成立的,那究竟当链路不可用时,短时内宕掉数据库保证数据库一致,还是再增加多一些的时间retry, 为存储短时内恢复争取时间正为合适,需要一个时间的权衡。 这个时间也就是PL/SQL 中的commit.

数据库的ACID中的D也就是持久性,要求COMMIT后的事务要持久化也就是不能丢失,所以在SQL中的COMMIT,都是强置redo log刷到磁盘才可以继续,如下:

when a session issues a commit, it generates the redo describing how to update its transaction table slot in the undo segment header block, puts this redo into the log buffer, applies it to the undo segment header block, calls the log writer to flush the log buffer to disk, and then goes into a log file sync wait until the log writer lets it know that its entry in the log buffer has been copied to disk.
This commit/rollback mechanism that makes transactions Durable.(D OF ACID )

但是PL/SQL 中的commit是做了优化,为了权衡LOOP 中的COMMIT的性能,commit只是发关给LGWR一个提交的message, 然而并不会一直等lgwr写磁盘完成就可以继续下一个事务,这点区别与SQL中事务的认识。可以使用一段PL/SQL测试。

  1. [oracle@anbob ~]$ sqlplus anbob/anbob@anbob/pdbanbob.com
  2.  
  3. SQL*Plus: Release 12.2.0.0.0 Beta on Tue Feb 7 15:00:27 2017
  4. Copyright (c) 1982, 2015, Oracle. All rights reserved.
  5. Last Successful login time: Tue Feb 07 2017 14:57:44 +08:00
  6. Connected to:
  7. Oracle Database 12c EE Extreme Perf Release 12.2.0.1.0 - 64bit Production
  8.  
  9. SQL> create table anbob.t(id int,a date);
  10. Table created.
  11.  
  12. SQL> @statn commit
  13. STAT# HEX# OFFSET NAME VALUE
  14. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  15. 6 6 48 user commits 1
  16. 219 DB 1752 commit cleanouts 3
  17. 220 DC 1760 commit cleanouts successfully completed 3
  18. 647 287 5176 IMU commits 1
  19. ...
  20. 45 rows selected.
  21.  
  22. SQL> @statn sync
  23.  
  24. STAT# HEX# OFFSET NAME VALUE
  25. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  26. 338 152 2704 redo synch time 9
  27. ...
  28. 346 15A 2768 redo synch writes 2
  29. ...
  30.  
  31. 17 rows selected.
  32.  
  33. declare
  34.  i int:=0;
  35. begin
  36.   while i<100 loop
  37.   insert into t values(i,sysdate);
  38.   commit;
  39.   dbms_lock.sleep(1);
  40.   i:=i+1;
  41.   end loop;
  42. end;
  43.   /  
  44.  
  45. PL/SQL procedure successfully completed.
  46.  
  47. SQL>@statn commit
  48.  
  49. STAT# HEX# OFFSET NAME VALUE
  50. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  51. 6 6 48 user commits 101
  52. 201 C9 1608 BPS commit wait 0
  53. ...
  54. 219 DB 1752 commit cleanouts 103
  55. 220 DC 1760 commit cleanouts successfully completed 103
  56. 647 287 5176 IMU commits 101
  57.  
  58. 45 rows selected.
  59.  
  60. SQL> @statn sync
  61.  
  62. STAT# HEX# OFFSET NAME VALUE
  63. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  64. 338 152 2704 redo synch time 9
  65. ...
  66. 346 15A 2768 redo synch writes 3
  67.  
  68. 17 rows selected.

Note:
user commits 值是和PLSQL 中 COMMIT一致,但是redo synch writes才增加了一次,注意如果在PL/SQL中使用DBLINK就不再这样。而SQL中的COMMIT如下

  1. SQL> @statn sync
  2.  
  3. STAT# HEX# OFFSET NAME VALUE
  4. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  5. 338 152 2704 redo synch time 9
  6. 346 15A 2768 redo synch writes 4
  7. 17 rows selected.
  8.  
  9. SQL> insert into t values(200,sysdate);
  10. 1 row created.
  11.  
  12. SQL> commit;
  13. Commit complete.
  14.  
  15. SQL> insert into t values(200,sysdate);
  16. 1 row created.
  17.  
  18. SQL> commit;
  19. Commit complete.
  20.  
  21. SQL> @statn sync
  22.  
  23. STAT# HEX# OFFSET NAME VALUE
  24. ---------- ----- ---------- ---------------------------------------------------------------- ----------
  25. 338 152 2704 redo synch time 10
  26. 346 15A 2768 redo synch writes 6

Note:
每一次commit都会触发redo synch writes。

the statistic redo synch writes counts the number of times a session has sent a message (statistic messages sent) to lgwr on a commit. This is an approximation; in fact, “sending a message” may not involve a real message.

Clearly the user session is not behaving as expected—it has posted lgwr to write a few times, but it
has only incremented redo synch writes once, which suggests it didn’t stop and wait for lgwr to wake it
up again. The user’s session is breaching the durability requirement; if the instance crashed somewhere
in the middle of this loop, it’s entirely possible that a transaction that had been committed would not be
recovered.

If we saw this output we could interpret it as 25 cycles of the following sequence:
• User session issues a commit
• User session posts lgwr and increments redo synch writes
• User session goes into a wait (log file sync) waiting to be posted by lgwr
• Lgwr gets woken up
• Lgwr writes the log buffer to disk, waiting a short time on each write

This strategy does not get used if the code is doing updates across database links, so there have been occasions in the
past where I’ve used a totally redundant loopback database link to ensure that some PL/SQL code would wait for a
log file sync on every commit.

所以如果在PLSQL 使用LOOP commit, 像上面如果存储最终都没有恢复,那么commit的事务会丢失。

当然为了保持HPUX和AIX 的一致,数据库环境都使用了异步IO(AIO)和RAW裸设备的共享存储,对于数据库的I/O请求,数据库只是发送给OS层后就结束,timeout的时间多数取决于OS和存储层。对于HP平台而言,与IO timeout相关的内核参数主要是PV timeout、LV timeout、ESD_SECS、asyncdsk_io_timeout等。

HPUX做如下修改:

1,  PV timeout默认为30s, 据了解AIX平台为60s, 调整该参数为60s.

2,LV timout默认依赖PV timeout, 建议值如下LV timeout value = (# of paths * PV Timeout) + 10 seconds

3,ESD_SECS=120  esd_secs attribute determines the timeout of I/O operations to block devices.默认是30s, 在MOS中有案例调整了该参数,因使用RAW device本次未做调整。

4,asyncdsk_io_timout  默认值30s ,调整为120s。

在做了如上调整后,手动的切断远程链路,并在120s 前恢复,数据库并未crash.

提示:本案例仅供参考,具体调整需要咨询OS和存储厂商。

一次存储链路抖动因I/O timeout不同在AIX和HPUX上的不同表现(转)的更多相关文章

  1. httprequest存储的是字符内容 而文本内容是以字节形式上传的;所以普通的取值方式无法从httprequest取到值

    httprequest存储的是字符内容 而文本内容是以字节形式上传的;所以普通的取值方式无法从httprequest取到值

  2. AIX/Linux/HP-UX查看CPU/内存/磁盘/存储命令

    1.1    硬件环境验证方式 硬件环境主要包括CPU.内存.磁盘/存储.网络设备(如F5等).系统特有设备(如密押设备等)等,其中网络设备和系统特有设备由网络管理员或项目组提供为准,本节主要关注CP ...

  3. 对象存储服务MinIO安装部署分布式及Spring Boot项目实现文件上传下载

    目录 一.MinIO快速入门 1. MinIO简介 2. CentOS7更换成阿里云镜像 3. 安装 3.1 下载 3.2 运行测试 4. 配置脚本执行文件 4.1 创建配置执行文件 4.2 执行 二 ...

  4. Lua用一维数组存储一个n阶方阵,输出这个方阵的正对角线上的数的和与反对角线上的数的和的差的绝对值。

    arr = {, , , , , , , , -} function diagonalDifference(arr) dimesion = math.sqrt(#arr) arr1 = {} sum1 ...

  5. 对象存储服务 OSS(Object Storage Service),知识点(待补充上仓库代码)

    资料 网址 官方文档 https://help.aliyun.com/product/31815.html?spm=a2c4g.11186623.3.1.3e1459669xRokl OSS Brow ...

  6. Linux存储在线管理(一)FC磁盘设备管理

    由 Jun_Tan 在 2013-1-28 上午12:08 上创建,最后由 Jun_Tan 在 2013-1-28 上午12:13 上修改 版本 1 Linux存储在线管理(一)FC磁盘设备管理 转载 ...

  7. 看到了一篇博文,关于网卡的sniff模式,感觉相当好

    @font-face { font-family: "Times New Roman"; }@font-face { font-family: "宋体"; }@ ...

  8. 深入浅出谈存储之NAS是什么

    深入浅出谈存储之NAS是什么 2012年02月17日16:42 来源:新浪博客 作者:林沛满 编辑:曾智强 查看全文 赞(0)评论(0) 分享 标签: NAS , 企业NAS , 存储系统 [IT16 ...

  9. [PS相关]DAS,NAS,SAN三种存储技术比较

    随着数据量一直在快速增长,存储技术也在快速的更新以满足需求和推动创新.当存储被提到的时候,它不仅仅局限于存储容量,还有其他的需求比如数据保护,数据备份,数据访问速度等等. NAS-网络存储设备(Net ...

随机推荐

  1. chroot的用法

    chroot命令用来在指定的根目录下运行指令.chroot,即 change root directory (更改 root 目录).在 linux 系统中,系统默认的目录结构都是以/,即是以根 (r ...

  2. Java虚拟机(六):JVM调优工具

    工具做为图形化界面来展示更能直观的发现问题,另一方面一些耗费性能的分析(dump文件分析)一般也不会在生产直接分析,往往dump下来的文件达1G左右,人工分析效率较低,因此利用工具来分析jvm相关问题 ...

  3. cookie安全隐患及防篡改机制

    Cookie和Session是为了在无状态的HTTP协议之上维护会话状态,使得服务器可以知道当前是和哪个客户在打交道.本文来详细讨论Cookie和Session的实现机制,以及其中涉及的安全问题. 因 ...

  4. mysql replace语句

    语法 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 REPLACE [LOW_PRIORITY | DELAYED]     [INTO] tbl_name     [ ...

  5. python 3.x 爬虫基础---正则表达式

    python 3.x 爬虫基础 python 3.x 爬虫基础---http headers详解 python 3.x 爬虫基础---Urllib详解 python 3.x 爬虫基础---Requer ...

  6. 【转】使用Freemarker实现网页静态化

    使用Freemarker实现网页静态化 2017年08月20日 20:45:51 阅读数:1981 1.1. 什么是freemarker FreeMarker是一个用Java语言编写的模板引擎,它基于 ...

  7. 撩课-Web大前端每天5道面试题-Day20

    1.vue生命周期的作用是什么? 它的生命周期中有多个事件钩子,让我们在控制整个Vue实例的过程时更容易形成好的逻辑. 2. Vue实现数据双向绑定的原理:Object.defineProperty( ...

  8. python中函数重载和重写

    python 中的重载  在python中,具有重载的思想却没有重载的概念.所以有的人说python这么语言并不支持函数重载,有的人说python具有重载功能.实际上python编程中具有重载的目的缺 ...

  9. bzoj1061 NOI2018 志愿者招募——solution

    Description 申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管.布布刚上任就遇到了一个难 题:为即将启动的奥运新项目招募一批短期志愿者.经过估算,这个项目需要N 天才能 ...

  10. springboot中使用druid和监控配置

    如果想要监控自己的项目的访问情况及查看配置信息,druid是一个很好的选择,可能你会问druid是什么?有什么用?优点是什么? Druid简介 Druid是阿里巴巴开源的数据库连接池,号称是Java语 ...