【故障处理】ORA-30012的解决过程
【故障处理】ORA-30012的解决过程
1 BLOG文档结构图
2 前言部分
2.1 导读和注意事项
各位技术爱好者,看完本文后,你可以掌握如下的技能,也可以学到一些其它你所不知道的知识,~O(∩_∩)O~:
① ORA-30012的解决过程
Tips:
① 本文在itpub(http://blog.itpub.net/26736162)、博客园(http://www.cnblogs.com/lhrbest)和微信公众号(xiaomaimiaolhr)上有同步更新。
② 文章中用到的所有代码、相关软件、相关资料及本文的pdf版本都请前往小麦苗的云盘下载,小麦苗的云盘地址见:http://blog.itpub.net/26736162/viewspace-1624453/。
③ 若网页文章代码格式有错乱,请下载pdf格式的文档来阅读。
④ 在本篇BLOG中,代码输出部分一般放在一行一列的表格中。其中,需要特别关注的地方我都用灰色背景和粉红色字体来表示,比如在下边的例子中,thread 1的最大归档日志号为33,thread 2的最大归档日志号为43是需要特别关注的地方;而命令一般使用黄色背景和红色字体标注;对代码或代码输出部分的注释一般采用蓝色字体表示。
List of Archived Logs in backup set 11 Thrd Seq Low SCN Low Time Next SCN Next Time ---- ------- ---------- ------------------- ---------- --------- 1 32 1621589 2015-05-29 11:09:52 1625242 2015-05-29 11:15:48 1 33 1625242 2015-05-29 11:15:48 1625293 2015-05-29 11:15:58 2 42 1613951 2015-05-29 10:41:18 1625245 2015-05-29 11:15:49 2 43 1625245 2015-05-29 11:15:49 1625253 2015-05-29 11:15:53 [ZHLHRDB1:root]:/>lsvg -o T_XLHRD_APP1_vg rootvg [ZHLHRDB1:root]:/> 00:27:22 SQL> alter tablespace idxtbs read write; ====》2097152*512/1024/1024/1024=1G |
本文如有错误或不完善的地方请大家多多指正,ITPUB留言或QQ皆可,您的批评指正是我写作的最大动力。
2.2 本文简介
甲方在做灾备切换演练的时候,有一套数据库不能正常启动,基本的报错都是:ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type 。下面记录一下其解决过程。
3 故障分析及解决过程
3.1 故障环境介绍
项目 |
source db |
db 类型 |
RAC |
db version |
11.2.0.3.0 |
db 存储 |
ASM |
OS版本及kernel版本 |
AIX 64位 7.1.0.0 |
3.2 故障发生现象及报错信息
[ZFLHRDB1:root]:/>crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA1.dg ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.LISTENER.lsnr ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.asm ONLINE ONLINE zflhrdb1 Started ONLINE ONLINE zflhrdb2 Started ora.gsd OFFLINE OFFLINE zflhrdb1 OFFLINE OFFLINE zflhrdb2 ora.net1.network ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.ons ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.registry.acfs ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE zflhrdb1 ora.cvu 1 ONLINE ONLINE zflhrdb1 ora.oc4j 1 ONLINE ONLINE zflhrdb1 ora.oralhr.db 1 ONLINE OFFLINE Instance Shutdown 2 ONLINE OFFLINE Instance Shutdown ora.scan1.vip 1 ONLINE ONLINE zflhrdb1 ora.zflhrdb1.vip 1 ONLINE ONLINE zflhrdb1 ora.zflhrdb2.vip 1 ONLINE ONLINE zflhrdb2 [ZFLHRDB1:root]:/>srvctl start db -d oralhr PRCR-1079 : Failed to start resource ora.oralhr.db CRS-5017: The resource action "ora.oralhr.db start" encountered the following error: ORA-01092: ORACLE instance terminated. Disconnection forced ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type Process ID: 12976284 Session ID: 1421 Serial number: 1 . For details refer to "(:CLSN00107:)" in "/oracle/app/11.2.0/grid/log/zflhrdb1/agent/crsd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.oralhr.db' on 'zflhrdb1' failed CRS-2632: There are no more servers to try to place resource 'ora.oralhr.db' on that would satisfy its placement policy CRS-5017: The resource action "ora.oralhr.db start" encountered the following error: ORA-01092: ORACLE instance terminated. Disconnection forced ORA-30012: undo tablespace 'UNDOTBS2' does not exist or of wrong type Process ID: 14614730 Session ID: 1421 Serial number: 1 . For details refer to "(:CLSN00107:)" in "/oracle/app/11.2.0/grid/log/zflhrdb2/agent/crsd/oraagent_oracle/oraagent_oracle.log".
CRS-2674: Start of 'ora.oralhr.db' on 'zflhrdb2' failed
|
3.3 故障分析及解决过程
[ZFLHRDB1:root]:/>oerr ora 30012 30012, 00000, "undo tablespace '%s' does not exist or of wrong type" // *Cause: the specified undo tablespace does not exist or of the // wrong type. // *Action: Correct the tablespace name and reissue the statement. [ZFLHRDB1:root]:/>su - oracle [ZFLHRDB1:oracle]:/oracle>sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Nov 6 23:46:05 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SYS@oraLHR1> startup mount ORACLE instance started.
Total System Global Area 3206836224 bytes Fixed Size 2225776 bytes Variable Size 1409288592 bytes Database Buffers 1778384896 bytes Redo Buffers 16936960 bytes Database mounted. SYS@oraLHR1> select * from v$tablespace;
TS# NAME INC BIG FLA ENC ---------- ------------------------------ --- --- --- --- 0 SYSTEM YES NO YES 1 SYSAUX YES NO YES 3 TEMP NO NO YES 5 USERS YES NO YES 6 ILHRDATA YES NO YES 7 ILHRIND YES NO YES 8 ILHRLOG YES NO YES 9 UNDO1 YES NO YES 10 UNDO2 YES NO YES
9 rows selected. SYS@oraLHR1> show parameter spfile
NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ spfile string +DATA1/oralhr/spfileoralhr.ora SYS@oraLHR1> SELECT a.SID, a.VALUE FROM v$spparameter a WHERE a.NAME LIKE '%undo_tablespace%' ;
SID VALUE -------------------- ----------- oraLHR2 UNDOTBS2 oraLHR1 UNDOTBS1 * UNDO2 |
可以看到UNDO表空间的名称和从控制文件中查到的名称不一致,下面修改SPFILE文件中有关UNDO表空间的部分,如下所示:
SYS@oraLHR1> ALTER SYSTEM SET undo_tablespace='UNDO1' SID='oraLHR1';
System altered.
SYS@oraLHR1> ALTER SYSTEM SET undo_tablespace='UNDO2' SID='oraLHR2';
System altered.
SYS@oraLHR1> SELECT a.SID, a.VALUE FROM v$spparameter a WHERE a.NAME LIKE '%undo_tablespace%';
SID VALUE --------------- ------ oraLHR1 UNDO1 oraLHR2 UNDO2
<<<<<<<<<------- 已经和控制文件中记录的一致了,下面启动数据库 SYS@oraLHR1> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options [ZFLHRDB1:oracle]:/oracle>srvctl stop db -d oralhr -o abort [ZFLHRDB1:oracle]:/oracle>srvctl start db -d oralhr [ZFLHRDB1:oracle]:/oracle>crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA1.dg ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.LISTENER.lsnr ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.asm ONLINE ONLINE zflhrdb1 Started ONLINE ONLINE zflhrdb2 Started ora.gsd OFFLINE OFFLINE zflhrdb1 OFFLINE OFFLINE zflhrdb2 ora.net1.network ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.ons ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 ora.registry.acfs ONLINE ONLINE zflhrdb1 ONLINE ONLINE zflhrdb2 -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.LISTENER_SCAN1.lsnr 1 ONLINE ONLINE zflhrdb1 ora.cvu 1 ONLINE ONLINE zflhrdb1 ora.oc4j 1 ONLINE ONLINE zflhrdb1 ora.oralhr.db 1 ONLINE ONLINE zflhrdb1 Open 2 ONLINE ONLINE zflhrdb2 Open ora.scan1.vip 1 ONLINE ONLINE zflhrdb1 ora.zflhrdb1.vip 1 ONLINE ONLINE zflhrdb1 ora.zflhrdb2.vip 1 ONLINE ONLINE zflhrdb2 [ZFLHRDB1:oracle]:/oracle>srvctl status db -d oralhr Instance oraLHR1 is running on node zflhrdb1 Instance oraLHR2 is running on node zflhrdb2 |
4 故障处理总结
ORA-30012基本是由于参数文件中的undo_tablespace的值和控制文件中记录的值不一致导致的。可以使用ALTER SYSTEM修改或者直接修改参数文件中有关undo_tablespace的部分和控制文件中的一致即可。
关于为何会出现参数文件和控制文件中undo_tablespace的值不一致的情况,这个可以从告警日志中去查询,这里就不深究了,毕竟是个测试库,也许很多年都没人使用了吧。