Oracle hang 之sqlplus -prelim使用方法
第一章??Oracle hang 之sqlplus -prelim使用方法?
很多情況下,Oracle hang導致sqlplus無法連接,從而無法獲得Oracle系統和進程狀態,使得定位問題缺少強有力的依據。所幸的是Oracle 10g推出了sqlplus -prelim選項,在Oracle掛起時依然能使用sqlplus,從而能獲得數據庫狀態。
使用方法如下
引用
$ sqlplus -prelim "/as sysdba"
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Mar 28 06:40:21 2010
Copyright (c) 1982, 2007, Oracle.? All Rights Reserved.
在prelim模式下,不可以查詢數據字典,但可以關閉數據庫
引用
SQL> select status from v$instance;
select status from v$instance
*
ERROR at line 1:
ORA-01012: not logged on
?
引用
SQL> shutdown abort
ORACLE instance shut down.
但可以使用oradebug,但對于系統診斷,已經足夠了
dump系統狀態
引用
SQL> oradebug setmypid????????????????????????????????????????????
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug dump systemstate 266
Statement processed.
或者dump hanganalyze
引用
SQL> oradebug? hanganalyze 3
Hang Analysis in /oracle/app/oracle/admin/ora10g/udump/ora10g_ora_52642.trc
對于rac
引用
SQLPLUS> oradebug setmypid
SQLPLUS>oradebug setinst all
SQLPLUS>oradebug -g def hanganalyze 3
或者dump 進程狀態
引用
SQL> oradebug dump processstate 10
Statement processed.
進一步,如果有10g客戶端,數據庫是9i,依然可以用-prelim
引用
$ sqlplus -prelim /nolog
SQL*Plus: Release 10.2.0.4.0 - Production on Sun Mar 28 06:50:19 2010
Copyright (c) 1982, 2007, Oracle.? All Rights Reserved.
SQL> conn sys/oracle@ora9i as sysdba
Prelim connection established
SQL>? oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL>? oradebug dump systemstate 266
Statement processed.
?
There are two ways to connect to sqlplus using a preliminary connection.
1.?sqlplus -prelim / as sysdba
2.?sqlplus /nolog
set _prelim on
connect / as sysdba
?
1. While running system state dump with "-prelim" option:
sqlplus -prelim / as sysdba
SQL*Plus: Release 10.2.0.2.0 - Production on Mon Dec 11 17:28:14 2006
SQL> oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug dump systemstate 266
ORA-03113: end-of-file on communication channel
ORA-24323: value not allowed
?
2. The following error is reported in the alert.log:
ORA-07445: exception encountered: core dump [kgllkd()+1254] [SIGSEGV] [Address not mapped to
object] [0x000000030] [] []
The error did not crash background process or terminate the instance.
?
The issue is not resolved in any known patches.
Use any of the below workarounds:
·?Connect / as sysdba (without -prelim)
OR
·?Force the variable PGA to be initialized:
?
sqlplus -prelim '/ as sysdba'
oradebug setmypid
oradebug unlimit
oradebug call ksmcpg
oradebug dump systemstate 10
--測試環境11g,獲lgwr的spid
SQL> select * from v$process where username='SYSTEM' and program like '%LGWR%';
?
ADDR??????????????????? PID SPID???????????????????? PNAME USERNAME?????????? SERIAL# TERMINAL???????? PROGRAM????????????????????????????????????????????????????????? TRACEID????????????????????????????????????????????????????????????????????????? TRACEFILE??????????????????????????????????????????????????????????????????????? BACKGROUND LATCHWAIT??????? LATCHSPIN??????? PGA_USED_MEM PGA_ALLOC_MEM PGA_FREEABLE_MEM PGA_MAX_MEM
---------------- ---------- ------------------------ ----- --------------- ---------- ---------------- ---------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ---------- ---------------- ---------------- ------------ ------------- ---------------- -----------
000007FF614CD768???????? 11 17428??????????????????? LGWR? SYSTEM?????????????????? 1 123-PC?????????? ORACLE.EXE (LGWR)???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? d:\oracle11g_64bit\diag\rdbms\second\second\trace\second_lgwr_17428.trc????????? 1???????????????????????????????????????????????? 5007762?????? 5465314?????????? 131072???? 9921762
--另啟一會話窗口,暫掛lgwr進程
SQL> oradebug setsospid 17428
ORA-00070: command setsospid is not valid
SQL> oradebug setospid 17428
Oracle pid: 11, Windows thread id: 17428, image: ORACLE.EXE (LGWR)
SQL> oradebug suspend
Statement processed.
--發生日志切換hang住
SQL> alter system switch logfile;
?
System altered
--新建一個會話窗口
create table t_h(a int);--語句hang住
--解掛lgwr進程,上述lgwr及create操作順利執行完畢
SQL> oradebug resume
Statement processed.
小結:如果日志切換時,會暫住一切所有的數據庫前端事務create and dml
?
About Me
....................................................................................................................................................
本文來自于微信公眾號轉載文章,若有侵權,請聯系小麥苗及時刪除
ITPUB BLOG:http://blog.itpub.net/26736162
QQ:642808185 若加QQ請注明您所正在讀的文章標題
【版權所有,文章允許轉載,但須以鏈接方式注明源地址,否則追究法律責任】
....................................................................................................................................................
總結
以上是生活随笔為你收集整理的Oracle hang 之sqlplus -prelim使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 【Mongodb】用户和认证 权限总结
- 下一篇: 生成二维码的 jQuery 插件:jqu