Use adrci to view alert logs in Oracle11g

Source: Internet
Author: User
This command can view error messages and logs, which are provided to us along with the change of the 11gtrace directory location. This tool can not only edit logs like vi. Yes

This command can view error messages and logs, which are provided to us along with the change of the 11g trace directory location. This tool can not only edit logs like vi. Yes

1. Know adrci

This command can view error messages and logs, which are provided to us along with the change of the 11g trace directory location. This tool can not only edit logs like vi. You can also view log files like tail-f.

It can also be used across platforms and windows.

-------------------------------------- Split line --------------------------------------

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

-------------------------------------- Split line --------------------------------------

The following describes the common usage of adrci.

1.1 view command location

$ Which adrci

/U01/app/oracle/product/11.2.0/dbhome_1/bin/adrci

1.2 set alias for command

The rlwrap tool can flip up and down the commands you just executed

$ Grep adrci. bash_profile

Alias adrci = 'rlwrap adrci'

1.3 view help

$ Adrci-help

Syntax:

Adrci [-help] [script = script_filename]

[Exec = "one_command [; one_command;...]"]

Options Description (Default)

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

Script file name (None)

Help on the command options (None)

Exec a set of commands (None)

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

From help, we can see that his syntax is similar to the following:

1.3.1 run commands directly

$ Adrci exec = "show alert"

1.3.2 specify the script command

$ Cat/tmp/abc.txt

Show alert

$ Adrci script =/tmp/abc.txt

$ Adrci

ADRCI: Release 11.2.0.3.0-Production on Fri Jun 6 11:45:39 2014

Copyright (c) 1982,201 1, Oracle and/or its affiliates. All rights reserved.

ADR base = "/u01/app/oracle"

Adrci>

2. Use adrci

2.1 view help

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

2.2 View home

From help, we can see that the show parameter can be followed by the home homes homepath parameter, that is, the three parameters actually display the same content.

Note: The home here is not $ ORACLE_HOME

Adrci> show home

ADR Homes:

Diag/rdbms/orcl

Diag/asm/+ ASM

Diag/tnslsnr/oracle11g/listener

Adrci> show homes

ADR Homes:

Diag/rdbms/orcl

Diag/asm/+ ASM

Diag/tnslsnr/oracle11g/listener

Adrci> show homepath

ADR Homes:

Diag/rdbms/orcl

Diag/asm/+ ASM

Diag/tnslsnr/oracle11g/listener

2.3 show alert)

The show alert method can be understood as using vi to open a log file.

Adrci> help show alert

Usage: show alert [-p ] [-Term]

[[-Tail [num] [-f] | [-file]

Purpose: Show alert messages.

Options:

[-P ]: The predicate string must be double quoted.

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)

[-Tail [num] [-f]: Output last part of the alert messages and

Output latest messages as the alert log grows. If num is not specified,

The last 10 messages are displayed. If "-f" is specified, new data

Will append at the end as new alert messages are generated.

[-Term]: Direct results to terminal. If this option is not specified,

The results will be open in an editor.

By default, it will open in emacs, but "set editor" can be used

To set other editors.

[-File]: Allow users to specify an alert file which

May not be in ADR. must be specified with full path.

Note that this option cannot be used with the-tail option

Examples:

Show alert

Show alert-p "message_text like '% incident % '"

Show alert-tail 20

2.3.1 view logs in all directories

Adrci> show alert

Choose the alert log from the following homes to view:

1: diag/rdbms/orcl

2: diag/asm/+ ASM

3: diag/tnslsnr/oracle11g/listener

Q: to quit

Please select option:

2.3.2 view logs in a custom directory

At this time, there are four options for us to choose, namely the log files of databases, asm and listeners. You can also set a separate home, such

Adrci> set home diag/rdbms/orcl

Adrci> show alert // similar to vi editing Significance

2.3.3 dynamically view logs under the defined directory

You must set the directory first. Otherwise, you cannot view the Directory and the following error will be returned. Therefore, you should set the home

Adrci> show alert-tail-f

DIA-48449: Tail alert can only apply to single ADR home

Adrci> sethome diag/rdbms/orcl

Adrci> show alert-tail-f

Press ctrl-c to exit dynamic viewing.

This command is a bit familiar, similar to "tail-f file name" in Linux. Here, "show alert-tail-" f is also applicable to Windows

2.3.4 view the string containing ORA-in the alert Log

This syntax can be used to view help information (listed above). The-p parameter can be used with XXX-based information. For example, the following syntax is based on information containing ORA -.

Adrci> show alert-p "MESSAGE_TEXT like '% ORA-% '"

For more details, please continue to read the highlights on the next page:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.