Call now: 252-767-6166  
Oracle Training Oracle Support Development Oracle Apps

Free Oracle Tips

HTML Text

 Home
 E-mail Us
 Oracle Articles


 Oracle Training
 Oracle Tips

 Oracle Forum
 Class Catalog


 Remote DBA
 Oracle Tuning
 Emergency 911
 RAC Support
 Apps Support
 Analysis
 Design
 Implementation
 Oracle Support


 SQL Tuning
 Security

 Oracle UNIX
 Oracle Linux
 Monitoring
 Remote s
upport
 Remote plans
 Remote
services
 Application Server

 Applications
 Oracle Forms
 Oracle Portal
 App Upgrades
 SQL Server
 Oracle Concepts
 Software Support

 Remote S
upport  
 Development  

 Implementation


 Consulting Staff
 Consulting Prices
 Help Wanted!

 


 Oracle Posters
 Oracle Books

 Oracle Scripts
 Ion
 Excel-DB   


 

 

 


 

 

 

 

 

Oracle UNIX Administration Displaying the Number of CPU Processors

Oracle UNIX/Linux Tips by Burleson Consulting

Displaying the number of CPU processors in UNIX

You need to have special command for each dialect of UNIX to display CPU information.  Knowing the number of CPUs is very important to the Oracle DBA because it shows the number of parallel query processes that can be concurrently executing on the UNIX server.  Table 2-2 shows the common commands for each major dialect.

UNIX Dialect

Command to display the number of CPUs

Linux

cat /proc/cpuinfo|grep processor|wc –l

Solaris

psrinfo -v|grep "Status of processor"|wc –l

AIX

lsdev -C|grep Process|wc –l

HP/UX

ioscan -C processor | grep processor | wc -l

Table 2: UNIX command to display the number of CPUs

Now let’s take a close look at the commands for each dialect.

Display the number of CPUs in HP/UX

In HP/UX the ioscan command is used to display the number of processors.

root> ioscan -C processor | grep processor | wc -l
16

Display number of CPUs in Solaris

In Sun Solaris, the prsinfo command can be used to count the number of CPUs on the processor.

root> psrinfo -v|grep "Status of processor"|wc -l
       2

For details about the Solaris CPUs, the –v (verbose) option can be used with the prsinfo command.

root> psrinfo -v

Status of processor 0 as of: 12/13/00 14:47:41
  Processor has been on-line since 11/05/00 13:26:42.
  The sparcv9 processor operates at 450 MHz,
        and has a sparcv9 floating point processor.
Status of processor 2 as of: 12/13/00 14:47:41
  Processor has been on-line since 11/05/00 13:26:43.
  The sparcv9 processor operates at 450 MHz,
        and has a sparcv9 floating point processor.

Display number of CPUs in Linux

To see the number of CPUs on a Linux server, you can cat the /proc/cpuinfo file.  In the example below we see that our Linux server has 4 CPUs.

root> cat /proc/cpuinfo|grep processor|wc -l
      4

Display CPUs in AIX

The lsdev command can be used to see the number of CPUs on an IBM AIX server.  Below we see that this AIX server has four CPUs:

root> lsdev -C|grep Process|wc –l
       4

Using nice and priocntl to Change UNIX Execution Priority

While CPU shortages generally require the addition of more processors on the server, there are some short-term things that you can do to keep running until the new processors arrive. Within the server, all tasks are queued to the CPUs according to their dispatching priority, and the dispatching priority is commonly referred to as the nice value for the task. Those tasks with a low nice value are scheduled ahead of other tasks in the CPU queue, while those tasks with a high nice value are serviced later.

In emergency situations where you cannot immediately get more CPUs, you can assign a very low dispatching priority to the Oracle background process, causing them to get CPU cycles ahead of other tasks on the server. This will ensure that Oracle gets all of the CPU that it requires, but it will slow down any external tasks that are accessing the Oracle database. To do this, the systems administrator can alter the CPU dispatching priority of tasks with the UNIX nice or priocntl commands. The UNIX nice command is used to change dispatching priorities, but these numeric ranges vary by operating system. In general, the lower the nice value, the higher the priority.

Displaying the nice Values

In UNIX, you can use the ps –elf command to see each task and its dispatching priority. In the example below, the NI column shows the existing dispatching priority for the task. Note that there are special nice values—SY (system) and RT (real time)—and these have the highest dispatching priority.

root> ps -elf|more

 F S      UID   PID  PPID  C PRI NI  …  SZ    …  STIME TTY    TIME CMD
19 T     root     0     0  0   0 SY  …   0    … Dec 21 ?      0:00 sched
 8 S     root     1     0  0  41 20  …  98    … Dec 21 ?      0:00 init -
19 S     root     2     0  0   0 SY  …   0    … Dec 21 ?      0:00 pageout
19 S     root     3     0  1   0 SY  …   0    … Dec 21 ?     22:13 fsflush
 8 S     root   182     1  0  41 20  …  217   … Dec 21 ?      0:00 usr/lib
 8 S   qmaill   173   161  0  41 20  … 207    … Dec 21 ?      0:00 splog
 8 S     root    45     1  0  48 20  … 159    … Dec 21 ?      0:00 devfs
 8 S     root    47     1  0  49 20  … 284    … Dec 21 ?      0:00 devf
 8 S     root   139     1  0  46 20  … 425    … Dec 21 ?      0:00 syslod
 8 S     root   126     1  0  77 20  … 247    … Dec 21 ?      0:00 inetd
 8 S     root  1600     1  0   0 RT  … 268    … Dec 22 ?      0:00 xntpd

