Home > Oracle > Closing trace file with ORADEBUG

Closing trace file with ORADEBUG

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.

Categories: Oracle Tags:
  1. May 9th, 2006 at 12:32 | #1

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

  2. May 9th, 2006 at 13:04 | #2

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

  3. Miladin
    March 18th, 2008 at 08:56 | #3

    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. Miladin
    March 18th, 2008 at 08:59 | #4

    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. March 18th, 2008 at 11:46 | #5

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

  6. shailender
    July 8th, 2009 at 10:45 | #6

    We have a cron job that deletes all files older than 7 days. Some times it is deleting background process trace files as well. So I am in the process of applying “oradebug close_trace” on all BG proces in the instance. In such a case, what will be the impact on those ones where there is a trace file available (not deleted by the cron job)?

    I tried it on one of my test systems, on LMD process, and found that it made a entry in the existing trace file. Not sure what will happen next. Any body tested this scenario?

    *** 2009-07-07 22:07:51.182
    End DRM(910) for pkey transfer request(s) from 1
    *** 2009-07-08 15:36:25.284
    Received ORADEBUG command ‘close_trace’ from process Unix process pid: 15348, image:

  7. December 19th, 2010 at 12:51 | #7

    What’s happening, you genuinely have a great and informative website! I will be bookmarking it for sure! Many thanks.

  1. No trackbacks yet.