Find us on Google+ Google+

October 10, 2010

ADRCI Commands in Oracle

ADRCI Commands
Automatic Diagnostic Repository (ADR) Command Interpreter, from Oracle 11g

$ adrci [-HELP] [SCRIPT=script_filename] [EXEC="command [;command;...]"]
$ adrci -help
$ adrci script=adrci_script.adi
$ adrci script=env.adrci
$ adrci exec="show alert"

$ adrci exec="show home; export incident -p "incident_id>120""
$ adrci exec="dde show available actions; show tracefile"
$ adrci exec="begin backup; cp -R log /tmp; end backup"

$ adrci
adrci> HELP [COMMAND]

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 LOG                  - new in Oracle Database 12c
        SHOW PROBLEM
        SHOW REPORT
        SHOW TRACEFILE
        SPOOL
adrci> help set browser
adrci> help ips get remote keys
adrci> help merge file
adrci> help register incident file

adrci> CREATE REPORT report_type report_id
adrci> create report hm_run hm_run_6
HM - Health Monitor

adrci> ECHO quoted_string
adrci> echo "Hello world"

adrci> EXIT
adrci> exit

adrci> QUIT
adrci> quit

adrci> HOST ["host_command_string"]
adrci> host
adrci> host "ls -l *.sh"
adrci> host "vi tailalert.adrci"

Incident Packaging Service (IPS)

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
        SHOW PACKAGE
        UNPACK FILE
        UNPACK PACKAGE
        USE REMOTE KEYS

adrci> IPS ADD [INCIDENT inc_id | PROBLEM prob_id | PROBLEMKEY problem_key | SECONDS secs | TIME start_time TO end_time] PACKAGE pkg_id
adrci> ips add incident 22 package 33
adrci> ips add problem 3 package 1
adrci> ips add seconds 60 package 9
adrci> ips add time '2011-10-01 10:00:00.00 -07:00' to '2011-10-01 23:00:00.00 -07:00' package 7


adrci> IPS ADD FILE filespec PACKAGE package_id

adrci> ips add file /u01/app/oracle/diag/rdbms/orcl/orcl/trace/alert_orcl.log package 99

adrci> IPS ADD NEW INCIDENTS PACKAGE package_id
adrci> ips add new incidents package 321


adrci> IPS CHECK REMOTE KEYS FILE file_spec
adrci> ips check remote keys file /tmp/key_file.txt

adrci> IPS COPY IN FILE filename [TO new_name][OVERWRITE] PACKAGE pkgid [INCIDENT incid]
adrci> ips copy in file /home/sona/trace/orcl_ora_63175.trc to ADR_HOME/trace/orcl_ora_63175.trc package 11 incident 6

adrci> ips copy in file /tmp/key_file.txt to new_file.txt overwrite package 12

adrci> IPS COPY OUT FILE source TO target [OVERWRITE]
adrci> ips copy out file ADR_HOME/trace/orcl_ora_63175.trc to /home/sona/trace/orcl_ora_63175.trc

adrci> ips copy out file ADR_HOME/trace/orcl_ora_11595.trc to /tmp/orcl_ora_11595.trc overwrite

adrci> IPS CREATE PACKAGE [INCIDENT inc_id | PROBLEM problem_id | PROBLEMKEY problem_key | SECONDS secs | TIME start_time TO end_time} [CORRELATE BASIC|TYPICAL|ALL]
adrci> ips create package
adrci> ips create package incident 111
adrci> ips create package incident 222 correlate basic
adrci> ips create package problem 6
adrci> ips create package problemkey '?'
adrci> ips create package problemkey "?"
adrci> ips create package seconds 333
adrci> ips create package seconds 444 correlate all
adrci> ips create package time '2011-10-01 00:00:00 -05:30' to '2011-10-02 23.59.59 -05:30'

adrci> IPS DELETE PACKAGE pkg_id
adrci> ips delete package 22

adrci> IPS FINALIZE PACKAGE pkg_id
adrci> ips finalize package 33

