sqlplus -prelim/ as sysdba用法

weifenghq發表於2009-02-03
原文見:部落格

在某些情況下,資料庫失去響應,sqlplus也無法連線,此時通常只能透過殺掉程式來解決。

但是我們仍然希望能夠獲得此時的資料庫狀態資訊,以便用於事後診斷。
從Oracle10g開始,sqlplus提供了一個引數選項-prelim,可以在通常sqlplus無法連線的情況下進行連線。
透過以下步驟可以獲取系統資訊:

sqlplus -prelim / as sysdba
oradebug setmypid
oradebug unlimit;
oradebug dump systemstate 10

<wbr>

這種方法非常有用:

$ sqlplus -prelim / as sysdba

<wbr>

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 25 09:42:20 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL>

<wbr>

但是需要注意的是,在Oracle 10.2.0.1中,使用如上方法會出現一個錯誤:

$ sqlplus -prelim / as sysdba

<wbr>

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Oct 25 09:38:14 2007

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> oradebug setmypid
Statement processed.
SQL> oradebug unlimit
Statement processed.
SQL> oradebug dump systemstate 10
ORA-03113: end-of-file on communication channel
ORA-24323: value not allowed


此時在alert檔案中會記錄如下錯誤提示:

Thu Oct 25 09:38:32 2007
System State dumped to trace file
Thu Oct 25 09:38:32 2007
Errors in file /opt/oracle/admin/test201/udump/test201_ora_1402.trc:
ORA-07445: exception encountered: core dump [kgldmp()+1360] [SIGSEGV] [Address not mapped to object] [0x000000030] [] []


這是由於一個Bug導致的,Bug號為5730231,該Bug在10.2.0.3中修正。

對於9i也有變通的方法使用

-prelim is feature of Sql*Plus 10g and latter.

So as long you have any Sql*Plus 10g or latter version (ex. from client installation) and a valid net service name to connect to your 9i database you should be able to establish a "backdoor" connection.

You can do the following:

$sqlplus -prelim /nolog

and once you are in, just connect to the database using SYSDBA account

SQL> connect sys/password@net_service_name as sysdba
Prelim connection established
[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/633084/viewspace-1016614/,如需轉載,請註明出處,否則將追究法律責任。

相關文章