ORA-01092: ORACLE 例程終止。強行斷開連線

xingfei80發表於2010-07-07

ORA-01092: ORACLE 例程終止。強行斷開連線

今天測試部門的人叫我過去,說是資料庫當了,起不來了。

[@more@]

我過去看了看情況,做了如下操作

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
Oracle 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
ORA-01092: ORACLE 例程終止。強行斷開連線

表面上看不出問題,我檢視alert_oracas.log檔案

SYS auditing is disabled
Starting up ORACLE RDBMS Version: 9.2.0.1.0.
System parameters with non-default values:
processes = 150
timed_statistics = TRUE
shared_pool_size = 50331648
large_pool_size = 8388608
Java_pool_size = 33554432
control_files = f:oracleoradataoracasCONTROL01.CTL, f:oracleoradataoracasCONTROL02.CTL, f:oracleoradataoracasCONTROL03.CTL
db_block_size = 8192
db_cache_size = 25165824
compatible = 9.2.0.0.0
db_file_multiblock_read_count= 16
fast_start_mttr_target = 300
undo_management = AUTO
undo_tablespace = UNDOSTB1
undo_retention = 10800
remote_login_passWordfile= EXCLUSIVE
db_domain =
instance_name = oracas
dispatchers = (PROTOCOL=TCP) (SERVICE=oracasXDB)
job_queue_processes = 10
hash_join_enabled = TRUE
background_dump_dest = f:oracleadminoracasbdump
user_dump_dest = f:oracleadminoracasudump
core_dump_dest = f:oracleadminoracascdump
sort_area_size = 524288
db_name = oracas
open_cursors = 300
star_transformation_enabled= FALSE
query_rewrite_enabled = FALSE
pga_aggregate_target = 19922944
aq_tm_processes = 1
PMON started with pid=2
DBW0 started with pid=3
LGWR started with pid=4
CKPT started with pid=5
SMON started with pid=6
RECO started with pid=7
CJQ0 started with pid=8
QMN0 started with pid=9
Mon Apr 18 17:30:25 2005
starting up 1 shared server(s) ...
starting up 1 dispatcher(s) for network address '(ADDRESS=(PARTIAL=YES)(PROTOCOL=TCP))'...
Mon Apr 18 17:30:26 2005
ALTER DATABASE MOUNT
Mon Apr 18 17:30:30 2005
SUCcessful mount of redo thread 1, with mount id 2424210674.
Mon Apr 18 17:30:30 2005
Database mounted in Exclusive Mode.
Completed: ALTER DATABASE MOUNT
Mon Apr 18 17:30:30 2005
ALTER DATABASE OPEN
Mon Apr 18 17:30:32 2005
Thread 1 opened at log sequence 105
Current log# 2 seq# 105 mem# 0: F:ORACLEORADATAORACASREDO02.LOG
Successful open of redo thread 1.
Mon Apr 18 17:30:32 2005
SMON: enabling cache recovery
Mon Apr 18 17:30:34 2005
Errors in file f:oracleadminoracasudumporacas_ora_3404.trc:
ORA-30012: 撤消表空間 'UNDOSTB1' 不存在或型別不正確

Mon Apr 18 17:30:34 2005
Error 30012 happened during db open, shutting down database
USER: terminating instance due to error 30012
Mon Apr 18 17:30:35 2005
Errors in file f:oracleadminoracasbdumporacas_smon_996.trc:
ORA-30012: undo tablespace '' does not exist or of wrong type

Mon Apr 18 17:30:35 2005
Errors in file f:oracleadminoracasbdumporacas_pmon_3500.trc:
ORA-30012: undo tablespace '' does not exist or of wrong type

Instance terminated by USER, pid = 3404
ORA-1092 signalled during: ALTER DATABASE OPEN...

於是我檢視了以下資訊來確認undo表空間的問題

SQL> conn as sysdba
已連線到空閒例程。
SQL> startup mount
ORACLE 例程已經啟動。

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes

資料庫裝載完畢。
SQL> select name from v$datafile;

NAME
------------------------------------------------------------------------
F:ORACLEORADATAORACASSYSTEM01.DBF
F:ORACLEORADATAORACASUNDOTBS01.DBF
F:ORACLEORADATAORACASCWMLITE01.DBF
F:ORACLEORADATAORACASDRSYS01.DBF
F:ORACLEORADATAORACASEXAMPLE01.DBF
F:ORACLEORADATAORACASINDX01.DBF
F:ORACLEORADATAORACASODM01.DBF
F:ORACLEORADATAORACASTOOLS01.DBF
F:ORACLEORADATAORACASUSERS01.DBF
F:ORACLEORADATAORACASXDB01.DBF
D:ORADATAORACASTSCAS11.DBF
E:ORADATAORACASTFCAS12.DBF
D:ORADATAORACASTSCAS21.DBF
E:ORADATAORACASTFCAS22.DBF
D:ORADATAORACASTSCAS31.DBF
E:ORADATAORACASTFCAS32.DBF
D:ORADATAORACASTSCAS41.DBF
E:ORADATAORACASTFCAS42.DBF
D:ORADATAORACASTSCASINDX1.DBF
E:ORADATAORACASTSCASINDX2.DBF
D:ORADATAORACASTFCAS13.DBF
D:ORADATAORACASTFCAS14.DBF
D:ORADATAORACASTFCAS23.DBF
D:ORADATAORACASTFCAS24.DBF
E:ORADATAORACASTSCASINDX12.DBF
E:ORADATAORACASTSCASINDX13.DBF
E:ORADATAORACASTSCASINDX24.DBF
E:ORADATAORACASTSCASINDX25.DBF
C:SNAPSHOT01.DBF
C:TSCAS1.DBF

已選擇30行。

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- -----------------------
undo_management string AUTO
undo_retention integer 10800
undo_suppress_errors boolean FALSE

undo_tablespace string UNDOSTB1
SQL> select name from v$tablespace;

NAME
------------------------------
CWMLITE
DRSYS
EXAMPLE
INDX
ODM
SYSTEM
TOOLS
UNDOTBS1
USERS
XDB
TEMP
TSCAS1
TSCAS2
TSCAS3
TSCAS4
TSCASINDX1
TSCASINDX2
SNAPSHOT_TS

已選擇18行。

當時沒有自己看問題,就以為是undo檔案損壞了,決定重建。

注意:後來才發現這裡以後的操作是饒了一個解決問題的彎路。

由於不open沒有辦法重新建立undo 表空間,所以決定先用系統預設的undo表空間來啟動,然後重建undo

表空間,具體操作如下:

SQL> create pfile from spfile;

檔案已建立。

修改pfile檔案

#*.undo_management='AUTO'
#*.undo_tablespace='UNDOSTB1'
undo_management=manual
undo_tablespace='system'

關閉資料庫,並且從目錄F:oracleora92database下去掉SPFILEORACAS.ORA檔案

重新啟動

SQL> shutdown immediate
ORA-01109: 資料庫未開啟


已經解除安裝資料庫。
ORACLE 例程已經關閉。

SQL> startup mount
ORACLE 例程已經啟動。

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
SQL> alter database open;

資料庫已更改。

檢視錶空間資訊

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------

undo_management string MANUAL
undo_retention integer 10800
undo_suppress_errors boolean FALSE
undo_tablespace string system
SQL> select name from v$tablespace;

NAME
------------------------------
CWMLITE
DRSYS
EXAMPLE
INDX
ODM
SYSTEM
TOOLS
UNDOTBS1
USERS
XDB
TEMP
TSCAS1
TSCAS2
TSCAS3
TSCAS4
TSCASINDX1
TSCASINDX2
SNAPSHOT_TS


並且開啟圖形介面檢視,這時候才發現undo表空間的名字是UNDOTBS1

其實早就能發現的,大家以後分析問題一定不要太快下結論,要自己分析。。。

於是做以下操作改變undo 表空間的名字

SQL> create spfile from pfile;

檔案已建立。

SQL> shutdown immediate

資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL

undo_retention integer 10800
undo_suppress_errors boolean FALSE
undo_tablespace string system
SQL> alter database set undo_management=auto;
alter database set undo_management=auto
*
ERROR 位於第 1 行:
ORA-02231: 缺少或無效的 ALTER DATABASE 選項


SQL> alter database set undo_management=auto scope=spfile;
alter database set undo_management=auto scope=spfile
*

ERROR 位於第 1 行:
ORA-02231: 缺少或無效的 ALTER DATABASE 選項


SQL> alter system set undo_management=auto scope=spfile;

系統已更改。

SQL> alter system set undo_tablespace='undotbs1' scope=spfile;

重啟驗證:

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE 例程已經關閉。
SQL> startup
ORACLE 例程已經啟動。

Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> create fpile from spfile;
create fpile from spfile
*
ERROR 位於第 1 行:
-

ORA-00901: 無效 CREATE 命令


SQL> create pfile from spfile;

檔案已建立。

SQL> show parameter undo

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 10800
undo_suppress_errors boolean FALSE
undo_tablespace string undotbs1

發現已經好使了

教訓總結:其實只要一開始分析下v$tablespace就能發現是undo表空間的名字錯了,很快就能解決的。

不過我上面這種方法可以用於undo表空間檔案corrupt的情況:)

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

相關文章