注册通行证 用户名 密码
  • 文章投稿
  • 博客
  • 论坛
  • 设为首页
  • 加入收藏
jztop.com网络技术
  • 首页
  • | iT新闻
  • | 操作系统
  • | 组网建网
  • | 网络安全
  • | 程序开发
  • | 办公一族
  • | 工具软件
  • | 网页制作
  • | 多媒体制作
  • | 网吧技术
  • | 服务器
  • | 专题教程
Vista | 软件评测 | 系统备份 | 优化 | 进程 | 聊天 | 病毒 | Linux | 黑客 | 防火墙 | 数据库 | Web开发 | Java | Word | 游戏 | 32位开发 | 移动开发
当前位置:首页 > 程序开发 > 数据库 > Oracle 内容正文:Monitor Oracle Resource Consumption in UNIX

Monitor Oracle Resource Consumption in UNIX

发布时间:2006-06-12 23:53:41 来源:友佳学院(整理) 网友评论 0 条

PURPOSE

=======
This article is intended to provide DBAs an overview of the resources
consumed by Oracle, and the tools commonly used to monitor the resource
consumption.
SCOPE & APPLICATION
===================
Database performance is bounded by the system resources. Sometimes,
poor database performance can be caused by faulty configuration of the
instance and database. Sometimes, it can be caused by abnormal resource
consumption by an Oracle transaction, user, or process. It is essential
for DBAs to proactively monitor the resource consumption, and take any
corrective actions before potential serious impacts.
Memory, CPU, and I/O are the three most common resources consumed by
Oracle. We will discuss these resources, and list some of the commonly
used tools that monitor them. These resources can be monitored at both
Oracle Server and Operating System levels. DBAs should acquire any detailed
information about the OS tools from the System Administrators or OS vendors.
OVERVIEW
========
Oracle Instance
---------------
An Oracle Instance is a set of System Global Area and background processes.
It is started during �startup nomount�. The characteristics of an instance
are:
 - Its name is defined by environmental variable ORACLE_SID.
  - It is started based on the configurations defined in init.ora file.
  - It has its own set of SGA and background processes.
  - It can only belong to one database at one time.
  - Multiple instances can access the same database in OPS configuration.
There can be multiple oracle instances from the same $ORACLE_HOME. They
are only limited by the OS resources, such as disk, memory, kernel parameters,
etc. Each time an instance is started, the OS is being asked to give some
key resources according to the parameters specified in init.ora
for that instance. Each Oracle instance has two main areas of memory structures,
System Global Area (SGA) and Program Global Area (PGA) for background processes.
SYSTEM RESOURCES
================
Memory
------
There are several memory structures used by Oracle, SGA, PGA, UGA, and
sort area.
1) Shared Memory & Semaphores
Oracle uses shared memory for efficiency. The OS does not have
to load up the same address page(s) into the memory each time a process
needs to reference it. Instead the process can just reference the one memory
location, read/write to it, and then leave. Therefore, the data is not
moved from one processs memory address space to another. In order to control
memory integrity so that only one process is accessing that memory address,
semaphores are used.
Semaphores have only two values, set or unset. When a process goes to
reference a memory location, it first checks to see if the semaphore allocated
for that memory location is set. If so, it waits until that semaphore location
is free. Once available, it will first set the semaphore so to not allow
other processes to interrupt or corrupt the current processes read/write.
The size of the SGA is made up by shared pool, database buffer cache,
redo log buffer, large pool, and java pool. A commonly used formula to
calculate the size of the SGA is:
((db_block_buffers * block size) + (shared_pool_size +
large_pool_size + java_pool_size + log_buffers) + 1MB
See more detailed information in 
How to determine
SGA Size (7.x, 8.0, 8i, 9i).
For optimal database performance, SGA should fit into real memory, and
avoid swapping. The size of the SGA is also bounded by OS kernel parameters,
such as SHMMAX in Unix. To learn more about shared memory, see 
Shared
memory requirement on Unix.
Since the SGA can be accessed by all processes that have been allocated,
this is used to allow multiprocessing and access between processes within
the SGA.
A few of the common semaphores and shared memory segments that Oracle
uses are:
 - SEMMNI => Max number of semaphores sets/identifiers
  - SEMMNS => Max number of semaphores in system
  - SHMMNI => Number of shared segments identifiers to be pre-allocated
  - SHMMAX => Max shared segment size
 
For more information, see 
Unix Semaphores and Shared
Memory Explained.
Also see the corresponding Oracle Installation Guide for your release of Oracle,
that indicate minimum values for semaphore and shared memory. 
2) Private Memory
PGA is a memory region containing data and control information
for a single server or background process. The size of PGA depends on the
database configuration, and what the process does. In a dedicated server
configuration, where one server process interacts with one user process,
PGA contains stack space and UGA. UGA is made up by user session data,
cursor state, and sort area.  In a multithreaded server configuration,
where one shared server is shared by multiple user processes, UGA is part
of the shared pool.
The PGA exists as:
- Nonshared memory area to which a process can write
 - One PGA is allocated for each server or background process
 - Once the user has connected, a user can never run out of PGA space.
