今天上午有一个数据库恢复的工作,目的是要把预生产库的数据库恢复到生产库去。用的是ASM,磁盘组,参数文件什么都创建好了,尝试启动instance,却发现instance启动不了。
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 4 22:25:08 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount; ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device SQL> exit
首先想到是内存不足了,于是用free查看,发现空闲的内存只有876mb , 而大部份内存是被cache了 。
root@hostname:~#free -m total used free shared buffers cached Mem: 32055 31179 876 0 443 25223
-/+ buffers/cache: 5513 26542 Swap: 8191 316 7875
尝试释放cache里的内存:
比较释放前后的值,可以发现已经有近20G内存释放了。重新启动instance,发现仍然不能启动。
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 4 22:25:08 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount; ORA-27102: out of memory Linux-x86_64 Error: 28: No space left on device SQL> exit
先把/proc/sys/vm/drop_caches改回默认值再说:
又想到linux里的核心参数,于是参考了预生产库的的参数配置:
# Oracle Kernal Parameters #kernel.shmall = 2097152 #kernel.shmmax = 2147483648 kernel.shmmni = 4096 kernel.sem = 256 96000 100 1024 fs.file-max = 6553600 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 4194304 kernel.msgmni = 2878
但发现参数文件设定的值和系统的实际完全不一样 :
hostname:elcaro:$ cat /proc/sys/kernel/shmall 4294967296 hostname:elcaro:$ cat /proc/sys/kernel/shmmax 68719476736
于是将生产库的核心参数改为和预生产库一样,问题解决:
#Oracle Kernal Parameters #kernel.shmall = 2097152 kernel.shmall = 4294967296 #kernel.shmmax = 2147483648 kernel.shmmax = 68719476736 kernel.shmmni = 4096 #kernel.sem = 256 32000 100 142 kernel.sem = 256 96000 100 1024 fs.file-max = 6553600 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 "/etc/sysctl.conf" 70L, 2012C written
root@hostname:~#sysctl -p net.ipv4.tcp_max_syn_backlog = 8192 net.ipv4.conf.all.accept_source_route = 0 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.ip_forward = 0 net.ipv4.conf.all.send_redirects = 0 net.ipv4.conf.default.send_redirects = 0 net.ipv4.icmp_ignore_bogus_error_responses = 1 net.ipv4.conf.all.rp_filter = 1 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.core_pattern = /var/core/core_%e_%p kernel.shmall = 4294967296 kernel.shmmax = 68719476736 kernel.shmmni = 4096 kernel.sem = 256 96000 100 1024 fs.file-max = 6553600 net.ipv4.ip_local_port_range = 1024 65000 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 4194304 kernel.msgmni = 2878 root@hostname:~#exitlogout hostname:elcaro:$ dbi si
SQL*Plus: Release 11.2.0.1.0 Production on Thu Aug 4 23:33:13 2011
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount; ORACLE instance started.
Total System Global Area 4275781632 bytes Fixed Size 2220200 bytes Variable Size 905973592 bytes Database Buffers 3355443200 bytes Redo Buffers 12144640 bytes SQL> exit
关于free 和 /proc/sys/vm/drop_caches ,可参考:
|