undo 表空间损坏导致无法open
在数据库undo表空间文件损坏,或者undo表空间文件缺失的情况,无法打开数据库。
这两种情况都可以视为一种情况处理,解决方法一样。
启动数据库时 出现:
SQL> startup
ORACLE instance started.Total System Global Area 709836800 bytes
Fixed Size 2231752 bytes
Variable Size 536871480 bytes
Database Buffers 167772160 bytes
Redo Buffers 2961408 bytes
Database mounted.
ORA-01092: ORACLE instance terminated. Disconnection forced
ORA-30012: undo tablespace 'UNDOTBS1' does not exist or of wrong type
Process ID: 4098
Session ID: 1 Serial number: 5
可以很明显的看到,由于undo表空间损坏或丢失,导致无法打开。
解决思路很简单:新建一个undo表空间,然后将undo_tablespace指向新的undo表空间。但是,但是。。。新建表空间只能在数据库open状态下才能进行。
所以。。
因为oracle system 表空间还有回滚段,因为我们先可以让oracle使用回滚段打开数据库,然后就可以新建undo表空间了
解决思路:
1、将数据库启动到mount
2、alter system set undo_management=manual scope=spfile;
3、shutdown immediate
4 、startup 然后新建一个undo表空间 new_undotbsxx
5、修改undo_tablespace参数指向new_undotbsxx
6、记得 将undo_manageme参数修改回来。 alter system set undo_management=auto scope=spfile;
SQL> alter system set undo_management=manual scope=spfile;
System altered.
然后打开数据库---
SQL> startup
ORACLE instance started.
Total System Global Area 709836800 bytes
Fixed Size 2231752 bytes
Variable Size 536871480 bytes
Database Buffers 167772160 bytes
Redo Buffers 2961408 bytes
Database mounted.
Database opened.
--已经顺利打开数据库
查看 --undo_management
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
undo_management string MANUAL
undo_retention integer 900
undo_tablespace string UNDOTBS11
现在可以新建一个undo_tablespace 然后将undo_tablespace参数指向过去。
SQL> create undo tablespace undotbs11 datafile '/u01/app/oracle/oradata/orcl/undotbs11.dbf' size 100m;
Tablespace created.
--然后将undo_tablespace指向为刚刚新建的undo表空间
SQL> alter system set undo_tablespace=undotbs11 scope=spfile;
System altered.
--最后一定一定要记得把undo_management 给改回来
SQL> alter system set undo_management=auto scope=spfile;
System altered.
然后关闭数据库,再打开
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 709836800 bytes
Fixed Size 2231752 bytes
Variable Size 536871480 bytes
Database Buffers 167772160 bytes
Redo Buffers 2961408 bytes
Database mounted.
Database opened.
--没有问题,可以将以前损坏的undo表空间数据文件删除了
SQL> drop tablespace undotbs1 including contents and datafiles;
Tablespace dropped.