Oracle工具——ADRCI(一)

yangtingkun發表於2009-03-29

ADRCI工具是Oracle11g才推出的新工具,主要用來管理alert檔案、trace檔案、dump檔案、健康監事報告等。

這一篇簡單介紹ADRCI工具。

 

 

用過11g的人都會發現,11galert檔案以及trace檔案的存放位置都發生了變化。從原來的ORACLE_BASE/admin/INSTANCE_NAME目錄變成了ORACLE_BASE/diag/rdbms/DBNAME/INSTANCE_NAME目錄。

Oracle之所以修改了這個跨越多個版本都沒有修改過的引數設定,就是因為Oracle11g中推出了ADRCI。這個工具可以統一管理ASM例項和多個資料庫例項的alert檔案、後臺trace檔案、使用者trace檔案,dump檔案等等。

而且這個工具可以快速查詢錯誤相關的所有trace檔案,並將這些檔案打包到一個zip檔案,以便將問題相關的資訊提供給Oracle的技術支援。

看一下ADRCI工具的簡單命令:

C:\Documents and Settings\ytk>adrci

ADRCI: Release 11.1.0.6.0 - Beta on 星期日 3 29 21:23:57 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

ADR base = "e:\oracle"
adrci> help

 HELP [topic]
   Available Topics:
        CREATE REPORT
        ECHO
        EXIT
        HELP
        HOST
        IPS
        PURGE
        RUN
        SET BASE
        SET BROWSER
        SET CONTROL
        SET ECHO
        SET EDITOR
        SET HOMES | HOME | HOMEPATH
        SET TERMOUT
        SHOW ALERT
        SHOW BASE
        SHOW CONTROL
        SHOW HM_RUN
        SHOW HOMES | HOME | HOMEPATH
        SHOW INCDIR
        SHOW INCIDENT
        SHOW PROBLEM
        SHOW REPORT
        SHOW TRACEFILE
        SPOOL

 There are other commands intended to be used directly by Oracle, type
 "HELP EXTENDED" to see the list

HELP列出了ADRCI工具的所有命令,還可以透過HELP加個別命令的方式來列出這個命令的具體語法,比如:

adrci> HELP IPS

 HELP IPS [topic]
   Available Topics:
        ADD
        ADD FILE
        ADD NEW INCIDENTS
        CHECK REMOTE KEYS
        COPY IN FILE
        COPY OUT FILE
        CREATE PACKAGE
        DELETE PACKAGE
        FINALIZE PACKAGE
        GENERATE PACKAGE
        GET MANIFEST
        GET METADATA
        GET REMOTE KEYS
        PACK
        REMOVE
        REMOVE FILE
        SET CONFIGURATION
        SHOW CONFIGURATION
        SHOW FILES
        SHOW INCIDENTS
        UNPACK FILE
        USE REMOTE KEYS
adrci> HELP IPS ADD

  Usage:  IPS ADD
             [INCIDENT | PROBLEM | PROBLEMKEY |
              SECONDS | TIME TO ]
             PACKAGE

  Purpose: Add incidents to an existing package.

  Arguments:
    :      ID of incident to add to package contents.
    :    ID of problem to add to package contents.
    :   Problem key to add to package contents.
    :    Number of seconds before now for adding package contents .
    : Start of time range to look for incidents in.
    :   End of time range to look for incidents in.
  Example:
    ips add incident 22 package 12