Otherwise the connection will not happen and may result in an ora-4030 error.
Oracle parameters that affect the sizes of PGA are:
 - open_links
  - db_files
  - sort_area_retained_size
  - sort_area_size
To calculate the current PGA size:
 SESSION PGA MEMORY => Statistic containing the current PGA size for a session
 SESSION PGA MEMORY MAX => Statistic containing the peak PGA size for a session
PGA = dedicated server processes - UGA = Client machine process
To view a listing of the UGA and PGA memory for every session, see 
TFTS:
LISTING MEMORY USED BY ALL SESSIONS
Note: On the RS/6000, each shadow process stores its PGA in a shared memory segment.
The size of the stack space in each PGA created on behalf of Oracle
background processes (such as DBWR and LGWR), is affected by some additional
parameters.
CPU
---
CPU consumption varies with the activities of the processes. During
the peak workload, the DBAs and the SAs may see CPU utilization go up to
90%. In general the DBAs should balance the workload to avoid overloading
the system.
I/O
---
The amount of I/O occurrence also depends on the activities of the processes. 
While memory I/O may be necessary, disk I/O should be minimized. To avoid
disk I/O contention, files should be distributed across devices. Some of
the background processes can be I/O intensive, such as DBWn, LGWn, ARCn,
and CKPT. In some situations, DBAs may find multiple DBWn/ARCn, or DBWR/ARC0/LWGR
I/O slaves beneficial.
MONITORING AT THE SERVER LEVEL
==============================
V$ dynamic performance views capture the cumulative statistics of resource
consumptions, at both system or session levels. STATSPACK  and Utlbstat/utlestat
reports summarize the statistics from these v$ views for a defined period
of time for the database and tkprof utility reports statistics at query
level. Init.ora parameter TIMED_STATISTICS should set to be true.
The descriptions of v$ views are in Oracle 7/8/8i/9i Server Reference manual.
To learn more about analyzing STATSPACK  or utlbstat/utlestat reports,
see  StatsPack FAQ  and
 Systemwide
Tuning using UTLESTAT Reports in Oracle7/8
To learn more about interpreting tkprof output, see Note 
:Tkprof
Interpretation.
Examples
--------
The following examples shows the output from all different tools available
in Oracle to get this information:
- STATSPACK and bstat/estat reports
Statistic                    Total         Per Transact           Per Logon         Per Second 
---------------------------- ------------- ---------------------- ----------------- ------------------ 
CPU used by this session     2278466       222.59                 1974.41           203.6 
CPU used when call started   2239857       218.82                 1940.95           200.15 
CR blocks created            2938          .29                    2.55              .26 
session pga memory           7138227       34521                  991               191 
session pga memory max       40327524      745091                 98305             756 
session uga memory           326143        96312                  57843             654 
session uga memory max       2483564       185735                 12386             700 
- tkprof .prf output file
OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS 
call             count        cpu      elapsed       disk       query      current        rows 
------------ ---------  --------- ------------ ---------- ----------- ------------  ---------- 
Parse                3       0.04         0.05          0           0            0           0 
Execute              4       0.00         0.05          0           0            0           0 
Fetch                2       0.00         0.06          2          17           68           1 
------------ ---------  --------- ------------ ---------- ----------- ------------  ---------- 
total                9       0.04         0.16          2          17           68           1 
- Scripts output
REM Monitor memory usage 
SQL> select sid, name, value 
      2  from v$statname n, v$sesstat s 
      3  where n.statistic# = s.statistic# 
      4  and n.name like %memory% 
      5  order by sid; 
     SID NAME                              VALUE 
