数据库

位置:IT落伍者 >> 数据库 >> 浏览文章

用调试工具DumpOracle系统状态


发布日期:2021年05月04日
 
用调试工具DumpOracle系统状态

如果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毕竟方便得多也更安全

               

上一篇:oracle联机日志文件恢复

下一篇:在Solaris下安装VNC 远程安装Oracle