Oracle 11g 中使用adrci看alert日志(二)

2014-11-24 17:19:04 · 作者: · 浏览: 1
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-%'"