如果ORACLE已经连接不上如果产生一个数据库级别的systemstate dump文件

背景

  如果当你已经无法正常连接到oracle时,可能数据库此时已经hang,通过sqlplus -prelim '/as sysdba'也无法登陆数据库,可以通过操作系统级别的工具
产生oracle systemstate dump文件,进行数据库的全面分析与诊断  




结论

  1,数据库无法进入或HANG时,可能过gdb产生ORACLE的SYSTEMSTATE DUMP文件
  2,LINUX操作系统,ORACLE11G
  3,在unix请使用dbx

测试

1,产生一个测试远端会话
[oracle@seconary ~]$ sqlplus scott/system@guowang




[oracle@seconary admin]$ ps -ef|grep LOCAL
oracle   17446     1  0 04:28 ?        00:00:00 oracleguowang (LOCAL=NO)
oracle   17545  8032  0 04:28 pts/0    00:00:00 grep LOCAL


2,用GDB跟踪这个远端会话
[oracle@seconary ~]$ gdb $ORACLE_HOME/bin/oracle 17446
GNU gdb Fedora (6.8-37.el5)
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu"...
(no debugging symbols found)
Attaching to program: /oracle/product/11.2.0/db_1/bin/oracle, process 17446
Reading symbols from /oracle/product/11.2.0/db_1/lib/libodm11.so...(no debugging symbols found)...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libodm11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libcell11.so...(no debugging symbols found)...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libcell11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libskgxp11.so...(no debugging symbols found)...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libskgxp11.so
Reading symbols from /lib64/librt.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/librt.so.1
Reading symbols from /oracle/product/11.2.0/db_1/lib/libnnz11.so...(no debugging symbols found)...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libnnz11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libclsra11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libclsra11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libdbcfg11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libdbcfg11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libhasgen11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libhasgen11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libskgxn2.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libskgxn2.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libocr11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libocr11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libocrb11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libocrb11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libocrutl11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libocrutl11.so
Reading symbols from /oracle/product/11.2.0/db_1/lib/libasmclnt11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libasmclnt11.so
Reading symbols from /usr/lib64/libaio.so.1...done.
Loaded symbols for /usr/lib64/libaio.so.1
Reading symbols from /lib64/libdl.so.2...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libpthread.so.0...done.
[Thread debugging using libthread_db enabled]




[New Thread 0x2ab13e44ae80 (LWP 17446)]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libnsl.so.1...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /lib64/libc.so.6...print 
done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /lib64/libnss_files.so.2...done.
Loaded symbols for /lib64/libnss_files.so.2
Reading symbols from /oracle/product/11.2.0/db_1/lib/libnque11.so...done.
Loaded symbols for /oracle/product/11.2.0/db_1/lib/libnque11.so
Reading symbols from /lib64/libnss_dns.so.2...done.
Loaded symbols for /lib64/libnss_dns.so.2
Reading symbols from /lib64/libresolv.so.2...done.
Loaded symbols for /lib64/libresolv.so.2


0x0000003d5660d590 in __read_nocancel () from /lib64/libpthread.so.0
(gdb) 
(gdb) 
(gdb) print 
The history is empty.




3,在GDB界面输入如下命令,即print ksudss(10)
(gdb) print ksudss(10)
$1 = 0


4,退出GDB界面,先输入QUIT后输入Y
(gdb) quit
The program is running.  Quit anyway (and detach it)? (y or n) y
Detaching from program: /oracle/product/11.2.0/db_1/bin/oracle, process 17446
[oracle@seconary ~]$ 


5,在USER_DUMP_DEST获取上述产生的SYSTEMSTATE DUMP文件
SQL> show parameter user_dump


NAME                                 TYPE                   VALUE
------------------------------------ ---------------------- ------------------------------
user_dump_dest                       string                 /oracle/diag/rdbms/guowang/guo
                                                            wang/trace


[oracle@seconary ~]$ cd /oracle/diag/rdbms/guowang/guowang/trace
[oracle@seconary trace]$ ls -l *17446*
-rw-r----- 1 oracle oinstall 3036048 Oct 17 04:31 guowang_ora_17446.trc


[oracle@seconary trace]$ more guowang_ora_17446.trc
Trace file /oracle/diag/rdbms/guowang/guowang/trace/guowang_ora_17446.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /oracle/product/11.2.0/db_1
System name:    Linux
Node name:      seconary
Release:        2.6.18-164.el5
Version:        #1 SMP Tue Aug 18 15:51:48 EDT 2009
Machine:        x86_64
Instance name: guowang
Redo thread mounted by this instance: 1
Oracle process number: 74
Unix process pid: 17446, image: oracle@seconary




*** 2015-10-17 04:30:54.862
*** SESSION ID:(211.52312) 2015-10-17 04:30:54.862
*** CLIENT ID:() 2015-10-17 04:30:54.862
*** SERVICE NAME:(guowang) 2015-10-17 04:30:54.862
*** MODULE NAME:(SQL*Plus) 2015-10-17 04:30:54.862
*** ACTION NAME:() 2015-10-17 04:30:54.862
 
===================================================
SYSTEM STATE (level=10)
------------
System global information:
     processes: base 0xdd51ae00, size 1000, cleanup 0xdd59fc40
     allocation: free sessions 0xdd9b40d0, free calls (nil)
     control alloc errors: 0 (process), 0 (session), 0 (call)
     PMON latch cleanup depth: 0
     seconds since PMON's last scan for dead processes: 25
     system statistics:
0 OS CPU Qt wait time
--More--(0%)

参考资料

Performance Tools Quick Reference Guide (文档 ID 438452.1)
How to Collect Systemstate Dumps When you Cannot Connect to Oracle(121779.1)
How to Capture a Systemstate Dump Using GDB Utility on Linux(374569.1)


个人简介


8年oracle从业经验,具备丰富的oracle技能,目前在国内北京某专业oracle服务公司从事高级技术顾问。
服务过的客户:
中国电信
中国移动
中国联通
中国电通
国家电网
四川达州商业银行
湖南老百姓大药房
山西省公安厅
中国邮政
北京302医院     
河北廊坊新奥集团公司

 项目经验:
中国电信3G项目AAA系统数据库部署及优化
      中国联通4G数据库性能分析与优化
中国联通CRM数据库性能优化
中国移动10086电商平台数据库部署及优化
湖南老百姓大药房ERR数据库sql优化项目
四川达州商业银行TCBS核心业务系统数据库模型设计和RAC部署及优化
四川达州商业银行TCBS核心业务系统后端批处理存储过程功能模块编写及优化
北京高铁信号监控系统RAC数据库部署及优化
河南宇通客车数据库性能优化
中国电信电商平台核心采购模块表模型设计及优化
中国邮政储蓄系统数据库性能优化及sql优化
北京302医院数据库迁移实施
河北廊坊新奥data guard部署及优化
山西公安厅身份证审计数据库系统故障评估
国家电网上海灾备项目4 node rac+adg 
       贵州移动crm及客服数据库性能优化项目
       贵州移动crm及客服务数据库sql审核项目
       深圳穆迪软件有限公司数据库性能优化项目

联系方式:
手机:18201115468
qq   :   305076427
qq微博: wisdomone1
新浪微博:wisdomone9
qq群:275813900    
itpub博客名称:wisdomone1    http://blog.itpub.net/9240380/

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/9240380/viewspace-1814913/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/9240380/viewspace-1814913/

你可能感兴趣的:(数据库,操作系统,后端)