Was playing with ORADEBUG today and figured out a cool feature - you can actually close trace file using ORADEBUG CLOSE_TRACE. The only way I knew before was to shrink the file. So now after 10046 trace you don’t need to restart the process to close trace file.

If your SMON, PMON, etc. Oracle process is dumping like crazy (kind of abnormal but who needs a DBA anyway if SMON is not dumping regularly?) - you can close this file and actually delete it without bouncing the instance. Never really dealt with Windoracle on that matter but I suspect that removing SMON’s trace file, for instance, is not possible (it’s locked) without stopping Oracle instance UNLESS one uses ORADEBUG CLOSE_TRACE.

How many times you got into situation when dump destination got full and someone (perhaps, you) cleaned it up using something trivial like ‘rm *trc’? Out of those cases how often you noticed that several GB filesystem with single 100 KB alert.log file is still 99% full after “clean up” because SMON and/or whatever other backgroung processes keep inodes open? My bet is - at least 50%.

Now you need simple:

SQL> oradebug setospid
Statement processed.
SQL> oradebug close_trace
Statement processed.

Isn’t that amazing? Just checked - it’s available at least in 9iR2, 10gR1 and 10gR2.


5 Responses to “Closing trace file with ORADEBUG”  

  1. 1 Laurent Schneider

    Where did you dig that one? I thought I knew the commands to use in sqlplus ;-)

  2. 2 Alex Gorbachev

    Laurent, I will answer you question with my another favorit ORADEBUG option, which is…. ORADEBUG HELP ;-)

  3. 3 Miladin

    Long time ago I wrote white paper about Oradebug.You can still find it on:

    http://www.evdbt.com/Oradebug_Modrakovic.pdf

    P.S. oradebug poke is cool…

    Miladin

  4. 4 Miladin

    This option is very useful if you have deleted a trace file with the session still live and
    now you want the session to resume tracing, but a new file doesn’t appear.The reason
    why you have a problem under Unix is that the trace file is not closed - even if you set
    sql_trace to false.

    select spid, pid
    from v$process
    where addr = (select paddr from v$session where sid = );

    oradebug setorapid {the pid above}

    or oradebug setospid {the spid above} then
    oradebug flush
    oradebug close_trace

    The close_trace option is that you can do it even after you have deleted the trace file
    from the operating system level.

  5. 5 Alex Gorbachev

    Thanks Miladin. This is exactly why I posted about close_trace.

Leave a Reply