DBA > Articles

Instance Shared Memory and Semaphore Segments

By: Vinod Sadanandan
To read more DBA articles, visit http://dba.fyicenter.com/article/

Instance Shared Memory & Semaphore Segments
Shared Memory Allocation
Oracle has three different possible models for the SGA - one-segment, contiguous multi-segment, and non-contiguous multi-segment.When attempting to allocate and attach shared memory for the SGA, it will attempt each one, in the above order, until one succeeds or raises an ORA error. On other, non-fatal, errors, Oracle simply cleans up and tries again using the next memory model. The entire SGA must fit into shared memory, so the total amount of shared memory allocated under any model will be equal to the size of the SGA.

Semaphore Segments
Oracle uses semaphores to control concurrency between all the background processes (pmon, smon, dbwr, lgwr, and oracle shadows). Semaphores are also used to control two-task communication between the user process and shadow process .Occasionally, unexpected termination of Oracle processes will leave semaphore resources locked. If your database is not running, but "ipcs -sb" shows that semaphore sets owned by oracle are still in use, then you may need to deallocate (free) them. If you don\'t do this, then you may not be able to allocate enough semaphores later to restart your database (not always!!).

Database Version :10.2.0.3
OS Version :Oracle Enterprise Linux
SQL> oradebug setmypid
Statement processed.
SQL> oradebug ipc
Information written to trace file.
SQL>
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
ORACLE_HOME = /u03/app/oracle/10.2.0
System name: Linux
Node name: localhost.localdomain
Release: 2.6.18-53.el5xen
Version: #1 SMP Sat Nov 10 19:46:12 EST 2007
Machine: x86_64
Instance name: orcl
Redo thread mounted by this instance: 1
Oracle process number: 22
Unix process pid: 28114, image: oracle@localhost.localdomain (TNS V1-V)

*** 2008-02-28 12:11:35.477
*** SERVICE NAME:(SYS$USERS) 2008-02-28 12:11:35.423
*** SESSION ID:(157.39) 2008-02-28 12:11:35.423
Dump of unix-generic skgm context
areaflags 000000a7
realmflags 0000000f
mapsize 00001000
protectsize 00001000
lcmsize 00001000
seglen 00001000
largestsize 0000001000000000
smallestsize 0000000000400000
stacklimit 0x7fffa7889350
stackdir -1
mode 660
magic acc01ade
Handle: 0x1ebf5530 `/u03/app/oracle/10.2.0orcl\'
Dump of unix-generic realm handle `/u03/app/oracle/10.2.0orcl\', flags = 00000000
Area #0 `Fixed Size\' containing Subareas 0-0
Total size 00000000001f9c58 Minimum Subarea size 00000000
Area Subarea Shmid Stable Addr Actual Addr
0 0 458764 0x00000060000000 0x00000060000000
Subarea size Segment size
00000000001fa000 000000000c801000
Area #1 `Variable Size\' containing Subareas 2-2
Total size 000000000c000000 Minimum Subarea size 00400000
Area Subarea Shmid Stable Addr Actual Addr
1 2 458764 0x00000060800000 0x00000060800000
Subarea size Segment size
000000000c000000 000000000c801000
Area #2 `Redo Buffers\' containing Subareas 1-1
Total size 0000000000606000 Minimum Subarea size 00000000
Area Subarea Shmid Stable Addr Actual Addr
2 1 458764 0x000000601fa000 0x000000601fa000
Subarea size Segment size
0000000000606000 000000000c801000
Area #3 `skgm overhead\' containing Subareas 3-3
Total size 0000000000001000 Minimum Subarea size 00000000
Area Subarea Shmid Stable Addr Actual Addr
3 3 458764 0x0000006c800000 0x0000006c800000
Subarea size Segment size
0000000000001000 000000000c801000
Dump of Solaris-specific skgm context
sharedmmu 00000000
shareddec 0
used region 0: start 0000000040000000 length 000000007fff40000000
Maximum processes: = 150
Number of semaphores per set: = 154
Semaphores key overhead per set: = 4
User Semaphores per set: = 150
Number of semaphore sets: = 1
Semaphore identifiers: = 1
Semaphore List=
98304
-------------- system semaphore information <== Shared Memory Segments output format is diffrent in Enterprise Linux
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x00000000 65536 oracle 600 393216 2 dest
0x00000000 98305 oracle 600 393216 2 dest
0x00000000 131074 oracle 600 393216 2 dest
0x00000000 163843 oracle 600 393216 2 dest
0x00000000 196612 oracle 600 393216 2 dest
0x00000000 229381 oracle 600 393216 2 dest
0x00000000 262150 oracle 600 393216 2 dest
0x00000000 294919 oracle 600 393216 2 dest
0x00000000 327688 oracle 600 393216 2 dest
0x00000000 360457 oracle 600 393216 2 dest
0x00000000 393226 oracle 600 393216 2 dest
0x00000000 425995 oracle 600 393216 2 dest
0x7505c274 458764 oracle 660 209719296 23
0x721836c0 491533 oracle 660 171970560 14
------ Semaphore Arrays --------
key semid owner perms nsems
0x271b7db8 98304 oracle 660 154
0x6b0722dc 229377 oracle 660 44
------ Message Queues --------
key msqid owner perms used-bytes messages

Full article...


Other Related Articles

... to read more DBA articles, visit http://dba.fyicenter.com/article/