意外断电数据库无法启动牵扯到异步IO的参数设置

客户机房新装的UPS不太稳定,好几次意外断电,第3次意外断电之后问题终于来了,

数据库起不来了……

数据库的硬件环境是一台IBM DS5020存储,2台IBM X3850 X5

软件环境是Linux与Oracle 10g RAC

数据库2个节点的asm都能正常启动,但数据库实例启动到mount状态后就停下没有反应了,

等很久也不能前进到open状态。

节点1上的alert日志有如下错误信息:

ORA-1013 signalled during: ALTER DATABASE OPEN

…………

ORA-1089 signalled during: alter database open

节点2上的alert日志有如下错误信息:

Thu Dec 29 15:32:46 2011
Errors in file /opt/oracle/admin/racdb/bdump/racdb2_p015_11496.trc:
ORA-27090: Message 27090 not found; product=RDBMS; facility=ORA
Linux-x86_64 Error: 4: Interrupted system call
Additional information: 3
Additional information: 128
Additional information: 65536

进一步查看/opt/oracle/admin/racdb/bdump/racdb2_p015_11496.trc,有如下信息:

ORA-27090: Message 27090 not found; product=RDBMS; facility=ORA
Linux-x86_64 Error: 4: Interrupted system call
Additional information: 3
Additional information: 128
Additional information: 65536
WARNING:io_submit failed due to kernel limitations MAXAIO for process=0 pending aio=0
WARNING:asynch I/O kernel limits is set at AIO-MAX-NR=65536 AIO-NR=65508
WARNING:Oracle process running out of OS kernel I/O resources (1)
WARNING:Oracle process running out of OS kernel I/O resources (1)
WARNING:Oracle process running out of OS kernel I/O resources (1)
WARNING:Oracle process running out of OS kernel I/O resources (1)

上面日志中提示了linux的核心参数设置有问题:AIO-MAX-NR=65536

我们知道,Linux的核心参数AIO-MAX-NR是与异步IO相关的,对于异步IO的简单解释如下:

在一个程序中如果涉及到磁盘的IO操作时,有两种情况
1. 程序等待IO操作完成,CPU再接下来处理程序的其他部分(等待IO的时间段内,CPU处于Idle Waiting状态)。
2. 程序不等待IO操作完成,允许CPU处理接下来的其他任务(或者理解为允许CPU处理接下来的不依赖于IO完成的任务)。
显然,第一种情况,CPU的资源白白的浪费了,也就是同步IO。第二种情况更有利于CPU的充分利用,这就是异步IO(asynchronous IO)

查看操作系统的异步IO相关核心参数:

[root@db01 ~]# sysctl -a| grep aio
fs.aio-max-nr = 65536
fs.aio-nr = 0

我们知道aio-nr是所有当前活动的异步IO进程上下文的总和,其值最多不能超过aio-max-nr的设定值。并且数据库是在机房意外断电的情况下突然关闭的,关闭的一瞬间有大量的事务正在运行,所以重新启动的时候必然有大量的回滚与已提交但没有写入到数据文件的数据要开始写入,这时候的IO量是非常大的,由于启用了异步IO,此时大量的上下文切换达到了操作系统设定的最大值,于是oracle就停止响应了。查询metalink了解到oracle已证实这是一个BUG,官方建议fs.aio-max-nr的值设置为1M或以上可以解决此问题。

这里我将调整核心参数fs.aio-max-nr的值为3145728,即3M。

[root@db01 ~]# echo "fs.aio-max-nr = 3145728" >> /etc/sysctl.conf
[root@db01 ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.tcp_sack = 0
net.ipv4.tcp_timestamps = 0
net.ipv4.ip_local_port_range = 1024 65000
kernel.sem = 500 64000 100 128
kernel.shmmax = 17179869184
kernel.shmall = 4194304
fs.aio-max-nr = 3145728

两台服务器的核心参数都做了上面的修改之后,数据库启动成功!


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
处理一下出现的日志 Plugin 'FEDERATED' is disabled. 2017-11-15 19:23:46 16c0 InnoDB: Warning: Using innodb_additional_mem_pool_size is DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator. 2017-11-15 19:23:46 1404 [Note] InnoDB: Using atomics to ref count buffer pool pages 2017-11-15 19:23:46 1404 [Note] InnoDB: The InnoDB memory heap is disabled 2017-11-15 19:23:46 1404 [Note] InnoDB: Mutexes and rw_locks use Windows interlocked functions 2017-11-15 19:23:46 1404 [Note] InnoDB: Memory barrier is not used 2017-11-15 19:23:46 1404 [Note] InnoDB: Compressed tables use zlib 1.2.3 2017-11-15 19:23:46 1404 [Note] InnoDB: Not using CPU crc32 instructions 2017-11-15 19:23:46 1404 [Note] InnoDB: Initializing buffer pool, size = 9.0G 2017-11-15 19:23:46 1404 [Note] InnoDB: Completed initialization of buffer pool 2017-11-15 19:23:46 1404 [Note] InnoDB: Highest supported file format is Barracuda. 2017-11-15 19:23:46 1404 [Note] InnoDB: Log scan progressed past the checkpoint lsn 9219742510 2017-11-15 19:23:46 1404 [Note] InnoDB: Database was not shutdown normally! 2017-11-15 19:23:46 1404 [Note] InnoDB: Starting crash recovery. 2017-11-15 19:23:46 1404 [Note] InnoDB: Reading tablespace information from the .ibd files... 2017-11-15 19:23:46 1404 [Note] InnoDB: Restoring possible half-written data pages 2017-11-15 19:23:46 1404 [Note] InnoDB: from the doublewrite buffer... InnoDB: Doing recovery: scanned up to log sequence number 9219763629 InnoDB: 1 transaction(s) which must be rolled back or cleaned up InnoDB: in total 0 row operations to undo InnoDB: Trx id counter is 275040768 2017-11-15 19:23:47 1404 [Note] InnoDB: Starting an apply batch of log records to the database... InnoDB: Progress in percent: 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

lordcoohoo

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值