Tuesday, December 6, 2011

ORA-27102: out of memory on Solaris 10

This problem is due to insufficient shared memory from system while Oracle tries to create shared memory segment(depends on the size and SGA and PGA). Unlike earlier releases of Solaris (Solaris 8 and 9), most of the system parameters needed to run Oracle are already set properly, so the only one parameter to be set is the maximum shared memory. In earlier versions this was called shmsys:shminfo_shmmax and was set by editing the /etc/system file and rebooting. With Solaris 10 the parameter is set by modifying a "Resource Control Value". You can do this temporarily by using prctl, but that is lost at reboot so you will need to add the command to the oracle user. The other option is to create a default project for the oracle user:

$ projadd -U oracle -K "project.max-shm-memory=(priv,13G,deny)" user.oracle

How large shared memory should be set for Oracle depends on the physical memory size. For Solaris , 8M is the default value on Solaris 9 and prior versions where as 1/4th of the physical memory is the default on Solaris 10 and later. Verifying the default setting of os is shown as the following
$ prtconf | grep Mem
Memory size: 32760 Megabytes

$ id -p
uid=59008(oracle) gid=10001(dba) projid=3(default)

$ prctl -n project.max-shm-memory -i project 3
project: 3: default
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
        privileged      7.84GB      -   deny                                 -
        system          16.0EB    max   deny                                 -

By default, Oracle 10 will allocate 40% of the total system physical memory to create SGA and PGA. So for 32G system memory, the shmmax for Oracle 10 will be 0.4*32G = 12.8G.
(Temporary method)
$ prctl -n project.max-shm-memory -r -v 10G -i project 3

(No need to reboot)
$ projadd -p 100  -c 'test shmmax' -U oracle -G dba  -K 'project.max-shm-memory=(privileged,13G,deny)' user.oracle

$ projects -l
        projid : 100
        comment: "test shmmax"
        users  : oracle
        groups : dba
        attribs: project.max-shm-memory=(privileged,13958643712,deny)

$ cat /etc/project
user.oracle:100:test shmmax:oracle:dba:project.max-shm-memory=(privileged,13958643712,deny)

- Nếu cài 2 oracle 10g và 11g vào chung một server(nếu tổng ram server là 32G muốn cho oracle 10g: 10G ram, oracle 11g: 10G ram) thì  set shmsys:shminfo_shmmax là 20G ram

vi /et/system
set shmsys:shminfo_shmmax=21474836480
set semsys:seminfo_semmni=1024
set semsys:seminfo_semmsl=1024
set shmsys:shminfo_shmmni=100

Reboot lại hệ thống

No comments: