Home Database Mysql Tutorial Oracle 11g 中使用adrci看alert日志

Oracle 11g 中使用adrci看alert日志

Jun 07, 2016 pm 04:48 PM

这个命令可以查看报错信息和日志,伴随着11g trace目录换位置之后一起提供给我们的。这个工具不仅能像vi一样对日志进行编辑。还能

1  认识adrci

这个命令可以查看报错信息和日志,伴随着11g trace目录换位置之后一起提供给我们的。这个工具不仅能像vi一样对日志进行编辑。还能像tail -f 一样查看日志文件。

而且可以跨平台,在windows上也可以使用。

--------------------------------------分割线 --------------------------------------

在CentOS 6.4下安装Oracle 11gR2(x64)

Oracle 11gR2 在VMWare虚拟机中安装步骤

Debian 下 安装 Oracle 11g XE R2

--------------------------------------分割线 --------------------------------------

下面演示几种adrci的常用用法。

1.1  查看命令位置

$ which adrci

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

1.2  为命令设置别名

rlwrap工具可以上下翻动自己刚才执行的命令

$ grep adrci .bash_profile

alias adrci='rlwrap adrci'

1.3  查看help

$ 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)

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

从help可以看出他的语法可以是类似下面这样的:

1.3.1  直接执行命令

$ adrci exec="show alert"

1.3.2  指定脚本命令

$ 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, 2011, Oracle and/or its affiliates. All rights reserved.

ADR base = "/u01/app/oracle"

adrci>

2  使用adrci

2.1  查看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  查看home

从help中可以看出,show 后面可以接home homes homepath 这三个参数,也就是说这三个参数其实显示了同一个内容。

注:这里的home并不是$ORACLE_HOME

adrci> show home

ADR Homes:

diag/rdbms/orcl/orcl

diag/asm/+asm/+ASM

diag/tnslsnr/oracle11g/listener

adrci> show homes

ADR Homes:

diag/rdbms/orcl/orcl

diag/asm/+asm/+ASM

diag/tnslsnr/oracle11g/listener

adrci> show homepath

ADR Homes:

diag/rdbms/orcl/orcl

diag/asm/+asm/+ASM

diag/tnslsnr/oracle11g/listener

2.3  列出home下面的日志(show alert)

像这种show alert 的方式可以理解为使用vi打开日志文件。

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  查看所有目录中的日志

adrci> show alert

Choose the alert log from the following homes to view:

1: diag/rdbms/orcl/orcl

2: diag/asm/+asm/+ASM

3: diag/tnslsnr/oracle11g/listener

Q: to quit

Please select option:

2.3.2  查看自定义目录下的日志

这个时候有4个选项可以供我们选择,,分别是数据库,asm,监听器的日志文件。同样也可以设置单独的home,比如

adrci> set home diag/rdbms/orcl/orcl

adrci> show alert    //类似vi编辑意义昂

2.3.3  动态查看定义目录下的日志

一定要先设置目录,不然不能查看,会得到以下错误,所以应该先设置home

adrci> show alert -tail -f

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

adrci> sethome diag/rdbms/orcl/orcl

adrci> show alert -tail -f

用ctrl - c 方式可以退出动态查看

这个命令有点熟悉,类似于Linux中的“tail -f 文件名”,这里的“show alert -tail -”f 同样适用于Windows

2.3.4  查看alert日志中包含ORA-的字符串

这个语法可以查看帮助(前面有列出),其中-p参数可以跟基于XXX的信息,比如下面是基于包含ORA- 的信息

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

更多详情见请继续阅读下一页的精彩内容:

linux

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1666
14
PHP Tutorial
1273
29
C# Tutorial
1253
24
MySQL's Role: Databases in Web Applications MySQL's Role: Databases in Web Applications Apr 17, 2025 am 12:23 AM

The main role of MySQL in web applications is to store and manage data. 1.MySQL efficiently processes user information, product catalogs, transaction records and other data. 2. Through SQL query, developers can extract information from the database to generate dynamic content. 3.MySQL works based on the client-server model to ensure acceptable query speed.

Explain the role of InnoDB redo logs and undo logs. Explain the role of InnoDB redo logs and undo logs. Apr 15, 2025 am 12:16 AM

InnoDB uses redologs and undologs to ensure data consistency and reliability. 1.redologs record data page modification to ensure crash recovery and transaction persistence. 2.undologs records the original data value and supports transaction rollback and MVCC.

MySQL's Place: Databases and Programming MySQL's Place: Databases and Programming Apr 13, 2025 am 12:18 AM

MySQL's position in databases and programming is very important. It is an open source relational database management system that is widely used in various application scenarios. 1) MySQL provides efficient data storage, organization and retrieval functions, supporting Web, mobile and enterprise-level systems. 2) It uses a client-server architecture, supports multiple storage engines and index optimization. 3) Basic usages include creating tables and inserting data, and advanced usages involve multi-table JOINs and complex queries. 4) Frequently asked questions such as SQL syntax errors and performance issues can be debugged through the EXPLAIN command and slow query log. 5) Performance optimization methods include rational use of indexes, optimized query and use of caches. Best practices include using transactions and PreparedStatemen

MySQL vs. Other Programming Languages: A Comparison MySQL vs. Other Programming Languages: A Comparison Apr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

MySQL: From Small Businesses to Large Enterprises MySQL: From Small Businesses to Large Enterprises Apr 13, 2025 am 12:17 AM

MySQL is suitable for small and large enterprises. 1) Small businesses can use MySQL for basic data management, such as storing customer information. 2) Large enterprises can use MySQL to process massive data and complex business logic to optimize query performance and transaction processing.

How does MySQL index cardinality affect query performance? How does MySQL index cardinality affect query performance? Apr 14, 2025 am 12:18 AM

MySQL index cardinality has a significant impact on query performance: 1. High cardinality index can more effectively narrow the data range and improve query efficiency; 2. Low cardinality index may lead to full table scanning and reduce query performance; 3. In joint index, high cardinality sequences should be placed in front to optimize query.

MySQL for Beginners: Getting Started with Database Management MySQL for Beginners: Getting Started with Database Management Apr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

MySQL vs. Other Databases: Comparing the Options MySQL vs. Other Databases: Comparing the Options Apr 15, 2025 am 12:08 AM

MySQL is suitable for web applications and content management systems and is popular for its open source, high performance and ease of use. 1) Compared with PostgreSQL, MySQL performs better in simple queries and high concurrent read operations. 2) Compared with Oracle, MySQL is more popular among small and medium-sized enterprises because of its open source and low cost. 3) Compared with Microsoft SQL Server, MySQL is more suitable for cross-platform applications. 4) Unlike MongoDB, MySQL is more suitable for structured data and transaction processing.

See all articles