Just for fun : Create a trace file

I don’t recall where I got this, but I happened across it in my scripts. It is a procedure that creates a trace file from the Oracle database. Kinda fun, and I’m sure there is maybe some good use for it, after all, Oracle continues to add to the number of seemingly pointless trace files with each release (remember when you only got them when you needed them?).

exec sys.dbms_system.ksdwrt(1,'&message');

Here it is in action:

(oracle) myserver:MYDB:/oracle/product/diag/rdbms/mydb/MYDB/trace
->sqlplus / as sysdba

SQL*Plus: Release 11.2.0.2.0 Production on Wed Nov 28 18:17:47 2012
Copyright (c) 1982, 2010, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exec sys.dbms_system.ksdwrt(1,’This is my trace file’);

PL/SQL procedure successfully completed.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
(oracle) myserver:MYDB:/oracle/product/diag/rdbms/mydb/MYDB/trace
->ll -rt
total 1744
-rw-r—– 1 oracle dba 1477024 Nov 20 12:52 alert_MYDB.old
-rw-r–r– 1 oracle dba  276347 Nov 28 18:02 alert_MYDB.log
-rw-r—– 1 oracle dba     927 Nov 28 18:17 MYDB_ora_7787.trc
-rw-r—– 1 oracle dba      61 Nov 28 18:17 MYDB_ora_7787.trm
(oracle) myserver:MYDB:/oracle/product/diag/rdbms/p10dba/MYDB/trace
->cat P10DBA_ora_7787.trc
Trace file /oracle/product/diag/rdbms/mydb/MYDB/trace/MYDB_ora_7787.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 – 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/product/11.2.0.2
System name:    Linux
Node name:      myserver
Release:        2.6.18-128.1.1.el5
Version:        #1 SMP Mon Jan 26 13:58:24 EST 2009
Machine:        x86_64
Instance name: MYDB
Redo thread mounted by this instance: 1
Oracle process number: 38
Unix process pid: 7787, image: oracle@myserver (TNS )

*** 2012-11-28 18:17:52.590
*** SESSION ID:(128.14379) 2012-11-28 18:17:52.590
*** CLIENT ID:() 2012-11-28 18:17:52.590
*** SERVICE NAME:(SYS$USERS) 2012-11-28 18:17:52.590
*** MODULE NAME:(sqlplus@myserver (TNS ) 2012-11-28 18:17:52.590
*** ACTION NAME:() 2012-11-28 18:17:52.590

This is my trace file

(oracle) myserver:MYDB:/oracle/product/diag/rdbms/mydb/MYDB/trace
->

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s