这个命令可以查看报错信息和日志,伴随着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] <p>[ [-tail [num] [-f]] | [-file <alert_file_name>] ]</alert_file_name></p> <p>Purpose: Show alert messages.</p> <p>Options:</p> <p>[-p </p><pre class="brush:php;toolbar:false;" dicate_string>]: The predicate string must be double quoted. <p>The fields in the predicate are the fields:</p> <p>ORIGINATING_TIMESTAMP timestamp</p> <p>NORMALIZED_TIMESTAMP timestamp</p> <p>ORGANIZATION_ID text(65)</p> <p>COMPONENT_ID text(65)</p> <p>HOST_ID text(65)</p> <p>HOST_ADDRESS text(17)</p> <p>MESSAGE_TYPE number</p> <p>MESSAGE_LEVEL number</p> <p>MESSAGE_ID text(65)</p> <p>MESSAGE_GROUP text(65)</p> <p>CLIENT_ID text(65)</p> <p>MODULE_ID text(65)</p> <p>PROCESS_ID text(33)</p> <p>THREAD_ID text(65)</p> <p>USER_ID text(65)</p> <p>INSTANCE_ID text(65)</p> <p>DETAILED_LOCATION text(161)</p> <p>UPSTREAM_COMP_ID text(101)</p> <p>DOWNSTREAM_COMP_ID text(101)</p> <p>EXECUTION_CONTEXT_ID text(101)</p> <p>EXECUTION_CONTEXT_SEQUENCE number</p> <p>ERROR_INSTANCE_ID number</p> <p>ERROR_INSTANCE_SEQUENCE number</p> <p>MESSAGE_TEXT text(2049)</p> <p>MESSAGE_ARGUMENTS text(129)</p> <p>SUPPLEMENTAL_ATTRIBUTES text(129)</p> <p>SUPPLEMENTAL_DETAILS text(129)</p> <p>PROBLEM_KEY text(65)</p> <p>[-tail [num] [-f]]: Output last part of the alert messages and</p> <p>output latest messages as the alert log grows. If num is not specified,</p> <p>the last 10 messages are displayed. If "-f" is specified, new data</p> <p>will append at the end as new alert messages are generated.</p> <p>[-term]: Direct results to terminal. If this option is not specified,</p> <p>the results will be open in an editor.</p> <p>By default, it will open in emacs, but "set editor" can be used</p> <p>to set other editors.</p> <p>[-file <alert_file_name>]: Allow users to specify an alert file which</alert_file_name></p> <p>may not be in ADR. <alert_file_name> must be specified with full path.</alert_file_name></p> <p>Note that this option cannot be used with the -tail option</p> <p>Examples:</p> <p>show alert</p> <p>show alert -p "message_text like '%incident%'"</p> <p>show alert -tail 20</p> <p>2.3.1 查看所有目录中的日志</p> <p>adrci> show alert</p> <p>Choose the alert log from the following homes to view:</p> <p>1: diag/rdbms/orcl/orcl</p> <p>2: diag/asm/+asm/+ASM</p> <p>3: diag/tnslsnr/oracle11g/listener</p> <p>Q: to quit</p> <p>Please select option:</p> <p>2.3.2 查看自定义目录下的日志</p> <p>这个时候有4个选项可以供我们选择,,分别是数据库,asm,监听器的日志文件。同样也可以设置单独的home,比如</p> <p>adrci> set home diag/rdbms/orcl/orcl</p> <p>adrci> show alert //类似vi编辑意义昂</p> <p>2.3.3 动态查看定义目录下的日志</p> <p>一定要先设置目录,不然不能查看,会得到以下错误,所以应该先设置home</p> <p>adrci> show alert -tail -f</p> <p>DIA-48449: Tail alert can only apply to single ADR home</p> <p>adrci> sethome diag/rdbms/orcl/orcl</p> <p>adrci> show alert -tail -f</p> <p>用ctrl - c 方式可以退出动态查看</p> <p>这个命令有点熟悉,类似于Linux中的“tail -f 文件名”,这里的“show alert -tail -”f 同样适用于Windows</p> <p>2.3.4 查看alert日志中包含ORA-的字符串</p> <p>这个语法可以查看帮助(前面有列出),其中-p参数可以跟基于XXX的信息,比如下面是基于包含ORA- 的信息</p> <p>adrci> show alert -p "MESSAGE_TEXT like '%ORA-%'"</p> <p>更多详情见请继续阅读下一页的精彩内容: </p><p align="center"><img src="/linuxfile/logo.gif" alt="linux"></p>
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
C++高性能并发应用_C++如何开发性能关键应用
Java AI集成Deep Java Library_Java怎么集成AI模型部署
Golang后端API开发_Golang如何高效开发后端和API
Python异步并发改进_Python异步编程有哪些新改进
C++系统编程内存管理_C++系统编程怎么与Rust竞争内存安全
Java GraalVM原生镜像构建_Java怎么用GraalVM构建高效原生镜像
Python FastAPI异步API开发_Python怎么用FastAPI构建异步API
C++现代C++20/23/26特性_现代C++有哪些新标准特性如modules和coroutines
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号