Content'Trac Fi Genera for Orac Proc after Removi TF by Mist at OS Lev_805083.1

rongshiyuan發表於2014-03-24

How to Find the Content of Trace File Generated for an Oracle Process after Removing the Trace File by Mistake at OS Level (Doc ID 805083.1)

In this Document

  Goal
  Solution
  References




Applies to:

Oracle Server - Enterprise Edition - Version: 8.1.7.4 to 11.2.0.1.0 - Release: 8.1.7 to 11.2
Generic UNIX
Generic Linux

Goal

Trace files of Oracle processes are not being recreated after by mistake they have been removed at the Operating System level.

How can the content of such trace file be seen?

Solution

The explanation of this behaviour and also the solution is given in the

Bug 8367394: A NEW TRACE FILE IS NOT BEING CREATED IF THE INITIAL ONE WAS REMOVED

In the following example, please note that starting with 11g, the place for the trace files as replace of bdump is ”{ADR_HOME}/trace/”, thus you need this path to look for the trace files.

Whilst the process is alive and it has not performed a close() on the file it will still have an open file descriptor to it.

The file name contains the PID of the process, so until the process gets restarted we will not a) close the fd, and b) create a new file of a different name or same name.

This doesn't mean, in an emergency you could not still access the file, you should be able to get
at the files contents (which will still be written to after the delete as the fd is still open), by accessing the file via the fd i.e:

ps -ef|grep v10204|grep dbw0
oracle 11283 1 0 16:23 ? 00:00:00 ora_dbw0_v10204

lsof -p 11283|grep dbw0
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
oracle 11283 oracle 2 REG 3,1 767 20728692 /bdump/v10204_dbw0_11283.trc

So we can see we have the file open, with fd 2

ls -lA /proc/11283/fd | grep dbw0
l-wx------ 1 oracle dba-64 Mar 25 16:24 2 -> /bdump/v10204_dbw0_11283.trc

Remove the file and the fd will still be present but the file will be deleted

ls -lA /proc/11283/fd | grep dbw0
l-wx------ 1 oracle dba-64 Mar 25 16:24 2 -> /bdump/v10204_dbw0_11283.trc (deleted)

This fd will remain until it is closed or the process is restarted, you can always access the
contents via this if you so wish i.e:

cat /proc/11283/fd/2 > /tmp/v10204_dbw0_11283.trc

References

BUG:8367394 - A NEW TRACE FILE IS NOT BEING CREATED IF THE INITIAL ONE WAS REMOVED

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/17252115/viewspace-1128001/,如需轉載,請註明出處,否則將追究法律責任。

相關文章