Wednesday, July 18, 2007

How to Set, Remove and Show Diagnostic Events

Environment: 8.1.7.4


The following steps demonstrate how to set, remove and show diagnostic events:

1. Connect to a test database TESTDB as sysdba
------------------------------------------------

testserver> /oracle/admin/TESTDB/udump [TESTDB] sqlplus "/ as sysdba"
SQL*Plus: Release 8.1.7.0.0 - Production on Wed Jul 18 08:18:44 2007
(c) Copyright 2000 Oracle Corporation. All rights reserved.
Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production

2. Issue the following command and view the generated trc file
----------------------------------------------------------------

sys@TESTDB> oradebug setmypid
Statement processed.
sys@TESTDB> oradebug dump events 4
Statement processed.
sys@TESTDB> oradebug tracefile_name
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
sys@TESTDB> ho ls -lh /oracle/admin/TESTDB/udump/testdb_ora_10751.trc
-rw-r----- 1 oracle dba 624 Jul 18 08:19
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
sys@TESTDB> ho cat /oracle/admin/TESTDB/udump/testdb_ora_10751.trc
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
ORACLE_HOME = /oracle/product/8.1.7.4
System name: SunOS
Node name: testserver
Release: 5.9
Version: Generic_118558-38
Machine: sun4u
Instance name: TESTDB
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 10751, image: oracle@testserver (TNS V1-V3)

*** 2007-07-18 08:19:15.111
*** SESSION ID:(16.6455) 2007-07-18 08:19:15.110
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life

Note: there are nothing listed at the bottom of the file currently. --
No any kind of events are set


3. Set 1003 event
------------------

sys@TESTDB> alter system set events '1003 trace name errorstack level
10'
2 ;
System altered.

4. Dump and view the trc file again
---------------------------------------

sys@TESTDB> oradebug dump events 4
Statement processed.
sys@TESTDB> oradebug tracefile_name
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
sys@TESTDB> ho cat /oracle/admin/TESTDB/udump/testdb_ora_10751.trc
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
ORACLE_HOME = /oracle/product/8.1.7.4
System name: SunOS
Node name: testserver
Release: 5.9
Version: Generic_118558-38
Machine: sun4u
Instance name: TESTDB
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 10751, image: oracle@testserver (TNS V1-V3)

*** 2007-07-18 08:19:15.111
*** SESSION ID:(16.6455) 2007-07-18 08:19:15.110
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life
*** 2007-07-18 08:21:57.394
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life
D79F50B0 1003 1 d79f50c8 0 0
TR Name TR level TR address TR arm TR
life TR type
ERRORSTACK 10 ffffffff 1 2
0


Note: under 8:21, there is a 1003 entry show up


5. Remove the 1003 event
-------------------------

sys@TESTDB> ALTER SYSTEM SET EVENTS '1003 TRACE NAME ERRORSTACK OFF';
System altered.

6. Dump and view trc file
-------------------------
sys@TESTDB> oradebug dump events 4
Statement processed.
sys@TESTDB> ho ls -lh /oracle/admin/TESTDB/udump/testdb_ora_10751.trc
-rw-r----- 1 oracle dba 1.0K Jul 18 08:24
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc

sys@TESTDB> ho cat /oracle/admin/TESTDB/udump/testdb_ora_10751.trc
/oracle/admin/TESTDB/udump/testdb_ora_10751.trc
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
With the Partitioning option
JServer Release 8.1.7.4.0 - Production
ORACLE_HOME = /oracle/product/8.1.7.4
System name: SunOS
Node name: testserver
Release: 5.9
Version: Generic_118558-38
Machine: sun4u
Instance name: TESTDB
Redo thread mounted by this instance: 1
Oracle process number: 12
Unix process pid: 10751, image: oracle@testserver (TNS V1-V3)

*** 2007-07-18 08:19:15.111
*** SESSION ID:(16.6455) 2007-07-18 08:19:15.110
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life
*** 2007-07-18 08:21:57.394
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life
D79F50B0 1003 1 d79f50c8 0 0
TR Name TR level TR address TR arm TR
life TR type
ERRORSTACK 10 ffffffff 1 2
0
*** 2007-07-18 08:24:58.949
Dump event group for level SYSTEM
TC Addr Evt#(b10) Action TR Addr Arm Life

Note: event 1003 not presented after 8:24

1 comment:

yds said...

When turning on/off an event, it may appear in the alert log. e.g.
Tue Jul 28 14:53:25 2009
OS Pid: 10137 executed alter system set events '10501 trace name context forever, level 2'
Tue Jul 28 15:07:49 2009
OS Pid: 10137 executed alter system set events '10501 trace name context off'
~