Oracle 非当前正用UNDO文件的恢复
非当前的还原表空间的恢复1.创建实验条件sqlplus /nologconn sys/ticket as sysdba查看数据库的所有还原表空间select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';查看当前采用的还原表空间show parameter undo;创建相关的表空间create undo tablespace tbs_undodatafile 'D:\app\Administrator\oradata\ticket\TBS_UNDO.DBF'size 50mextent management local;查询表空间的信息select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';查看当前采用的还原表空间show parameter undo;set line 120;col file_name for a55;col tablespace_name for a15;查看表空间对应的还原文件select file_id,file_name,tablespace_name,bytes/1024/1024 MBfrom dba_data_fileswhere tablespace_name like '%UNDO%';shutdown immediate;2.模拟非当前使用的undo文件的损坏删除非当前采用的undo文件3.开始试验startup设置受损undo文件编号为脱机并删除alter database datafile 受损文件编号 offline drop;开启数据库alter database open;检查受损undo文件是否存在select file_id,file_name,tablespace_name,bytes/1024/1024 MBfrom dba_data_fileswhere tablespace_name like '%UNDO%';检查undo表空间中受损文件是否存在select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';如果存在,删除受损undo表空间drop tablespace tbs_undo;检查受损undo文件是否存在select file_id,file_name,tablespace_name,bytes/1024/1024 MBfrom dba_data_fileswhere tablespace_name like '%UNDO%';检查undo表空间中受损文件是否存在select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';不存在受损undo空间,然后重新创建。create undo tablespace tbs_undodatafile 'D:\app\Administrator\oradata\ticket\TBS_UNDO.DBF'size 50mextent management local;
?