熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Oracle >> 正文

用調試工具DumpOracle系統狀態

2013-11-13 16:03:10  來源: Oracle 

  如果Oracle數據庫hang了對Oracle進行system dump或hang analyze是研究和解決問題的有效方法如果能夠連接數據庫並進行操作則使用oradebug是最簡單快捷的辦法

  但有的時候數據庫由於hang住sqlplus不能連接時(在g可以嘗試用sqlplus prelim連接數據庫)可以使用操作系統上的調試工具來dump oracle系統狀態因為我的環境是linux所以我先從gdb來介紹

  ①首先獲得要dump的進程號

  ps ef | grep LOCAL

  oracle           : ?        :: oracleretest (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))

  oracle        : pts/    :: grep LOCAL

  ②調用gdb進行dump

  gdb $ORACLE_HOME/bin/oracle

  GNU gdb Red Hat Linux (postrh)

  Copyright Free Software Foundation Inc

  GDB is free software covered by the GNU General Public License and you are

  welcome to change it and/or distribute copies of it under certain conditions

  Type show copying to see the conditions

  There is absolutely no warranty for GDB Type show warranty for details

  This GDB was configured as iredhatlinuxgnu…(no debugging symbols found)…Using host libthread_db library /lib/tls/libthread_dbso

  Attaching to program: /u/app/oracle/product//db_/bin/oracle process

  Reading symbols from /u/app/oracle/product//db_/lib/libskgxpso…(no debugging symbols found)…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libskgxpso

  Reading symbols from /u/app/oracle/product//db_/lib/libhasgenso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libhasgenso

  Reading symbols from /u/app/oracle/product//db_/lib/libskgxnso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libskgxnso

  Reading symbols from /u/app/oracle/product//db_/lib/libocrso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libocrso

  Reading symbols from /u/app/oracle/product//db_/lib/libocrbso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libocrbso

  Reading symbols from /u/app/oracle/product//db_/lib/libocrutlso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libocrutlso

  Reading symbols from /u/app/oracle/product//db_/lib/libjoxso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libjoxso

  Reading symbols from /u/app/oracle/product//db_/lib/libclsraso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libclsraso

  Reading symbols from /u/app/oracle/product//db_/lib/libdbcfgso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libdbcfgso

  Reading symbols from /u/app/oracle/product//db_/lib/libnnzso…done

  Loaded symbols for /u/app/oracle/product//db_/lib/libnnzso

  Reading symbols from /usr/lib/libaioso…done

  Loaded symbols for /usr/lib/libaioso

  Reading symbols from /lib/libdlso…done

  Loaded symbols for /lib/libdlso

  Reading symbols from /lib/tls/libmso…done

  Loaded symbols for /lib/tls/libmso

  Reading symbols from /lib/tls/libpthreadso…done

  [Thread debugging using libthread_db enabled]

  [New Thread (LWP )]

  Loaded symbols for /lib/tls/libpthreadso

  Reading symbols from /lib/libnslso…done

  Loaded symbols for /lib/libnslso

  Reading symbols from /lib/tls/libcso…done

  Loaded symbols for /lib/tls/libcso

  Reading symbols from /lib/ldlinuxso…done

  Loaded symbols for /lib/ldlinuxso

  Reading symbols from /lib/libnss_filesso…done

  Loaded symbols for /lib/libnss_filesso

  ×a in _dl_sysinfo_int () from /lib/ldlinuxso

  (gdb) print ksudss()

  [Switching to Thread (LWP )]

  $ =

  (gdb) detach

  Detaching from program: /u/app/oracle/product//db_/bin/oracle process

  (gdb) quit

  ③隨後即可找到有dump結果的trace文件

  ls lrt | grep

  rwr—– oracle oinstall    Feb : retest_ora_trc

  此時可以用assawk工具對trace文件進行簡單的分析具體的assawk文件

  awk f assawk retest_ora_trc

  就可以獲得簡單的等待信息

  在LINUX下用gdb在AIX下用dbx

  # dbx a

  Waiting to attach to process

  Successfully attached to oracle

  Type help for help

  reading symbolic information …

  stopped in ioslselect at ×cd ($t)

  ×cd (select+xfffffffffff) e ld r×(r)

  (dbx) print ksudss()

  Segmentation fault in slrac at ×aa ($t)

  ×aa (slrac+xe) lbz r×(r)

  (dbx) detach

  在HPUX下呢可以用HP的wdb(可以到HP WDB查看HP WDB的詳細信息和下載最新的版本在solaris上也會有dbx或gdb(各個平台有多種不同的debugger其他還有adbmdb等等)

  除了通過print ksudss()進行systemstate dump還可以進行下面的dump

  print ksdhng() 相當於oradebug hanganalyze

  print ksudps() 相當於oradebug dump processstate

  print curdmp() 相當於oradebug call curdmp(也就是oradebug dump cursordump)

  print ksdtrc() 相當於oradebug dump events (這裡參數表示level–session–process–system)

  print ksdsel() –相當於為attach的進程設置事件level

  print skdxipc() –相當於oradebug ipc

  print skdxprst() –相當於oradebug procstat

  當然如果能用oradebug就應該使用oradebug畢竟方便得多也更安全


From:http://tw.wingwit.com/Article/program/Oracle/201311/17728.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.