標籤:rmi sel zed fixed data ota shu 設定 iat
由於某次不小心操作,在切換資料表空間時沒有成功,但是由於把parameter undo的undo_management值改為了MANUAL所以在啟動資料庫時沒有報任何錯誤,但是給表插入資料時報錯了,復原段停用錯誤。然後查詢了錯誤原因。
1 首先看資料庫中undo資訊
SQL> show parameter undo;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 10800
undo_tablespace string UNDOTBS2
undo tablespace是UNDOTBS2,實際上已經被刪除,但是由於undo_management MANUAL的所以資料庫可以正常啟動不會報錯。
2 查看資料庫undo 資料檔案
select file_name,tablespace_name,online_status
from dba_data_files
where tablespace_name like ‘%UNDO%‘;
FILE_NAME TABLESPACE_NAME ONLINE_STATUS
1/home/oracle/oradata/UNDOTBS1.dbfUNDOTBS1 ONLINE
資料庫中只有一個名為UNDOTBS1 undo資料表空間,很明顯系統裡undo 配置資訊有誤。
3 重啟資料庫到mount狀態修改undo 配置資訊
SQL> startup mount;
ORACLE instance started.
Total System Global Area 450953216 bytes
Fixed Size 2214256 bytes
Variable Size 348128912 bytes
Database Buffers 96468992 bytes
Redo Buffers 4141056 bytes
Database mounted.
SQL> alter system set undo_management=‘AUTO‘ scope=spfile;
System altered.
重啟資料庫到mount狀態下查看undo配置資訊
SQL> show parameter undo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 900
undo_tablespace string UNDOTBS2
SQL> show parameter undo_tablespace;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_tablespace string UNDOTBS2
然後修改undo_tablespace
SQL> alter system set undo_tablespace=UNDOTBS1;
alter system set undo_tablespace=UNDOTBS1
*
ERROR at line 1:
ORA-02097: parameter cannot be modified because specified value is invalid
ORA-01219: database not open: queries allowed on fixed tables/views only
報資料庫未開啟的錯誤,於是開啟資料庫
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-30012: undo tablespace ‘UNDOTBS2‘ does not exist or of wrong type
Process ID: 72674
Session ID: 1 Serial number: 3
又遇到新的錯誤,應該是修改了undo_management為AUTO然後啟動時要檢測對應的undo_tablespace,但是undo_tablespace:UNDOTBS2不存在,所以引起了一系列問題。
根據以往經驗準備關閉資料庫然後查看spfile關於undo資料表空間的配置是否正確,正確則採用spfile啟動到mount狀態,不正確則修改之後再使用spfile方式啟動到mount狀態,關閉資料庫問題又來了
SQL> shutdown abort;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn‘t exist
SQL> shutdown immediate;
ORA-24324: service handle not initialized
ORA-01041: internal error. hostdef extension doesn‘t exist
SQL> show parameter undo;
ERROR:
ORA-03114: not connected to ORACLE
不管以哪種方式關閉,都不行,也不能查詢參數資訊了,資料庫應該處於異常狀態,於是百度查詢解決辦法:
首先退出sqlplus然後設定一下,指定ORACLE_SID,進而提供了執行個體資訊就可以解決問題。
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[[email protected] ~]$ set ORACLE_SID=ORCL
[[email protected] ~]$ sqlplus
SQL> shutdown abort;
ORACLE instance shut down.
進入sqlplus順利關閉資料庫,然後再去查看對應的spfile,/usr/oracle/app/admin/orcl/pfile/init.ora.95201623739,vim 進去查看關於undo資訊的配置如果不正確要修改,主要是undo_tablespace修改為資料庫存在且可用的undo資料表空間,資訊如下:
undo_management=AUTO
undo_retention=10800
undo_tablespace=UNDOTBS1
"init.ora.95201623739" 58L, 1877C
修改之後採用spfile啟動到mount狀態下
SQL> startup mount pfile=/usr/oracle/app/admin/orcl/pfile/init.ora.95201623739;
ORACLE instance started.
資料庫啟動成功,查看undo配置資訊。正確了。
SQL> show parameter undo;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string AUTO
undo_retention integer 10800
undo_tablespace string UNDOTBS1
然後啟動資料庫到open狀態,可以向表中插入資料了,不會再報復原段停用錯誤了。
關於 ORA-24324 與ORA-01041錯誤,一般的解決的辦法如下
重啟監聽程式;
重啟sqlplus;
登陸伺服器本機重啟資料庫;
總結,在修改undo配置資訊時,先修改了undo_management 為auto,但是undo_tablespace沒有一起修改,導致重啟之後系統會根據undo_tablespace的值去配置對應的undo tablespace,但是這個值對應的undo tablespace實際上是不存在的,所以啟動過程發生異常。應該一起修改undo_management 與 undo_tablespace。
Oracle undo 資料表空間不可用