CPU Usage | Process   «Prev  Next»
Lesson 6

Monitoring CPU Consumption Conclusion

This module covered UNIX-specific tools and technique for monitoring CPU consumption on an Oracle database server.

Module summary

Here is a summary of the main points from this module:
  1. An Oracle instance consists of numerous background processes that compete for CPU resources.
  2. You can use the ps command to see the cumulative amount of CPU that is used by a process.
  3. You can use the vmstat utility to see overall CPU usage on your server.
  4. The last four columns in vmstat indicate CPU usage. The are user (us), system (sy), idle (id), and wait (wt).
  5. The vmstat run queue column is very important because if it exceeds the number of CPUs, processes are waiting for services.
  6. All processes are allocated CPU resources according to their dispatching priority. The lower the priority number, the faster they get CPU services.
  7. The nice command can be used to alter dispatching priorities within the server.
By completing this module, you should be able to:
  1. Monitor CPU usage with the ps command
  2. Execute and interpret vmstat
  3. Describe dispatching priority
  4. Run the nice command to change CPU dispatching priorities

How does the nice command change the CPU dispatching priorities in Oracle?

The "nice" command in Unix-like operating systems is used to change the priority of a process, including Oracle database processes, when it is started. The nice value determines the priority of the process, with a higher nice value indicating a lower priority.
In Oracle, the nice value of a process can be used to adjust its dispatch priority and determine the amount of CPU cycles that it receives. By default, Oracle processes are started with a nice value of 0, which indicates a normal priority. If a process is started with a higher nice value, it will receive a lower priority and a smaller share of the CPU cycles.
Here is an example of how to start an Oracle process with a higher nice value using the "nice" command:
$ nice -n 10 sqlplus / as sysdba

In this example, the -n 10 option sets the nice value to 10, which gives the process a lower priority. The sqlplus command is used to start an instance of the SQL*Plus command-line interface, and the / as sysdba options are used to connect to the database as the system administrator.
Note that changing the nice value of an Oracle process only affects its dispatch priority, not the amount of CPU cycles that are available to the system as a whole. If the system is under heavy load, processes with lower priorities may still be subject to performance issues, even if they have been started with a higher nice value.
In general, the use of the "nice" command to adjust the dispatch priority of an Oracle process should be done with caution, and only after careful consideration of the potential impact on the performance of the system as a whole.


Here are some terms from this module that may be new to you:
  1. ps command: A command that checks for any processes that are consuming an inordinate amount of CPU cycles.
  2. spinning: Spinning means that the process continues to look for the availability of the latch after fixed intervals of time, during which it sleeps.
  3. CPU bottleneck: A condition characterized by tasks waiting for CPU services.
  4. dispatching priority: Order in which CPU cycles within the database server are assigned to the run queue. Those tasks with a high dispatching priority will move to the top of the CPU run queue while use tasks with a lower dispatching priority will wait their turn ina queue.
  5. FIFO: Stands for "first in, first out.
  6. nice command: UNIX command that controls CPU dispatching priorities.
  7. renice command: UNIX command that controls the dipatching priority of tasks currently executing.

Oracle Databases CPU Challenge - Quiz

Before you go ahead, complete this Quiz to test your knowledge of tuning CPU consumption.
Oracle Databases CPU Challenge - Quiz
The next lesson explores reorganization of Oracle tables.