adrci> HELP SHOW PROBLEM

  Usage: SHOW PROBLEM [-p ]
                      [-last | -all]
                      [-orderby (field1, field2, ...) [ASC|DSC]]

  Purpose: Show the problem information. By default, this command will
           only show the last 50 problems.

  Options:
    [-p ]: The predicate string must be double-quoted.
    The field names that users can specify in the predicate are:
        PROBLEM_ID                    number
        PROBLEM_KEY                   text(550)
        FIRST_INCIDENT                number
        FIRSTINC_TIME                 timestamp
        LAST_INCIDENT                 number
        LASTINC_TIME                  timestamp
        IMPACT1                       number
        IMPACT2                       number
        IMPACT3                       number
        IMPACT4                       number
        SERVICE_REQUEST               text(64)
        BUG_NUMBER                    text(64)

    [-last | -all]: This option allows users to either select
    the last of qualified problems to show or to show all the
    qualified problems. If this option is not specified, this command
    will only show 50 incidents.

    [-orderby (field1, field2, ...) [ASC|DSC]]: If specified, the results
    will be ordered by the specified fields' values. By default, it will be
    in the ascending order unless "DSC" is specified. Note that the field
    names that can be specified here are from the "PROBLEM" relation.

  Examples:
    show problem
    show problem -p "problem_id>123"

下面是查詢資料庫中錯誤的幾個小例子:

adrci> show base
ADR base is "e:\oracle"
adrci> show home
ADR Homes:
diag\clients\user_system\host_3414944083_11
diag\clients\user_unknown\host_3414944083_11
diag\clients\user_unknown\host_411310321_11
diag\clients\user_ytk\host_3414944083_11
diag\rdbms\ytk1110\ytk1110
diag\tnslsnr\ytk-thinkpad\listener
adrci> set home diag\rdbms\ytk1110\ytk1110
adrci> show alert -tail 5
2009-02-25 22:51:17.640000 +08:00
Completed: alter database open
2009-02-25 22:55:26.171000 +08:00
Starting background process CJQ0
CJQ0 started with pid=7, OS id=14428
2009-02-25 22:55:49.796000 +08:00
Errors in file e:\oracle\diag\rdbms\ytk1110\ytk1110\trace\ytk1110_j008_15220.trc
:
ORA-12012:
自動執行作業 11689 出錯
ORA-01403:
未找到任何資料
2009-02-25 23:20:39.828000 +08:00
Thread 1 advanced to log sequence 75
  Current log# 3 seq# 75 mem# 0: E:\ORACLE\ORADATA\YTK111\REDO03.LOG
2009-02-26 08:31:51.296000 +08:00


***********************************************************************

Fatal NI connect error 12638, connecting to:
 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

  VERSION INFORMATION:
TNS for 32-bit Windows: Version 11.1.0.6.0 - Production
Oracle Bequeath NT Protocol Adapter for 32-bit Windows: Version 11.1.0.6.0 - Pro
duction
  Time: 26-2
-2009 08:31:51
  Tracing not turned on.
  Tns error struct:
    ns main err code: 12638

TNS-12638: 身份證明檢索失敗
    ns secondary err code: 0
    nt main err code: 0
    nt secondary err code: 0
    nt OS err code: 0

除了上面互動式的方式外,還可以呼叫指令碼,或者指定一系列命令來批次執行命令:

C:\Documents and Settings\ytk>adrci -help
Syntax:
   adrci [-help] [script=script_filename]
         [exec = "one_command [;one_command;...]"]

Options      Description                     (Default)
-----------------------------------------------------------------
script       script. file name                (None)
help         help on the command options     (None)
exec         exec a set of commands          (None)
-----------------------------------------------------------------

比如:

C:\Documents and Settings\ytk>adrci exec="show base;show home;set home diag\\rdb
ms\\ytk1110\\ytk1110;show home"
ADR base is "e:\oracle"
ADR Homes:
diag\clients\user_system\host_3414944083_11
diag\clients\user_unknown\host_3414944083_11
diag\clients\user_unknown\host_411310321_11
diag\clients\user_ytk\host_3414944083_11
diag\rdbms\ytk1110\ytk1110
diag\tnslsnr\ytk-thinkpad\listener
ADR Homes:
diag\rdbms\ytk1110\ytk1110

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/4227/viewspace-580571/,如需轉載,請註明出處,否則將追究法律責任。

相關文章