博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
SQL2043N 与 linux的randomize_va_space特性
阅读量:4328 次
发布时间:2019-06-06

本文共 3793 字,大约阅读时间需要 12 分钟。

自从数据库server从redhat4.6升级到redhat5.5之后。在使用TSM备份的时候偶尔会出现SQL2043N 
查看错误:
[db2inst1@limt ~]$ db2 ?

SQL2043N SQL2043N Unable to start a child process or thread. Explanation: Unable to start up the child processes or threads required during the processing of a database utility. There may not be enough available memory to create the new process or thread. The utility stops processing. User response: Ensure the system limit for number of processes or threads has not been reached (either increase the limit or reduce the number of processes or threads already running). Ensure that there is sufficient memory for the new process or thread. Resubmit the utility command

从描写叙述看好像是数据库在申请内存的时候失败,可是内存应该非常充裕 。redhat4.6的时候是16G,升级到redhat5.5    
之后已经提高到了64G,应该不会内存不足。可是备份天天做,偶尔失败一次也能够接受。就没在意,之后在值班过程
中发现组内其它系统也会偶尔出现SQL2043N,看来这似乎并非一个偶尔现象 ,晚上就回家百度一下 SQL2043N,获得
了意外的收获,在官网找到例如以下解释:
Problem(Abstract)ASLR or Address Space Layout Randomization is a feature that is activated by default on some of the newer linux distributions. It is designed to load shared memory objects in random addresses.In DB2, multiple processes map a shared memory object at the same address across the processes. It was found that DB2 cannot guarantee the availability of address for the shared memory object when ASLR is turned on.Important note: DB2 10.1 has been enhanced so that ASLR can be safely enabled.SymptomThis conflict in the address space means that a process trying to attach a shared memory object to a specific address may not be able to do so, resulting in a failure in shmat subroutine. However, on subsequent retry (using a new process) the shared memory attachment may work. The result is a random set of failures. Some processes that have been known to see this error are: db2pd, db2egcf, and db2vend.Some of the behaviors seen include the following:For the db2pd command, it will report no data found even through the instance / database is active:Database SAMPLE not activated on database partition 0.For the db2egcf process, used for HA monitoring, the db2egcf may incorrectly determine the instance is down and initiate a failover.For the db2vend process, backup and log archive methods might fail with an error indicating a child process could not be started:SQL2043N  Unable to start a child process or thread.  Diagnosing the problemWhen this problem is suspected, check db2diag.log for the shmat failure like the following. Note that the same error message can also occur for a different cause. Hence, it's important to note the process that reported this error.FUNCTION: DB2 UDB, SQO Memory Management, sqlocshr, probe:180MESSAGE : ZRC=0x850F0005=-2062614523=SQLO_NOSEG          "No Storage Available for allocation"          DIA8305C Memory allocation failure occurred.CALLED  : OS, -, shmat                    OSERR: EINVAL (22)Resolving the problem1) Disable ASLR temporarily (change is only effective until next boot):Run "sysctl -w kernel.randomize_va_space=0" as root.2) Disable ASLR immediately and on all subsequent reboots:Add the following line to /etc/sysctl.conf:kernel.randomize_va_space=0and then run "sysctl -p" as root to make the change take effect immediately.
大致意思就是LINUX的内存随机化地址特性导致DB2进程不能正确的attach到一个 shared memory object 。那么linux为什么要开启这样的特性?
在百度 randomize_va_space keyword:
Linux Kernel引入了地址空间布局随机化的概念。该概念的提出是出于安全考虑。试想假设堆栈空间的地址都是确定的,那么恶意代码就非常easy
通过内存溢出的代码来訪问堆栈空间的内容。地址空间布局随机化就是使得进程虚拟空间的布局(主要是各个部分的起始地址)位于随机的位置,
以此来减少被攻击的可能性。
在/proc/sys/kernel/randomize_va_space中的值假设为0则表示关闭全部的随机化,假设为1。表示打开mmap base、栈、VDSO页面随机化,假设

为2则表示在1的基础上进一步打开堆地址随机化。在打开堆地址随机化之前,堆的起始位置是紧接着应用程序bss段之后的。

      

了解这些之后突然想起在平时使用db2pd时候,也会出现SQL2043N,然后在执行一次就正常了。由于db2pd通过attach db2共享内存来获得数据库

的监控数据,所以db2pd为轻量级工具,对数据库的性能影响比較少

之后在server上设置kernel.randomize_va_space=0之后就在无此错误出现

转载于:https://www.cnblogs.com/yangykaifa/p/7246773.html

你可能感兴趣的文章
小D课堂 - 零基础入门SpringBoot2.X到实战_第2节 SpringBoot接口Http协议开发实战_12、SpringBoot2.x文件上传实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_19、SpringBoot个性化启动banner设置debug日志...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_20、SpringBoot2.x配置全局异常实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第5节 SpringBoot部署war项目到tomcat9和启动原理讲解_23、SpringBoot2.x启动原理概述...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第4节 Springboot2.0单元测试进阶实战和自定义异常处理_21、SpringBoot2.x配置全局异常返回自定义页面...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_32..SpringBoot2.x持久化数据方式介绍...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_34、SpringBoot整合Mybatis实操和打印SQL语句...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第8节 数据库操作之整合Mybaties和事务讲解_35、事务介绍和常见的隔离级别,传播行为...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_40、Redis工具类封装讲解和实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_37、分布式缓存Redis介绍...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_42、SpringBoot常用定时任务配置实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第9节 SpringBoot2.x整合Redis实战_39、SpringBoot2.x整合redis实战讲解...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第14节 高级篇幅之SpringBoot多环境配置_59、SpringBoot多环境配置介绍和项目实战...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_41、SpringBoot定时任务schedule讲解...
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第10节 SpringBoot整合定时任务和异步任务处理_43、SpringBoot2.x异步任务实战(核心知识)...
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_1_01课程简介
查看>>
小D课堂 - 零基础入门SpringBoot2.X到实战_第11节 Logback日志框架介绍和SpringBoot整合实战_45、SpringBoot2.x日志讲解和Logback配置实战...
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_1_02技术选型
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_汇总
查看>>
小D课堂 - 新版本微服务springcloud+Docker教程_2_01传统架构演进到分布式架构
查看>>