ITPub博客

首页 > IT基础架构 > 网络安全 > SGA与共享内存2

SGA与共享内存2

原创 网络安全 作者:achilly 时间:2010-03-11 21:24:58 0 删除 编辑

[@more@]

以下是个案例:shmmax设置不当导致dcba无法创建数据库.

问题现象:在dbca建库的时候报错:ORA-03113: end-of-file on communication channel,需要说明的是,基本上是在创建实例的时候。

于是我想到会不会是jdk的问题呢?于是我就通过命令行来做了下:

SQL> startup nomount pfile="/home/oracle/orabase/admin/test/scripts/init.ora";

ORA-03113: end-of-file on communication channel

SQL> exit

Disconnected

可惜结果还是如此,看来不是这个问题。继续排查吧。

还好基础知识还是有一些,想到实例都起不来,实例就只包括内存和后台进程啊。于是我就再次尝试连接到sqlplus看看:

[oracle@IBMPOWER6 ~]$ sqlplus /"as sysdba"

SQL*Plus: Release 10.2.0.1.0 - Production on Fri Mar 6 10:10:37 2009

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected.

SQL> exit

Disconnected

细心的读者可能会发现问题的,这里连接是发生在上的startup nomount之后的第一次连接,上面提示3113后我就退出了,再连接时发现是Connected.而不是idle instance。呵呵,于是就想看看后台进程起来没有:

[oracle@IBMPOWER6 ~]$ ps ef|grep ora_

16818 pts/4 S+ 0:00 _ grep ora_ HOSTNAME=IBMPOWER6 SHELL=/bin/bash TERM=vt100 HISTSIZE=1000 TMPDIR=/tmp NLS_LANG=AMERICAN_AMERICA.US7ASCII USER=oracle TEMP=/tmp LD_LIBRARY_PATH=/home/oracle/orahome/lib:/lib:/usr/lib:/usr/openwin/lib:/usr/td/lib:/usr/ucblib:/usr/local/lib LS_COLORS=no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33;01:or=01;05;37;41:mi=01;05;37;41:ex=01;32:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;32:*.bat=01;32:*.sh=01;32:*.csh=01;32:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.bz2=01;31:*.bz=01;31:*.tz=01;31:*.rpm=01;31:*.cpio=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=01;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.tif=01;35: ORACLE_SID=test ORACLE_BASE=/home/oracle/orabase MAIL=/var/spool/mail/oracle PATH=/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/local/bin:/opt/NSCPnav/bin:/home/oracle/orahome/bin:/usr/local/samba/bin:/usr/ucb: INPUTRC=/etc/inputrc PWD=/home/oracle LANG=en_US ORACLE_TERM=xterm SSH_ASKPASS=/usr/libexec/openssh/gnome-ssh-askpass SHLVL=1 HOME=/home/oracle LOGNAME=oracle CVS_RSH=ssh LESSOPEN=|/usr/bin/lesspipe.sh %s ORA_NLS33=/home/oracle/orahome/ocommon/nls/admin/data ORACLE_HOME=/home/oracle/orahome G_BROKEN_FILENAMES=1 _=/bin/grep

没有瞅到想象中的那些熟悉的面孔,此时读者们,会如何继续下一步呢?反正本人是执行了以下命令:

[oracle@IBMPOWER6 ~]$ ipcs -a

------ Shared Memory Segments --------

key shmid owner perms bytes nattch status

0x00000000 622593 oracle 640 16777216 0

0x00000000 655362 oracle 640 2147483648 0

0x5fd96188 688131 oracle 640 251658240 0

------ Semaphore Arrays --------

key semid owner perms nsems

------ Message Queues --------

key msqid owner perms used-bytes messages

比较怪异啊,oracle有三个共享内存短,但是却没有semaphore arrays和message queues。于是立即想到一个操作系统配置文件sysctl.conf:

[oracle@IBMPOWER6 ~]$ more /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux

#

# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

# sysctl.conf(5) for more details.

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename

# Useful for debugging multi-threaded applications

kernel.core_uses_pid = 1

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes

kernel.msgmnb = 65536

# Controls the default maxmimum size of a mesage queue

kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes

kernel.shmmax = 137438953472

# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 536870912

kernel.shmall = 2097152

kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 262144

net.core.rmem_max = 262144

net.core.wmem_default = 262144

net.core.wmem_max = 262144

细心的读者可能会发现一些问题的,有些参数设置了两遍。于是根据ipcs的结果修改了sysctl.conf文件为以下:

[oracle@IBMPOWER6 ~]$ more /etc/sysctl.conf

# Kernel sysctl configuration file for Red Hat Linux

#

# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

# sysctl.conf(5) for more details.

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename

# Useful for debugging multi-threaded applications

kernel.core_uses_pid = 1

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

# Controls the maximum size of a message, in bytes

kernel.msgmnb = 65536 < BR># Controls the default maxmimum size of a mesage queue

kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes

kernel.shmmax = 137438953472

# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 536870912

#kernel.shmall = 2097152

#kernel.shmmax = 2147483648

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default = 262144

net.core.rmem_max = 262144

net.core.wmem_default = 262144

net.core.wmem_max = 262144

然后重新建库,一路平安。没有什么事情,喝着coffee在旁边等着就行了。

这个案例和大家分享的目的有几点:

1、以前只知道shmmax参数设置不当对oracle性能有非常大的影响,倒是不影响实例的启动。所以任何事都有可能,还是要靠一步步分析。

2、任何问题的解决还是依靠分析,逐步排除,一一检查过关,最后解决问题。

3、本案例中之所以shmmax参数设置两次,是因为每次工程师都是直接拷贝到该文件中,而没有进行必要的检查。而且在建库的时候如果不修改内存参数的话,默认是物理内存的40%(本案例中3.2G),所以本文第一次配置的shmmax为一般的2G是不够的,这样就产生了多个共享内存段。导致实例无法启动,这样就无法建库。

这个案例说明的是“产生了多个共享内存段。导致实例无法启动,这样就无法建库。”个人觉得这句话值得怀疑,按照oracle的说法只是性能下降而已不会是实例无法启动。不过在该案例操作的情况来看是内存无法分配。

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/16405897/viewspace-1031762/ ,如需转载,请注明出处,否则将追究法律责任。

上一篇: SGA与共享内存
下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2009-11-24

  • 博文量
    10
  • 访问量
    19580