adrci> IPS GENERATE PACKAGE pkg_id [IN location] [COMPLETE|INCREMENTAL]
adrci> ips generate package 4 in /tmp
adrci> ips generate package 14 incremental
adrci> ips generate package 345 complete

adrci> IPS GET MANIFEST FROM FILE filename
adrci> ips get manifest from file /home/satya/ORA603_20101006235311_INC_1.zip

adrci> IPS GET METADATA [FROM FILE filename | FROM ADR]
adrci> ips get metadata from file /home/satya/ORA600_20101006135346_COM_1.zip
adrci> ips get metadata from adr


adrci> IPS GET REMOTE KEYS FILE file_spec PACKAGE package_id
adrci> ips get remote keys file /tmp/key_file.txt package 12

adrci> IPS PACK [INCIDENT inc_id | PROBLEM prob_id | PROBLEMKEY prob_key | SECONDS secs | TIME start_time TO end_time] [CORRELATE {BASIC|TYPICAL|ALL}] [IN path]
adrci> ips pack
adrci> ips pack incident 41

adrci> ips pack incident 24001 in /tmp
adrci> ips pack problem 5
adrci> ips pack problemkey ORA 4031
adrci> ips pack seconds 60 correlate all

adrci> ips pack time '2011-12-31 23:59:59.00 -07:00' to '2012-01-01 01:01:01.00 -07:00';

adrci> IPS REMOVE [INCIDENT inc_id | PROBLEM prob_id | PROBLEMKEY prob_key] PACKAGE pkg_id
adrci> ips remove incident 2 package 7
adrci> ips remove problem 4 package 8

adrci> IPS REMOVE FILE file_name PACKAGE pkg_id
adrci> ips remove file ADR_HOME/trace/orcl_ora_3579.trc package 4

adrci> IPS SET CONFIGURATION parameter_id value (parameter_id = 1 to 23)
adrci> ips set configuration 4 8

adrci> IPS SHOW CONFIGURATION [parameter_id] (parameter_id = 1 to 23)
adrci> ips show configuration
adrci> ips show configuration 21

adrci> IPS SHOW FILES PACKAGE pkg_id
adrci> ips show files package 9

adrci> IPS SHOW INCIDENTS PACKAGE package_id
adrci> ips show incidents package 333


adrci> IPS SHOW PACKAGE [package_id] [BASIC | BRIEF | DETAIL]
adrci> ips show package
adrci> ips show package 12 detail
adrci> ips show package 999 basic

adrci> IPS UNPACK FILE file_name [INTO path]
adrci> ips unpack file /home/oracle/ORA4030_20111008145306_COM_1.zip into /tmp/newadr
adrci> ips unpack file /home/oracle/ORA4030_20111008145306_INC_1.zip


adrci> IPS UNPACK PACKAGE pkg_name [INTO path]

adrci> ips unpack package IPSPKG_20111029010503 into /tmp/newadr



adrci> IPS USE REMOTE KEYS FILE file_spec PACKAGE package_id

adrci> ips use remote keys file /tmp/key_file.txt package 12