--------- --------------------------------- ---------- 
        1  session uga memory               18252 
        1  session uga memory max           18252 
        1  session pga memory max           59568 
        1  sorts (memory)                   0 
        1  session pga memory               59568 
      . . 
REM monitor CPU usage 
SQL> select sid, name, value 
       2  from v$statname n, v$sesstat s 
       3  where n.statistic# = s.statistic# 
       4  and n.name like %cpu% 
       5  order by sid; 
     SID NAME                           VALUE 
--------- ------------------------------ ---------- 
         1 recursive cpu usage           0 
         1 parse time cpu                0 
         1 OS Wait-cpu (latency) time    0 
       . . 
REM  monitor I/O 
SQL> select file#, phyrds, phywrts 
      2  from v$filestat; 
 
       FILE#         PHYRDS          PHYWRTS 
------------ -------------- ---------------- 
           1           3239              141 
           2             80              246 
           3              9              163 
           4              6                3 
           5              5                3 
           . . 
MONITORING AT THE OPERATING SYSTEM LEVEL
=========================================
OS Semaphores
-------------
Each Oracle instance needs to have a set amount of semaphores. The total
amount of semaphores required is derived from the processes parameter
inside that Oracle instance init.ora file. As more instances and/or databases
are added the OS kernel parameter SEMMNS will need to be adjusted accordingly.
For more information, see Semaphore
Calculations
- Estimating semaphore sets/semaphores for an Instance.
Ulimits
--------

Refer to the install guide for the basic kernel parameters that need

to be set. When increasing the amount of instances & databases on this

Unix server, one will need to increase the kernel parameters accordingly.

To check the Unix oracle user id limits:

% ulimit -Sa

(This is the output you may expect to see)

 time(seconds)          unlimited

 file(blocks)           unlimited

 data(kbytes)           unlimited

 stack(kbytes)          unlimited

 memory(kbytes)         unlimited

 coredump(blocks)       2097151

 nofiles(descriptors)   unlimited

Monitoring Tools

---------------------

Commonly used tools are vmstat, iostat, pstat, size, ipcs, ps, sar, and other OS

specific tools.  View the manual page to obtain the usage and column

descriptions.

Here are a few specific Unix supplied tools to help monitor different OS activities:

1) Memory: To see how much memory is currently being used, vmstat (virtual memory

statistics) focuses mainly on CPU and memory.

    OS                 Command

    ~~~~~~~~~~         ~~~~~~~~~

    Sun Solaris:       vmstat

    HP:                vmstat -n

    IBM:               /bin/vmstat

    Compaq:            /sbin/hwmgr

    Linux:             xosview

  For specific examples of diagnosing memory on various platforms:

   HPUX --> see

Diagnosing Oracle memory on HP using GLANCE

   AIX --> see

Diagnosing Oracle Memory on AIX using SVMON

  SUN -->see Diagnosing

Oracle memory on Sun Solaris using PMAP

2) I/O: You should regulary monitor disk I?O statistics by using utilities such as

"sar -d" or "iostat". Average service times of 50ms or lessare reason for

concern if it continues over a long time. One of the goals should be minimizing disk I/O by balancing the load on the disks.

To watch over disk space usage, at the Unix prompt issue the command:  df -k

Look at where the datafiles and ORACLE_HOME are mounted. Pay attention to how much

space is available. General rule of thumb is to never allow

these mount points get to 90% full (i.e. 10% available).

3) CPU utilization:

    OS                 Command

    ~~~~~~~~~~         ~~~~~~~~~

    Sun Solaris:       sar -u

    IBM:               ps av (or) iostat 3 20

    Digital:           /usr/sbin/pset_info

    Linux:             xosview

In addition of monitoring the CPU usage you should monitor the runqueue to determine

if processes are waiting for an available processor. You can

use "sar -q" to monitor the runqueue.

