【问题重现】
1. 平台环境:CentOS5.5 + Oracle 11g R2
2. oracle用户的配置文件“.bash_profile”中的信息:
ORACLE_SID=Instance01
ORACLE_BASE=/u01
ORACLE_HOME=/u01/oracle
3. 过程描述
在“/u01/oracle/dbs”目录下有两个spfile——spfileInstance01.ora和spfileInstance02.ora。
因此可以通过在terminal中设置不同的ORACLE_SID来启动不同的实例。而在oracle用户的配置文件中($ORACLE_HOME/.bash_profile),默认的ORACLE_SID=Instance01。
当启动第一个实例Instance01时,启动正常;但当启动第二个实例Instance02时,就报出错误:ORA-00845 MEMORY_TARGET not supported on this system
(1)启动第一个实例Instance01
[oracle@hostname-oracle11gR2 dbs]$ env | grep ORACLE
ORACLE_UNQNAME=orcl
ORACLE_SID=Instance01
ORACLE_BASE=/u01
ORACLE_HOME=/u01/oracle
[oracle@hostname-oracle11gR2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 23 21:37:51 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 623546368 bytes
Fixed Size 1338308 bytes
Variable Size 406848572 bytes
Database Buffers 209715200 bytes
Redo Buffers 5644288 bytes
(2)启动第二个实例Instance02,同时保持第一个实例正常运行。
[oracle@hostname-oracle11gR2 dbs]$ ORACLE_SID=Instance02
[oracle@hostname-oracle11gR2 dbs]$ export ORACLE_SID
[oracle@hostname-oracle11gR2 dbs]$ env | grep ORACLE
ORACLE_UNQNAME=orcl
ORACLE_SID=Instance02
ORACLE_BASE=/u01
ORACLE_HOME=/u01/oracle
[oracle@hostname-oracle11gR2 dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Thu May 23 21:37:51 2013
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount;
ORA-00845: MEMORY_TARGET not supported on this system
【原因分析】
oracle11g数据库在执行dbca或者调整sga后重启oracle,或者在同时启动多个实例的时候可能会出现ORA-00845 MEMORY_TARGET not supported on this system 错误。
来自Oracle的官方解析是:
Starting with Oracle Database 11g, the Automatic Memory Management feature requires more shared memory (/dev/shm)and file descriptors. The size of the shared memory should be at least the greater of MEMORY_MAX_TARGET and MEMORY_TARGET for each Oracle instance on the computer. If MEMORY_MAX_TARGET or MEMORY_TARGET is set to a non zero value, and an incorrect size is assigned to the shared memory, it will result in an ORA-00845 error at startup.
简单来说就是 MEMORY_MAX_TARGET 的设置不能超过 /dev/shm 的大小。
究其原因就是Linux系统的shm的大小比SGA设置的小,造成的,举例来说,SGA设置4G,而shm可能只有1G
SQL> show parameter memory_max_target;
NAME TYPE VALUE
-------------------------- ----------------- -------------------
memory_max_target big integer 596M
SQL> show parameter memory_target;
NAME TYPE VALUE
-------------------------- ----------------- -------------------
memory_target big integer 596M
【解决方法】
网上提供两种解决办法:
1. 调整sga的大小,这个明显不是我们所希望的
2. 调整shm的大小,这样相对简单,具体操作如下
vi /etc/fstab
修改如下行的设置
tmpfs /dev/shm tmpfs defaults 0 0
改成
tmpfs /dev/shm tmpfs defaults,size=6G 0 0
保存退出
重新mount下shm使其生效
mount -o remount /dev/shm
通过df可以查看下,没有问题就可以继续安装数据库或者启动数据库了!
命令:df –h /dev/shm
说明:服务器上有两个不同数据库实例,启动一个实例的时候没问题。在启动第二个INSTANCE的时候报ORA-00845错误。该测试服务器仅8G内存。 tmpfs 默认是4G 4.0G 1.6G 2.4G 40% /dev/shm. 两个实例的使用内存应该超过了4G,所以按照网上这篇文章进行修改tmpfs,问题解决了。
读者如要转载,请标明出处和作者名,谢谢。
地址:http://space.itpub.net/25851087
作者名:zjrodger
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25851087/viewspace-761886/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25851087/viewspace-761886/