Changing nice Values

Again, we need to note that there are huge dialect differences when using the nice command. In Linux, you can use nice to change the dispatching priority, but in Solaris you must use the priocntl command. You must have root authority to change the dispatching priority, and you will need to consult with your systems administrator before changing CPU dispatching priorities.

Now that we have an understanding of the processors on an Oracle database server, let’s turn our attention to monitoring the RAM memory consumption on our Oracle server.

Next, let’s explore UNIX command to see the RAM memory usage on a UNIX server.

Memory Management Commands in UNIX

There are numerous tools in UNIX that allow the display and management of RAM memory.  These commands fall into several areas:

      1 – Display the amount of RAM on the server

      2 – Display the held RAM memory segments on the server

Let’s take a look at each type of command.

Displaying the total RAM on the UNIX server

The following commands can be used to see how much RAM memory exists on a server, but they do not show how much RAM is in-use.  We will be covering those commands in a later section. 

In Table 2-3 we see that each dialect of UNIX has very different commands for displaying the amount of total RAM on the UNIX server.

Dialect of UNIX

RAM memory display command

DEC-UNIX

uerf -r 300 | grep -i mem

Solaris

prtconf|grep -i mem

AIX

lsdev -C|grep mem

Linux

free

HP/UX

swapinfo -tm

Table 3: UNIX RAM memory display commands

Let’s take a closer look at the RAM memory commands on each dialect of UNIX.

Display RAM memory size on DEC-UNIX

In DEC-UNIX, we need to use the uerf command to display RAM memory.  Here we issue the uerf command with the –i mem argument and we see that we have 3 gigabytes of RAM on this server.

root> uerf -r 300 | grep -i mem
3064M

Display RAM memory size on Solaris

The prtconf Solaris UNIX command can be used on all Solaris servers to quickly see the amount of available RAM memory.

root> prtconf|grep -i mem

Display RAM memory size on AIX

In the IBM AIX dialect of UNIX, we have a two-step command to display the amount of available RAM memory.  We start with the lsdev command to show all devices that are attached to the UNIX server.  The lsdev command produces a large listing of all devices, but we can pipe the output from lsdev to the grep command to refine the display to only show the name of the device that has the RAM memory:

root> lsdev -C|grep mem

mem0       Available 00-00           Memory

Here we see that mem0 is the name of the memory device on this AIX server.  Now we can issue the lsattr –El command (passing mem0 as an argument) to see the amount of memory on the server.  Below we see that this server has 2 gigabytes of RAM memory attached to the mem0 device.

root> lsattr -El mem0

size     2048 Total amount of physical memory in Mbytes  False
goodsize 2048 Amount of usable physical memory in Mbytes False

Display RAM size in Linux

In Linux the free command can be used to quickly display the amount of RAM memory on the server.

root> free

             total       used       free     shared    buffers     cached
Mem:       3728668     504688    3223980      41316     430072      29440
-/+ buffers/cache:      45176    3683492
Swap:       265032        608     264424

Let, let’s look at how to view the actual usage of RAM memory segments on a UNIX server.

Display RAM memory in HP/UX

In HP/UX, we use the swapinfo –tm command to display the amount of RAM.  Here we see that this server has 8 gigabytes of RAM.

root> swapinfo –tm
8096

Show RAM swap usage in HP/UX

The HP/UX dislect of UNIX, we can also use the swapinfo command is used to display the swap usage for a server.  In this case we see the swap disk in the “dev” column, with 1 gigabytes of swap allocated to the /dev/fs0/lv9 logical volume.

root> swapinfo –tam

             Mb      Mb      Mb   PCT  START/      Mb
TYPE      AVAIL    USED    FREE  USED   LIMIT RESERVE  PRI  NAME
dev        1024      25     999    2%       0       -    1  /dev/fs0/lv9
reserve       -     999    -999
memory     3966    3547     419   89%
total      4990    4571     419   92%       -       0    -

 

If you like Oracle tuning, see the book "Oracle Tuning: The Definitive Reference", with 950 pages of tuning tips and scripts. 

You can buy it direct from the publisher for 30%-off and get instant access to the code depot of Oracle tuning scripts.


 

 
  
 

 
 
 
 
Oracle performance tuning software
 
 

 

 
 
 
Oracle performance Tuning 10g reference poster
 
 
 
Oracle training in Linux commands
 
Oracle training Excel
 
Oracle training & performance tuning books
 

 

Burleson is the American Team

Note: This Oracle documentation was created as a support and Oracle training reference for use by our DBA performance tuning consulting professionals.  Feel free to ask questions on our Oracle forum.

Verify experience! Anyone considering using the services of an Oracle support expert should independently investigate their credentials and experience, and not rely on advertisements and self-proclaimed expertise. All legitimate Oracle experts publish their Oracle qualifications.

Errata?  Oracle technology is changing and we strive to update our BC Oracle support information.  If you find an error or have a suggestion for improving our content, we would appreciate your feedback.  Just  e-mail:  and include the URL for the page.


                    









Burleson Consulting

The Oracle of Database Support

Oracle Performance Tuning

Remote DBA Services


 

Copyright © 1996 -  2011 by Burleson Enterprises

All rights reserved.

Oracle © is the registered trademark of Oracle Corporation.