4) To see how much CPU time is being used by each processor on a multiprocessor machine:

    OS                 Command

    ~~~~~~~~~~         ~~~~~~~~~

    Sun Solaris:       /usr/bin/mpstat

    HP:                /usr/sbin/sar -M 5 5

    IBM:               vmstat -> Under cpu, if "us" is a very high number you have a cpu intensive process

5) To see the number of CPUs there are in the machine, and their status:

    OS                 Command

    ~~~~~~~~~~         ~~~~~~~~~

    Sun Solaris:       /usr/sbin/mpstat

    HP:                /usr/sbin/sar -M 2 2

    IBM:               /usr/sbin/bindprocessor -q

    Digital:           /usr/sbin/psrinfo -v

    Linux:             xosview

6) To see the amount of swap space is on the machine and the usage:

    OS                 Command

    ~~~~~~~~~~         ~~~~~~~~~

    Sun Solaris:       /etc/swap -l and /etc/swap -s

    HP:                /etc/swapinfo -m ( must be root Unix id)

    IBM:               lsps -a

    Digital:           /usr/sbin/swapon -s

    Linux:             free -t

7) To see the current usage of shared memory & semephores:  "ipcs -b"


相关文章
  • 邮件来了早知道Magic Mail Monitor试用
  • 学用MotherBoardMonitor之入门设置篇
【评论】【收藏本文】【打印】【关闭】
上一篇文章:怎样才能限制SQL Server只能让指定的机器连接
下一篇文章:Raw Devices and Oracle - 20 Common Questions and Answers
讨论区
查看
已有 0 位对此新闻感兴趣的网友发表了看法
匿名发表
注册通行证 登陆
图文阅读推荐
Atlas快速入门之实战Atlas
Atlas快速入门之实战Atlas
.net页面间的参数传递简单实例
.net页面间的参数传递简单实例
推荐阅讯
  • Aspectwerkz 2.0开发企业AOP快速入门
  • J2EE应用服务器(Jboss+Tomcat)安装攻略
  • OpenGL编程轻松入门之显示例表
  • 看看如何在Struts应用中施展AJAX魔法
  • Borland推出崭新需求定义及管理方案
  • 基于AJAX技术实现Struts校验框架
  • OpenGL编程轻松入门之特殊效果操作
  • Oracle数据库游标使用大全
  • 使用AJAX和J2EE创建功能强大的瘦客户端
  • 在WinCE程序开发中使用软件输入面板
阅读排行
  • 1..net页面间的参数传递简单实例
  • 2.VC++与Matlab混合编程之引擎操作详解
  • 3.Oracle数据库数据对象分析
  • 4.Eclipse3.2+Tomcat5.5.17+Oracle9配置
  • 5.Oracle数据库中索引的维护
  • 6.在Oracle的网络结构中解决连接问题
  • 7.Oracle数据安全面面观
  • 8.Oracle数据库的ORA-00257故障解决过程
  • 9.Oracle数据库备份与恢复的三种方法
  • 10.Oracle与SQL Server在企业应用中的比较
专题教程
  • 大话G游 专题:手机病毒揭密
  • ARP攻击防范与解决方案 路由故障处理手册
  • Picasa中文版_Picasa教程 专题:清除流氓软件
  • Firefox专题 seo搜索引擎优化专区
  • 重装Windows必知的事情 装机之必备软件大行动
病毒专杀栏
  • 杀毒软件反被病毒杀 连"救命"都不能喊
  • 金山ARP防火墙
  • 还原卡神话破灭“机器狗”病毒来势汹汹
  • cctv经济半小时:你的手机现在安全吗?
  • 新挂马方式开始流行 ARP挂马称雄局域网
  • 木马和病毒清除的通用解法
  • IP地址不再冲突 查找ARP攻击者元凶
  • 教你几招识别和防御Web网页木马
  • 分析:封杀BT只是暂时的止痛药
  • QQ爆危险漏洞,“QQ游戏邀请大盗”邀请你玩病
关于我们 | 诚聘英才 | 联系我们 | 版权声明 | 网站大事 | 网站地图 | 意见建议
CopyRight 2005-2007 Jztop.Com 版权所有 未经许可 请勿转载