在错误的从os级别remove掉 trace file 之后,怎么找到该trace file的内容?

參考原文:

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)

适用于:

Oracle Database - Enterprise Edition - Version 8.1.7.4 to 11.2.0.1.0 [Release 8.1.7 to 11.2]

Generic UNIX

Generic Linux





目标:



当错误的从从os级别remove(这个remove是指rm)掉 trace file 之后,oracle进程的trace file 是不会被又一次创建的。



那怎么看到这些trace file的内容?

解决方式:

这样的行为的解释 和解决方式在

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



给出了。

--->注意:我看了一下该bug的workground,是restart instance。



在以下的样例中,请注意从11g開始,trace file的位置不在bdump 下。而是在{ADR_HOME}/trace/下。

当进程是alive的时候,进程不会在 trace file上运行close()函数。

进程依旧持有 指向trace file 的  file descriptor。



trace file 的名字包含进程的pid,

因此,除非进程被重新启动,否则我们不能关闭 file descriptor,也不能创建一个用新文件名称或者老文件名称的新文件





这并不意味着,在紧急情况下,你不能訪问该trace file。

当该trace file 被delete掉后。仅仅要file descriptor依旧open,你就能够获得该文件的内容。该内容依旧被正常写。



通过例如以下方法经过file descriptor 来訪问 file



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 REG 3,1 767 20728692 /bdump/v10204_dbw0_11283.trc



从上面的结果中,我们能够看到fd 为2。例如以下也能验证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





从os级别 remove掉trace file 。fd 依旧存在,仅仅是file 被delete掉了。



ls -lA /proc/11283/fd | grep dbw0

l-wx------ 1 oracle dba-64 Mar 25 16:24 2 -> /bdump/v10204_dbw0_11283.trc (deleted)



这个fd (file descriptor)在它被关闭 或者 进程被重新启动之前 是存在的。

你能够訪问它的内容:

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

最新文章

  1. maven nexus 私服的搭建学习
  2. Code First05--CodeFirst中值对象
  3. 如何区分 OpenStack Neutron Extension 和 Plugin
  4. Excl 的一些用法--如何给很多列赋同一个值
  5. HTML5特性:使用async属性异步加载执行JavaScript
  6. Ionic开发中常见问题和解决方案记录
  7. 文件和目录之access函数
  8. 20160331javaweb之JSP include 指令&&九大隐式对象
  9. debug.keystore文件不存在解决办法
  10. 知名IT企业待遇一览表
  11. Xcode-01ARC / Block
  12. 【Android源码解析】View.post()到底干了啥
  13. linux 邮件服务器
  14. C# Entity To Json
  15. jinja模板语法
  16. Log4net(二)-——关联配置文件的方式总结
  17. A - Longest k-Good Segment (尺取法)
  18. C# System.Collections.ArrayList
  19. mo +离散化 HDU3333(听说还有离线线段树的做法 )
  20. Getting Started with Processing 第五章的easing问题

热门文章

  1. 轻快的VIM(五):复制
  2. postgresql 备份(pg_dump,pg_restore)
  3. guice基本使用,常用的绑定方式(四)
  4. VCRuntime静默安装
  5. maven nexus memory optimization
  6. Visual Studio蛋疼问题解决(2)
  7. javascript中in运算符的介绍
  8. ASP.NET CORE读取appsettings.json的配置
  9. VS2012编译PCL1.70的过程
  10. 应用二:Vue之ElementUI Form表单校验