天天看點

【轉】ORATOP工具使用說明

文章轉自:http://lintzyuan.blogspot.jp/2014/07/oratop.html

前言:

隨著PC Server的規格及速度愈來愈快,大多數的公司摒棄大型主機,進而選擇PC Server的趨勢愈來愈盛,雖然在可靠度上仍然是大型主機占優勢,但是大型主機的維護費用高昂,這也是讓一般公司望之卻步的主要因素。

在目前PC Server的可靠度尚待提升的當下,其實,Virtual Machine的選擇可以彌補PC Server可靠度的不足,目前三大虛擬平台逐漸成形,分別是Vmware、Hyper-V以及Oracle VM。

如果各位使用PC Server,將Oracle Database安裝在PC Server上,大概就隻有Linux可以選擇了。Linux上面要即時監控系統狀況,"top" 指令是系統管理員常用的,但是我們使用 "top" 找到了 Top Process之後,往往還需要將Process ID轉換成Database SID,才能找出關鍵性的Session,進而解決效能問題,不過,Oracle最近有一項工具叫做 "oratop",可以及時監控Linux上的Database Process狀況,讓系統管理員省去不少時間,找出 Top Session。

目的:

oratop是類似 top 的工具,可以針對Oracle Database Performance做全面性的檢視,如果搭配 top 使用,會得到更完整的系統效能資訊。

適用版本:

Oracle Database - Enterprise Edition - Version 11.2.0.3 to 11.2.0.4 [Release 11.2]

Oracle Database - Enterprise Edition - Version 12.1.0.1 and later

Linux x86-64

Linux x86

使用方式:

1. 使用oracle 使用者將下載的oratop.RDBMS_11.2_LINUX_X64  ftp 到資料庫主機上,如果是RAC環境,選定其中一個node上傳即可。

2. cd 到 oratop 程式所在目錄

3. 更名oratop程式

$ mv oratop* oratop

4. 更改oratop權限

$ chmod 755 oratop

5. 在.bash_profile 環境變數檔中,設定環境變數(如果尚未設定的話)

$ export TERM=xterm  #or vt100

$ export ORACLE_HOME=<11.2 database home>

$ export LD_LIBRARY_PATH=$ORACLE_HOME/lib

$ export PATH=$ORACLE_HOME/bin:$PATH

$ export ORACLE_SID=<local 11.2 database SID to be monitored>  #only needed if connecting to a local database

6. 執行oratop (每10秒更新一次)

$ ./oratop -i 10 / as sysdba

7. 針對遠端資料庫執行oratop (每10秒更新一次)

$ ./oratop -i 10 system/manager@tns_alias

8. 結束oratop

    按下 "q",或是 CTRL-C

參考畫面:

<a href="http://2.bp.blogspot.com/-HBxMofYSnDI/U9Z0DDyIsUI/AAAAAAAAFR4/8CzaKKKVyko/s1600/oratop.png"></a>

指令介紹:

1. 語法

$ oratop [Options] [Logon]

2. Options

    a) Help,Displays usage or output information.

        預設: N/A

$ oratop -h[elp]  # runtime mode 按下h

    b) Top 5 Wait Events

        預設: 累計

        選項: 即時呈現

$ oratop -d  # runtime mode 按下d

    c) 等待物件

        預設: Event/Latch

        選項: File#:Block#

$ oratop -k  # runtime mode 按下k

    d) session行為

        預設: 是Username/Program

        選項: 是Module/Action

$ oratop -m  # runtime mode 按下m

    e) SQL mode

        預設: Process mode

        選項: SQL display

$ oratop -s  # runtime mode 按下s

    f) Database Service centric mode

        預設: Connection mode

        選項: N/A

$ oratop -c  # runtime mode:N/A

    g) Long format, (132 columns)

        預設:  short (80 columns)

        選項:  long format for header &amp; process section.

$ oratop -f  # runtime mode: 按下f

    h) Database Process mode

        預設:  Process mode

        選項: process display

$ oratop -p  # runtime mode: 按下p

    i) Batch mode operation

        預設: Text-based user interface

$ oratop -b  # runtime mode: N/A

    j) Maximum Number of iterations.   (requires a number)

        預設: infinite

        選項: the maximum number of iterations, or frames

$ oratop -n  # runtime mode: N/A

   k)  Displays tablespace information

        選項: tablespace information

# runtime mode: 按下t

    l) Displays  ASM diskgroup information.  (no op for non-ASM)

        選項: ASM diskgroup information

# runtime mode: 按下a

    l) Displays SQL execution plan table. Requires input of the active SQL sql_id value

        預設: 5 seconds

        選項: the delay between update refresh

$ oratop -c  # runtime mode: 按下

    m) Interval delay time. ( requires value in seconds)

         預設: Connection mode

         選項: N/A

$ oratop -v  # runtime mode: N/A

參考檔案:

oratop - Utility for Near Real-time Monitoring of Databases, RAC and Single Instance (Doc ID 1500864.1)

繼續閱讀