最近在已有数据库服务器上又新建了4个数据库实例,目前一共有9个数据库实例。环境搭好以后做检查的时候。根据反馈,有个job报如下的错误。

Failed to create connection for url=jdbc:oracle:thin:@xxxxx and dbUser=xxxxxx
Nested Exception/Error:
java.sql.SQLRecoverableException: IO Error: Got minus one from a read call
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:419)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:536)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:228)


这个问题,根据以往的经验就是process的值太低了。需要调大一些。查看数据库process的值,一看还真是,当时只设置了150,这个job平均要占用100多个session,其他的一些环境加进来,肯定不够。

因为调高process需要重启数据库,和他们协调了下,就开始操作了。
我先把process调到3000,session也相应调整,然后保存在spfile里面。
alter system set processes=3000 scope=spfile;


然后就按照计划开始停库,一个一个重启。
前面的3个很快就做完了,然后到最后一个,还是小心的按照nomount,mount的一步一步来。结果还是出问题了。
SQL>
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORA-27154: post/wait create failed
ORA-27300: OS system dependent operation:semget failed with status: 28
ORA-27301: OS failure message: No space left on device
ORA-27302: failure occurred at: sskgpcreates
SQL> exit



根据错误信息,是空间问题。但是查看的时候,空间还多着呢。
/dev/vx/dsk/vgusgsPT301/lvol6
20G 8.5G 11G 44% /opt/app/oracle/db1
/dev/vx/dsk/vgusgsPT401/lvol6
20G 8.5G 11G 44% /opt/app/oracle/db2
/dev/vx/dsk/vgusgsPT501/lvol6
20G 11G 8.7G 56% /opt/app/oracle/db3
/dev/vx/dsk/vgusgsPT601/lvol6
20G 11G 8.7G 56% /opt/app/oracle/db4

用top查看空余内存,也还有不少。
Tasks: 1000 total, 1 running, 999 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.3%us, 0.1%sy, 0.0%ni, 99.5%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 189675188k total, 183821096k used, 5854092k free, 678412k buffers
Swap: 376009348k total, 1892592k used, 374116756k free, 176567228k cached

开始排查是否是kernel引起的。
> /sbin/sysctl -a | grep sem
error: permission denied on key 'kernel.cad_pid'
error: permission denied on key 'kernel.cap-bound'
kernel.sem = 256 32000 100 500

查看sysctl.conf
> less /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 = 68719476736

# Controls the maximum number of shared memory segments, in pages
kernel.shmall = 4294967296

### DBA REQUEST FOR ORACLE11 ###
kernel.shmmni = 4096
kernel.sem = 256 32000 100 500
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_max = 4194394
net.core.wmem_max = 1048576
net.core.rmem_default = 262144
net.core.wmem_default = 262144
fs.aio-max-nr = 3145728

但是查看当前的进程数,也才不到10000,离32000还远呢。
查看了一下其他的库的process情况,终于明白了。
原有的5台,有4台process都是5000,一台是3000,一共就是23000
新加的4台,process都是3000,一共就是12000
加起来还真是超了。也难怪新加的第3个数据库实例没有问题,23000+9000=32000,刚好占完了,一点都没剩下。

和部门协调了一下,原有的5台process平时测试用不了那么多,3000多process已经足够了。
就调整了一下,再次重启就没有问题了。

> sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Apr 16 15:05:37 2014

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

Connected to an idle instance.

SQL> startup nomount
ORACLE instance started.

Total System Global Area 1.1742E+10 bytes
Fixed Size 2251264 bytes
Variable Size 5234492928 bytes
Database Buffers 6492782592 bytes
Redo Buffers 12193792 bytes