sqlplus无法登陆用系统方法做dump



  如果Oracle数据库hang住了,对Oracle做system dump,或做hang analyze,是研究和解决问题的有效办法。
如果能够连接数据库,并能够进行操作,那么用oradebug是简单快捷的办法。
如果数据库由于hang住,sqlplus不能连接数据库,可以使用操作系统上的调试工具来dump oracle系统状态。

下面是当时用gdb(linux) /  dbx(unix)做dump的过程:


1.首先获得dump进程号
[oracle@ogg04 ~]$ ps -ef|grep LOCAL
oracle 6131  1 0:40 ? 00:00:00 oracleogg02 (DESCRIPTION=(LOCAL=YES)(ADDRESS=(PROTOCOL=beq)))


2.调用gdb进程dump(linux 用gdb, unix用dbx)
[oracle@ogg04 ~]$ gdb $ORACLE_HOME/bin/oracle 6131
GNU gdb (GDB) Red Hat Enterprise Linux (7.0.1-23.el5)
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <
http://gnu.org/licenses/gpl.html>
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".
For bug reporting instructions, please see:
<
http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/bin/oracle...(no debugging symbols found)...done.
Attaching to program: /u01/app/oracle/product/11.2.0.3/db_1/bin/oracle, process 6131
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libodm11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libodm11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libcell11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libcell11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libskgxp11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/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 /u01/app/oracle/product/11.2.0.3/db_1/lib/libnnz11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libnnz11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libclsra11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libclsra11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libdbcfg11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libdbcfg11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libhasgen11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libhasgen11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libskgxn2.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libskgxn2.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libocr11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libocr11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libocrb11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libocrb11.so
Reading symbols from /u01/app/oracle/product/11.2.0.3/db_1/lib/libocrutl11.so...(no debugging symbols found)...done.
Loaded symbols for /u01/app/oracle/product/11.2.0.3/db_1/lib/libocrutl11.so
Reading symbols from /usr/lib64/libaio.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libaio.so.1
Reading symbols from /lib64/libdl.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libdl.so.2
Reading symbols from /lib64/libm.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libm.so.6
Reading symbols from /lib64/libpthread.so.0...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Loaded symbols for /lib64/libpthread.so.0
Reading symbols from /lib64/libnsl.so.1...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnsl.so.1
Reading symbols from /lib64/libc.so.6...(no debugging symbols found)...done.
Loaded symbols for /lib64/libc.so.6
Reading symbols from /lib64/ld-linux-x86-64.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/ld-linux-x86-64.so.2
Reading symbols from /usr/lib64/libnuma.so.1...(no debugging symbols found)...done.
Loaded symbols for /usr/lib64/libnuma.so.1
Reading symbols from /lib64/libnss_files.so.2...(no debugging symbols found)...done.
Loaded symbols for /lib64/libnss_files.so.2
0x0000003c32c0e190 in __nanosleep_nocancel () from /lib64/libpthread.so.0
(gdb) detach
Detaching from program: /u01/app/oracle/product/11.2.0.3/db_1/bin/oracle, process 6131
(gdb) quit


3.  unix 环境

dbx -a PID (where PID = any oracle shadow process)  ---通过ps -ef|grep xxx查看
dbx() print ksudss(10)
...return value printed here
dbx() detach


4.找到dump的trace文件
[oracle@ogg04 trace]$ pwd
/u01/app/oracle/diag/rdbms/ogg02/ogg02/trace
-rw-r----- 1 oracle dba  1156 Dec 29 16:23 ogg02_vktm_6131.trc

[oracle@ogg04 trace]$ ls -lrt | grep 6131
-rw-r----- 1 oracle dba    90 Dec 29 16:23 ogg02_vktm_6131.trm
-rw-r----- 1 oracle dba  1156 Dec 29 16:23 ogg02_vktm_6131.trc


5. 查看dump的trace的内容
[oracle@ogg04 trace]$ cat ogg02_vktm_6131.trc
Trace file /u01/app/oracle/diag/rdbms/ogg02/ogg02/trace/ogg02_vktm_6131.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
ORACLE_HOME = /u01/app/oracle/product/11.2.0.3/db_1
System name: Linux
Node name: ogg04
Release: 2.6.18-194.el5
Version: #1 SMP Tue Mar 16 21:52:39 EDT 2010
Machine: x86_64
Instance name: ogg02
Redo thread mounted by this instance: 0
Oracle process number: 4
Unix process pid: 6131, image:
oracle@ogg04 (VKTM)


*** 2014-12-29 15:27:54.265
*** SESSION ID:(4.1) 2014-12-29 15:27:54.265
*** CLIENT ID:() 2014-12-29 15:27:54.265
*** SERVICE NAME:() 2014-12-29 15:27:54.265
*** MODULE NAME:() 2014-12-29 15:27:54.265
*** ACTION NAME:() 2014-12-29 15:27:54.265
 
kstmmainvktm: succeeded in setting elevated priority
highres_enabled
VKTM running at (1)millisec precision with DBRM quantum (100)ms
[Start] HighResTick = 1419838074265548
kstmrmtickcnt = 0 : ksudbrmseccnt[0] = 1419838074
kstmchkdrift (kstmhighrestimecntkeeper:highres): Time jumped forward by (51048106)usec at (1419841381451626) whereas (1000000) is allowed


你可能感兴趣的:(Oracle,Basic,Knowledge)