原文:http://www.orafan.net/blog/223.html/comment-page-1#comment-13
验证是否已成功更改:
CREATE pfile='/home/oracle/1.ora' FROM spfile;
File created.
[oracle@rac01 ~]$ grep event 1.ora
*.event='1461 trace name errorstack level 3'
这种方法的话,需要重启DB。下面Rollback这个参数更改
ALTER system SET event='1461 trace name errorstack off' scope=spfile;
System altered.
CREATE pfile='/home/oracle/2.ora' FROM spfile;
File created.
[oracle@rac01 ~]$ grep event 2.ora
*.event='1461 trace name errorstack off'
ALTER system SET events '1461 trace name errorstack level 3';
System altered.
验证:
[oracle@rac01 ~]$ tail -n1 /oracle/admin/strm1/bdump/alert_strm1.log
OS Pid: 9070 executed alter system set events '1461 trace name errorstack level 3'
这个参数更改没有反应到spfile中
CREATE pfile='/home/oracle/3.ora' FROM spfile;
File created.
[oracle@rac01 ~]$ grep event 3.ora
*.event='1461 trace name errorstack off'
其实这里的1461是个BUG 6085625,Metalink上可以参照NOTE: 461911.1
另外需要注意的是,RAC环境中用方法2动态设置event的话需要在所有instance设置。不过理解了上面的区别的话这个也就很容易明白了。
注意:设置1461 event无法对已经存在的进程生效,对于设置之后新建立的进程才会有效果。所以,不得不,我们还是得重启DB,让其对所有进程生效。
或者使用oradebug:
--启用
SQL> oradebug event 1000 trace name errorstack level 10;
Statement processed.
--关闭
SQL> oradebug event 1000 trace name errorstack off;
Statement processed.
以ORA-00942: table or view does not exist为例:
1、Session级别打开:
SQL> alter session set events '942 trace name errorstack level 3';
Session altered.
SQL> select * from dual1;
select * from dual1
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>
查看alter log:
Errors in file /app/oracle/admin/EAITEST/udump/eaitest_ora_6370.trc:
ORA-00942: table or view does not exist
2、全局打开:
SQL> alter system set events '942 trace name errorstack level 3';
System altered.
SQL> show parameter event
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
event string
SQL>
SQL> select * from dual1;
select * from dual1
*
ERROR at line 1:
ORA-00942: table or view does not exist
SQL>
查alert log,没有相关记录,只记有:
OS Pid: 6370 executed alter system set events '942 trace name errorstack level 3'
重开一个session:
SQL> select * from dual1;
select * from dual1
*
ERROR at line 1:
ORA-00942: table or view does not exist
查看alter log:
Errors in file /app/oracle/admin/EAITEST/udump/eaitest_ora_6995.trc:
ORA-00942: table or view does not exist
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 639068368 bytes
Fixed Size 735440 bytes
Variable Size 603979776 bytes
Database Buffers 33554432 bytes
Redo Buffers 798720 bytes
Database mounted.
Database opened.
SQL>
SQL> show parameter event
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
event string
SQL> select * from dual1;
select * from dual1
*
ERROR at line 1:
ORA-00942: table or view does not exist
查alert log,没有相关记录,说明更改没有记录到spfile中,要使更改记录到spfile中,
使用:
alter system set event='942 trace name errorstack level 3' scope=spfile;
关闭error trace:
alter system set events '942 trace name context off';
Truss看看有什么系统调用
先不连接进入Sqlplus:
$ sqlplus /nolog
SQL*Plus: Release 12.1.0.1.0 Production on Thu Jun 27 17:24:00 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL>
然后查一下sqlplus的进程号:
$ ps -ef|grep sql
oracle 96911 872 0 17:24:01 pts/2 0:00 sqlplus /nolog
$ truss -o /tmp/sqlplus.log -p 96911
然后在sqlplus /nolog中connect连接:
SQL> conn / as sysdba
ERROR: