Skip to content

Unix memory monitoring tools – sar,top,vmstat,ipcs,ps,crash,size – knowledge article for the new oracle dba




you are a new oracle dba. you want to know a bit more about the unix operating system because your oracle database is on a unix server(HP-unix or solaris etc).You are mainly interested on the unix tools with which you can find out the memory consumption on the unix server. It could be size of a oracle process or the paging activity on the server or the virtual memory usage on the server etc.

Below article discusses about the various tools that can be used on the unix server to monitor the memory usage. The summary is that no one tool can accurately predict the exact process size. by knowing the capabilities of each individual tool you can understand what the tool gives and what the tool cant give.In this way you can understand the output given by the above commands much better.Most of the time as a production dba if you want the performance statistics on the unix server you will talk to your unix administrator or you can look at the v$osstat view in your database but knowing the capabilities of the below commands and being aware of the below commands will give you a certain edge when speaking to your unix administrator or when you want to test yourself these commands on your unix server.

now enjoy the below article.

Monitoring Memory Use [ID 2060096.6]  

 
  Modified 25-JUL-2010     Type BULLETIN     Status PUBLISHED  
       
 
"Checked for relevance on 04-Nov-2008"
***Checked for relevance on 25-Jul-2010***
 
---------------------
Monitoring Memory Use
---------------------
 
There are two primary things to be concerned with when sizing memory
for a UNIX system: do you have enough RAM, and do you have enough
swap space?  To answer these questions, you must know how much virtual
memory and how much physical memory each process on the system is using.
 
Standard UNIX process monitoring tools do not provide a way to
reliably determine these figures.  The standard tools for examining
memory usage on a UNIX system are 'size', 'ipcs', 'ps', 'vmstat', 'top' and
'pstat'.  Most SYSV-derived systems also have the 'crash' utility:
most BSD-derived systems allow you to run 'dbx' against the UNIX kernel.
 
'size'
------
The 'size' utility performs a static analysis of the program
image.  It prints out the virtual memory size of the text, BSS and
initialized data segments.  It does not attempt to determine the size
of the stack and the heap, since both of these sizes can vary greatly
depending on the input to the program.
 
Since the combined size of the stack and the heap is typically several
hundred times larger than than the combined size of the BSS and the
initialized data, this method is the most unreliable for determining
the runtime virtual memory requirement of a program.
 
However, it is the method used in the ICG to determine memory requirements
for Oracle programs.  The one useful piece of information you can obtain
from 'size' is the virtual size of the text segment.  Since the text
segment is paged from the filesystem, knowing the virtual size of
the text segment will not help you size either swap space or RAM.
 
'ipcs'
------
The 'ipcs' utility prints out the virtual memory size of all the
shared memory segments on the system.  Use the '-mb' flags to have it
print the size of the segments under the SEGSZ column.
 
'ps'
----
The 'ps' utility can print out information about any process currently
active on the system.  On SYSV-based systems, using 'ps' with the '-l'
prints the SZ field, which contains the virtual size of the process's
non-text segments, measured in pages.  On BSD-based systems, using 'ps'
with the '-u' flag also prints the SZ field.  While this figure is an
accurate measure of the virtual memory being used by this process, it
is not accurate if the process has attached a shared memory segment.
This means that when sizing memory, you must subtract the size of the
SGA (obtained via 'ipcs', above) from the virtual memory used by all
of the Oracle background and shadow processes.
 
On SVR4-based and BSD-based systems, using the BSD-style 'ps' command
with the '-u' flag will also cause the RSS field to be printed.  This
field contains the physical memory usage for the process.
Unfortunately, this value is the combined physical memory usage for all
the segments of the process, and does not distinguish between pages
private to the process and pages shared between processes.  Since text
and shared data pages are shared between processes, this means that
adding up the RSS sizes of all processes on the system will
over-estimate the amount of physical memory being used by the system.
This also means that if you add up the RSS fields for all the processes
on the system you may very well come up with a number larger than the
amount of RAM on your system!  While the RSS field is a good indicator
of how much RAM is required when there is only one process running a
program image, it does not tell you how much additional RAM is required
when a second process runs that same image.
 
'pstat'
-------
The 'pstat' utility is also used to print per-process information.
If it has a SZ or RSS field, the same limitations that apply to 'ps'
output also apply to 'pstat' output.  On some versions of UNIX, 'pstat'
invoked with a flag (typically '-s' or '-T') will give you information
about swap space usage.  Be careful!  Some UNIX versions will only
print out information about how much swap space that is used, and not
about how much has been allocated.  On those machines you can run out
of swap, and 'pstat' will still tell you that you have plenty of swap
available.
 
'vmstat'
--------
The 'vmstat' utility is used to print out system-wide information on
the performance of the paging subsystem.  Its major limitation is that
it does not print out per-process information.  The format of 'vmstat'
output varies between UNIX ports: the key fields to look at are the
ones that measure the number of page-in and page-out events per
second.  Remember that some paging activity is normal, so you will have
to decide for yourself what number of pages-in or pages-out per second
means that your page pool is too small.
 
'sar'
-----
On SYSV-based systems, the 'sar' utility is used to print out
system-wide information on the performance of a wide variety of kernel
subsystems.  Like 'vmstat', its major limitation is that it does not
print out per-process information.  The '-r', '-g', and '-p' options
are the most useful for examining the behavior of the paging subsystem.
 
'top'
-----
The  top  program  provides  a  dynamic real-time view of a running system.
It can display system summary information as well as a list of tasks currently
being managed by the kernel.
The types  of  system summary  information  shown  and the types, order and
size of information displayed for tasks are all user configurable and that
configuration can be made persistent across restarts.
 

'crash'
-------
On SYSV-based systems, the 'crash' utility lets you directly examine
the contents of the operating system kernel data structures.  On
BSD-based systems, it is usually possible to use a kernel debugger to
examine these same data structures.  These data structures are always
hardware- and operating system-specific, so you will not only need a
general knowledge of UNIX internals, but you will also need knowledge of
the internals of that particular system.  However, if you have this
information (and a lot of patience) it is possible to get 'crash' to
give you precise information about virtual and physical memory usage on
a per-process basis.
 
Public domain and vendor-specific tools
---------------------------------------
Finally, there are a variety of public domain and vendor-specific tools
for monitoring memory usage.  For example: Sun's proctool, HP's glance,
or SGI's bloadmap.
 
Remember: you are looking for a utility that lets you measure the
physical memory usage of a process, and which gives you separate values
for the number of pages used by the text segment, the shared memory
segment, and the remainder of the process. Consult your operating
system vendor for details.
 
 
RELATED DOCUMENTS
-----------------
 
Note 174555.1 - UNIX: Determining the Size of an Oracle Process
Note 17094.1 - TECH: Unix Virtual Memory, Paging & Swapping explained

 

Related


Products


  • Oracle Database Products > Oracle Database > Oracle Database > Oracle Server – Enterprise Edition

 

Back to top

Rate this document 

Article Rating

Rate this document
Excellent
Good
Poor
 
Did this document help you?
Yes
No
Just browsing
 
How easy was it to find this document?
Very easy
Somewhat easy
Not easy

 

  Comments

 
Cancel    

 

VN:F [1.9.22_1171]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

Post a Comment

You must be logged in to post a comment.