您的位置:首页 > 其它

系统共享内存的修改(ORA-27102: out of memory)

2011-12-09 17:09 375 查看
今天做压力测试的时候,修改数据参数出现ORA-27102: out of memory错误,最后发现是系统参数设置的问题,限制了oracle的sga大小

修改系统参数前,一定要备份参数文件,
create spfile from pfile='/opt/oracle/product/11.1/db_1/dbs/initorcl.ora';
------- 查看sga的大小
SQL> show parameter sga
NAME TYPE VALUE

------------------------------------ ----------- ------------------------------

lock_sga boolean FALSE

pre_page_sga boolean FALSE

sga_max_size big integer 1552M

sga_target big integer 1536M
修改sga_max_size
alter system set sga_max_size=10240M scope=spfile;
重新启动数据库
SQL> startup force

ORA-27102: out of memory

Linux-x86_64 Error: 28: No space left on device
出现ORA-27102错误,这是我们可以使用备分的参数文件启动数据库;
startup pfile='/opt/oracle/product/11.1/db_1/dbs/initorcl.ora';
问题到这里,虽然库可以启动,但参数还是没有改。
这是我们可以修改一下系统参数/etc/sysctl.conf文件中的kernel.shmall参数
原参数
-------------------------------------------------------------------------------
fs.file-max = 6553600

kernel.shmall=2097152

kernel.shmmax=2147483648

kernel.shmmni=4096
-------------------------------------------------------------------------------
修改后为
--------------------------------------------------------------------------------
fs.file-max = 6553600

kernel.shmall = 4194304

kernel.shmmax = 2147483648

kernel.shmmni = 4096
---------------------------------------------------------------------------------
修改完这些参数后,我们就可以正常启动了
先创建spfile,然后我们以spfile启动
SQL> create spfile from pfile;
File created.
SQL> startup force

ORACLE instance started.
Total System Global Area 1620189184 bytes

Fixed Size 2144824 bytes

Variable Size 922748360 bytes

Database Buffers 671088640 bytes

Redo Buffers 24207360 bytes

Database mounted.

Database opened.
我们再次修改
alter system set sga_max_size=10240M scope=spfile;
orcl@SYS>startup force

ORACLE instance started.
Total System Global Area 1.0689E+10 bytes

Fixed Size 2147392 bytes

Variable Size 9596570560 bytes

Database Buffers 1073741824 bytes

Redo Buffers 17014784 bytes

Database mounted.

Database opened.
问题成功解决

原因分析:linux系统默认的共享共存为系统内存的 一半,也就算是说即使系统没有其他任何程序占用系统共享内存,oracle做能使用的内存也不可能个超过2G,这里我们修改了限制共享内存的参数文件,扩大了系统的共享内存,从而使数据库能正常启动。同时也希望大家如非必要,尽量不要修改这个参数,因为你一旦扩大了共享内存,那么就有可能出现应用程序和操作系统争抢内存的状况,试想数据库所依托的操作系统出了问题,你的数据库还能正常么!
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: