如果ORACLE已經連線不上如果產生一個資料庫級別的systemstate dump檔案

wisdomone1發表於2015-10-19

背景

  如果當你已經無法正常連線到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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章