adrci> PURGE [[-i id1 | start_id end_id] | [-age mins [-type ALERT|INCIDENT|TRACE|CDUMP|HM|UTSCDMP]

adrci> purge
adrci> purge -i 123 456
adrci> purge -age 600 -type incident
adrci> purge –age 720 –type alert

adrci> RUN script_name
@script_name
@@script_name
adrci> run adrscr9
adrci> run adrscr.adi
adrci> @adr.scr

adrci> SET BASE base_string | -product product_name
adrci> set base /u01/app/oracle/product

adrci> set base .

adrci> set base -product client

adrci> set base -product adrci

adrci> SET BROWSER browser_program
adrci> set browser firefox
adrci> set browser mozilla

adrci> SET CONTROL (SHORTP_POLICY = [720|value] | LONGP_POLICY = [8760|value])
adrci> set control (SHORTP_POLICY = 360)
adrci> set control (LONGP_POLICY = 4380)

adrci> SET ECHO ON|OFF
adrci> set echo on
adrci> set echo off

adrci> SET EDITOR editor_program (default editor is vi)
adrci> set editor vi
adrci> set editor xemacs

adrci> SET HOME home_location
adrci> set home diag\rdbms\orabase\orabase

adrci> SET HOMES home_location1, home_location2 [, ...]
adrci> set homes diag\rdbms\orabase\orabase, diag\tnslsnr\testdb\listener

adrci> SET HOMEPATH homepath_str1 [homepath_str2] [...]
adrci> set homepath diag\dbms\orabase\orabase
adrci> set homepath diag/rdbms/orcl/orcl4
adrci> set homepath diag/rdbms/dwh3/dwh31 diag/rdbms/dwh3/dwh32

adrci> SET TERMOUT ON|OFF
adrci> set termout on
adrci> set termout off

adrci> SHOW ALERT [-p predicate_string] [-term] [[-tail [num] [-f]] | [-file alert_file_name]]


    The fields in the predicate are the fields:

        ORIGINATING_TIMESTAMP         timestamp

        NORMALIZED_TIMESTAMP          timestamp
        ORGANIZATION_ID               text(65)
        COMPONENT_ID                  text(65)
        HOST_ID                       text(65)
        HOST_ADDRESS                  text(17)
        MESSAGE_TYPE                  number
        MESSAGE_LEVEL                 number
        MESSAGE_ID                    text(65)
        MESSAGE_GROUP                 text(65)
        CLIENT_ID                     text(65)
        MODULE_ID                     text(65)
        PROCESS_ID                    text(33)
        THREAD_ID                     text(65)
        USER_ID                       text(65)
        INSTANCE_ID                   text(65)
        DETAILED_LOCATION             text(161)
        UPSTREAM_COMP_ID              text(101)
        DOWNSTREAM_COMP_ID            text(101)
        EXECUTION_CONTEXT_ID          text(101)
        EXECUTION_CONTEXT_SEQUENCE    number
        ERROR_INSTANCE_ID             number
        ERROR_INSTANCE_SEQUENCE       number
        MESSAGE_TEXT                  text(2049)
        MESSAGE_ARGUMENTS             text(129)
        SUPPLEMENTAL_ATTRIBUTES       text(129)
        SUPPLEMENTAL_DETAILS          text(129)
        PROBLEM_KEY                   text(65)
adrci> show alert -- it will open alert in vi editor
adrci> show alert -tail -- like Unix command tail
adrci> show alert -tail 200 -- like Unix command tail -200
adrci> show alert -tail -f -- like Unix command tail –f
adrci> show alert -tail 20 -f
adrci> show alert -term
adrci> show alert -P "MESSAGE_TEXT LIKE '%ORA-%'"
-- To list all the "ORA-" errors

adrci> SHOW BASE [-product product_name]
adrci> show base
adrci> show base -product client
adrci> show base -product adrci

adrci> SHOW CONTROL
adrci> show control

adrci> SHOW HM_RUN [-p predicate_string]

The fields can appear in the predicate are:
           RUN_ID                        number
           RUN_NAME                      text(31)
           CHECK_NAME                    text(31)
           NAME_ID                       number
           MODE                          number
           START_TIME                    timestamp
           RESUME_TIME                   timestamp
           END_TIME                      timestamp
           MODIFIED_TIME                 timestamp
           TIMEOUT                       number
           FLAGS                         number
           STATUS                        number
           SRC_INCIDENT_ID               number
           NUM_INCIDENTS                 number
           ERR_NUMBER                    number
           REPORT_FILE                   bfile
adrci> show hm_run
adrci> show hm_run -p "run_id=293"

adrci> SHOW HOME
adrci> show home

adrci> SHOW HOMES [-ALL | -base base_str | homepath_str1 ... ]
adrci> show homes

adrci> show homes -all
adrci> show homes -base /temp
adrci> show homes rdbms

adrci> SHOW HOMEPATH
adrci> show homepath

adrci> SHOW INCDIR [id | id_low id_high]
adrci> show incdir
adrci> show incdir 317
adrci> show incdir 3801 3804

adrci> SHOW INCIDENT [-p predicate_string] [-mode BASIC|BRIEF|DETAIL] [-last 50|num|-all] [-orderby (field1, field2, ...) [ASC|DSC]]
adrci> show incident
adrci> show incident -mode brief
adrci> show incident -mode basic -p "incident_id=905"
adrci> show incident -mode detail
adrci> show incident -mode detail -p "incident_id=33"
adrci> show incident -p "CREATE_TIME > '2011-09-18 21:35:25.012579 +00:00'"

adrci> show incident -p "problem_key='ORA 600 [ksmnfy2]'"
adrci> show incident -p "problem_key='ORA 700 [kfnReleaseASM1]'" -mode basic -last -all


adrci> SHOW LOG [-l log name] [-p predicate_string]  [-term] [ [-tail [num] [-f]] ]    -- New Oracle 12c
adrci> show log
adrci> show log -l ddl
adrci> show log -l ddl -tail 40
adrci> show log -l ddl -tail 100 -f
adrci> show log -p "message_text like '%tablespace%'"
adrci> show log -l debug

adrci> SHOW PROBLEM [-p predicate_string] [-last 50|num|-all] [-orderby (field1, field2, ...) [ASC|DSC]]


    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)
adrci> show problem
adrci> show problem -all
adrci> show problem -p "problem_id=44"

adrci> show problem -p "problem_key='ORA 600 [krfw_switch_4]'"

adrci> SHOW REPORT report_type run_name
adrci> show report hm_run hm_run_9

adrci> SHOW TRACEFILE [file1 file2 ...] [-rt | -t] [-i inc1 inc2 ...] [-path path1 path2 ...]

adrci> show tracefile
adrci> show tracefile -t
adrci> show tracefile -rt
adrci> show tracefile %pmon%
adrci> show tracefile alert%log
adrci> show tracefile %mmon% -rt
adrci> show tracefile %smon% -path /home/satya/temp
adrci> show tracefile -i 916
adrci> show tracefile -i 1 4 -path diag/rdbms/orabase/orabase

adrci> SPOOL full_file_name [APPEND|OFF]
adrci> spool c:\dwh\alrt.txt
adrci> spool /home/satya/myalert.log
adrci> spool myfile.ado append
adrci> spool off      -- Turn off the spooling
adrci> spool          -- Check the current spooling status



adrci> HELP EXTENDED

adrci> help extended
 HELP [topic]
   Available Topics:
        BEGIN BACKUP
        CD
        CREATE STAGING XMLSCHEMA
        CREATE VIEW
        DDE
        DEFINE
        DELETE
        DESCRIBE
        DROP VIEW
        END BACKUP
        INSERT
        LIST DEFINE
        MERGE ALERT
        MERGE FILE
        MIGRATE
        QUERY
        REPAIR
        SELECT
        SET COLUMN
        SHOW CATALOG
        SHOW DUMP
        SHOW SECTION
        SHOW TRACE
        SHOW TRACEMAP
        SWEEP
        UNDEFINE
        UPDATE
        VIEW

adrci> BEGIN BACKUP
adrci> begin backup

adrci> CREATE STAGING XMLSCHEMA [arguments]
adrci> create staging xmlschema

adrci> CREATE [OR REPLACE] [PUBLIC | PRIVATE] VIEW viewname [(alias)] AS select_stmt
adrci> create view my_incident as select incident_id from incident

Diagnostic Data Extractor (DDE)
adrci> help DDE
 HELP DDE [topic] 
   Available Topics: 
        CREATE INCIDENT 
        EXECUTE ACTION 
        SET INCIDENT 
        SET PARAMETER 
        SHOW ACTIONS 
        SHOW AVAILABLE ACTIONS

adrci> DDE CREATE INCIDENT TYPE type
adrci> dde create incident type wrong_results

adrci> DDE EXECUTE ACTION [INCIDENT incident_id] ACTIONNAME action_name INVOCATION invocation_id
adrci> dde execute action incident 12 actionname LSNRCTL_STATUS invocation 1
adrci> dde execute action actionname LSNRCTL_STATUS invocation 1

adrci> DDE SET INCIDENT incident_id
adrci> dde set incident 867

adrci> DDE SET PARAMETER value [INCIDENT incident_id] ACTIONNAME action_name INVOCATION invocation_id POSITION position
adrci> dde set parameter incident 12 actionname LSNRCTL_STATUS invocation 1 position 1 service

adrci> DDE SHOW ACTIONS [INCIDENT incident_id]
adrci> dde show actions
adrci> dde show actions incident 222

adrci> DDE SHOW AVAILABLE ACTIONS
adrci> dde show available actions

adrci> DEFINE variable_name variable_value
adrci> define spool_file 'my_spool_file'
adrci> define alertLog "alert_prod.log"

adrci> DELETE FROM relation [WHERE predicate_string]
adrci> delete from incident where "incident_id > 99"

adrci> DESCRIBE relation_name [-SURROGATE] [-HOMEPATH homepath_str]
adrci> describe incident
adrci> describe problem -surrogate
adrci> describe hm_run
adrci> describe DDE_USER_INCIDENT_TYPE
adrci> describe DDE_USER_ACTION

adrci> DROP VIEW viewname
adrci> drop view my_incident

adrci> END BACKUP
adrci> end backup

adrci> INSERT INTO relation (field_list) VALUES (values_list)
adrci> insert into incident(create_time) values (systimestamp)

adrci> LIST DEFINE
adrci> list define

adrci> MERGE ALERT [(projection_list)] [-t ref_time_str beg_sec end_sec] [-tdiff|-tfull] [-term] [-plain]
adrci> merge alert
adrci> merge alert (fct ti)
adrci> merge alert -tfull -term
adrci> merge alert -t "2012-05-25 09:50:20.442132 -05:30" 10 10 -term

adrci> MERGE FILE  [(projection_list)] [file1 file2 ...] [-t ref_time_str beg_sec end_sec | -i incid [beg_sec end_sec]] [-tdiff|-tfull] [-alert] [-insert_incident] [-term] [-plain]
adrci> merge file (pid fct) orcl_m000_8544.trc -alert -term
adrci> merge file -i 1 -alert -tfull
adrci> merge file orcl_m000_8544.trc -i 1 600 10 -alert
adrci> merge file -t "2012-04-25 22:32:40.442132 -05:30" 10 10 -term

adrci> MIGRATE [RELATION name | SCHEMA] [-DOWNGRADE | -RECOVER]
adrci> migrate schema
adrci> migrate relation incident
adrci> migrate relation hm_run -recover
adrci> migrate relation problem -downgrade

adrci> QUERY [(field1, field2, ...)] relation_name [-p predicate_string] [-orderby (field1, field2, ...) [ASC|DSC]]
adrci> query (incident_id, create_time) incident -p "incident_id > 111"
adrci> query (problem_key) problem -p "PROBLEM_KEY like '%700%'"

adrci> REPAIR [RELATION | SCHEMA] name
adrci> repair relation incident
adrci> repair relation hm_run

adrci> SELECT [* | field1, ...] FROM relation_name [WHERE predicate_string] [ORDER BY field1, ... [ASC|DSC|DESC]] [GROUP BY field1, ... ] [HAVING having_predicate]
adrci> select incident_id, create_time from incident where "incident_id > 90"
adrci> select * from problem where "PROBLEM_KEY like '%7445%'"

adrci> SET COLUMN TEXT num
adrci> set column text 32 

adrci> SHOW CATALOG
adrci> show catalog

adrci> SHOW DUMP dump_name [(projection_list)] <[file1 file2 ...] | [[file1 file2 ...] -i inc1 inc2 ...] | [[file1 file2 ...] -path path1 path2 ...]> [-plain] [-term]
adrci> show dump error_stack orcl_ora_27483.trc

adrci> SHOW SECTION section_name [(projection_list)] <[file1 file2 ...] | [[file1 file2 ...] -i inc1 inc2 ...] | [[file1 file2 ...] -path path1 path2 ...]> [-plain] [-term]
adrci> show section sql_exec orcl_ora_27483.trc

adrci> SHOW TRACE [(projection_list)]  <[file1 file2 ...] | [[file1 file2 ...] -i inc1 inc2 ...] | [[file1 file2 ...] -path path1 path2 ...]> [-plain] [-xp "path_pred_string"] [-xr display_path] [-term]
adrci> show trace (co, fi, li) orcl_ora_27483.trc
adrci> show trace (id, co) -i 145 152
adrci> show trace  orcl_ora_27483.trc -xp "/dump[nm='Data block']"  -xr /*
adrci> show trace alert_dwh.log
adrci> show trace ~alertLog

adrci> SHOW TRACEMAP [(projection_list)]  <[file1 file2 ...] | [[file1 file2 ...] -i inc1 inc2 ...] | [[file1 file2 ...] -path path1 path2 ...]> [-level level_num] [-xp "path_pred_string"] [-term]
adrci> show tracemap (nm)
adrci> show tracemap (co, nm) orcl_ora_27483.trc
adrci> show tracemap -level 3 -i 145 152
adrci> show tracemap orcl_ora_27483.trc -xp "/dump[nm='Data block']"

adrci> SWEEP ALL | id1 | id1 id2 | -RESWEEP -FORCE
adrci> sweep all 
adrci> sweep 123 
adrci> sweep 41 100
adrci> sweep 91 200 -resweep
adrci> sweep 16 600 -force

adrci> UNDEFINE variable_name
adrci> undefine spool_file
adrci> undefine alertLog

adrci> UPDATE relation SET {field1=val, ... } [WHERE predicate_string]
adrci> update incident set create_time = systimestamp where "incident_id > 6"

adrci> VIEW file1 file2 ...
adrci> view foo.trc foo1.trc
adrci> view alert.log



adrci> HELP HIDDEN

adrci> help hidden
 HELP [topic]
   Available Topics:
        CREATE HOME
        CREATE INCIDENT
        REGISTER INCIDENT FILE

adrci> CREATE HOME keyname=key_value [keyname=key_value ...]
adrci> create home base=/tmp product_type=rdbms product_id=prod1 instance_id=inst1

Mandatory parameters are "BASE", "PRODUCT_TYPE", "PRODUCT_ID", and "INSTANCE_ID".

adrci> CREATE INCIDENT keyname=key_value [keyname=key_value ...]
adrci> create incident problem_key="ORA-00600: [Memory corruption]" error_facility=ORA error_number=600 error_message="ORA-00600: [Memory corruption]"
Mandatory keynames are "PROBLEM_KEY", "ERROR_FACILITY", "ERROR_NUMBER", "ERROR_MESSAGE".

adrci> REGISTER INCIDENT FILE keyname=key_value [keyname=key_value ...]
adrci> register incident file filename=ora_pmon_12345.trc incident_id=1

"FILENAME" and "INCIDENT_ID" are mandatory keys.



adrci> EXPORT relation_name [-p predicate_string] [-file filename] [-overwrite] [-dir]
adrci> export incident
adrci> export incident -p “incident_id>80″

adrci> export problem -p "problem_id>123" -overwrite
adrci> export hm_run -p "run_id-456" -file hm_run_456.exp

adrci> IMPORT file_name [-dir dir_name]
adrci> import incident_99.imp
adrci> import hm_run_456.exp -dir diag/clients/user_oracle/host

Source: Internet