Use Oracle ipcs Command to Determine Shared Memory

By Richard Niemiec on June 17, 2013


A helpful memory command that you can use to monitor the Oracle SGA is the ipcs command. The ipcs command displays the size of each shared memory segment for the SGA. If there is not enough memory for the entire SGA to fit in a contiguous piece of memory, the SGA will be built in noncontiguous memory segments. In the event of an instant crash, the memory might not be released. If this happen to you, note that the ipcrm command removes the segments (ipcrm –m for memory segments and ipcrm –s for semaphore segments). Use ipcs –b on Solaris and ipcs –a on Linux, HPUX, and AIX.

 

1024_001

 

In the preceding example, the SGA is built in three noncontiguous segments (making up the 100M+ SGA). The instance is then shut down and started with a smaller SGA (so the SGA is made up of contiguous pieces of memory). After the SGA has been lowered to 70M, I again issue the ipcs command:

 

1024_002

 

Fitting the entire SGA into a single shared memory segment is generally preferable because of the overhead that can be required to track more than one segment and the time required to switch back and forth between those segments. You can increase the maximum size of a single shared memory segment by increasing the SHMMAX setting in the /etc/system file (or /etc/sysctl.conf depending on version). See the Oracle install documentation for more specific information for your platform. On Solaris 10, the setting of the shared memory parameters moved to resource control, so if you modify the /etc/system file, any changes you make are ignored. Lastly, if you configure Hugepages, then the memory is pulled from a pool, and semaphores are not used. AMM requires the use of semaphores, so if you set MEMORY_TARGET, you cannot use Hugepages.

TIP

Use the ipcs command to see if your SGA is built using multiple noncontiguous pieces of memory. A database crash can cause this to be problematic by not releasing the memory. Use the ipcrm command (only if the SGA pieces are not released after a database crash) to then remove the SGA pieces from memory. Do not issue the ipcrm command with a running database.

Related Posts

Leave a Reply