主要描述在单实例未备份的极端情况下恢复
1.undo 表空间存在多个数据文件其中一个丢失
删除默认undo数据文件
[oracle@instance-ej1hspdt ORCLCDB]$ rm -rf undotbs01.dbf
尝试一致性关闭数据库
SQL> shutdown immediate;
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/opt/oracle/oradata/ORCLCDB/undotbs01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
----------------------------------------------------------------
启动数据库到mount状态
startup mount
脱机丢失的数据文件
SQL> alter DATABASE DATAFILE '/opt/oracle/oradata/ORCLCDB/undotbs01.dbf' OFFLINE;
Database altered.
打开数据库
SQL> alter database open;
Database altered.
创建新的表空间并切换删除旧的表空间
create undo TABLESPACE UNDOTBS02 DATAFILE;
ALTER SYSTEM SET UNDO_TABLESPACE = UNDOTBS02;
设置隐藏参数
SQL> alter system set "_offline_rollback_segments"=true scope=spfile;
System altered.
-----------------------------------------------------------------------------
删除之前有问题undo表空间报错,无法删除。
SQL> drop tablespace UNDOTBS including contents;
drop tablespace UNDOTBS including contents
*
ERROR at line 1:
ORA-01548: active rollback segment '_SYSSMU1_2350702231$' found, terminate
dropping tablespace
-----------------------------------------------------------
查询needs_recovery块在pfile添加隐藏参数,之后用pfile文件启动数据库
select segment_name,status,tablespace_name from dba_rollback_segs;
-------------------------------------------------------------------------
vi initORCLCDB.ora
*._corrupted_rollback_segments=(_SYSSMU1_2350702231$,_SYSSMU2_830629575$,_SYSSMU3_2382401544$,_SYSSMU4_4097893920$,_SYSSMU5_3588313063$,_SYSSMU6_1225920019$,_SYSSMU7_792842843$,_SYSSMU8_3775286
582$,_SYSSMU9_677683072$,_SYSSMU10_3822963826$)
SQL> startup force pfile='/opt/oracle/product/18c/dbhome_1/dbs/initORCLCDB.ora';
ORACLE instance started.
------------------------------------------------------------------------------------
SQL> drop tablespace UNDOTBS including contents and datafiles;
Tablespace dropped.
2.