日期:2014-05-16  浏览次数:20352 次

Oracle 非当前正用UNDO文件的恢复
非当前的还原表空间的恢复
1.创建实验条件
sqlplus /nolog
conn sys/ticket as sysdba

查看数据库的所有还原表空间
select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';
查看当前采用的还原表空间
show parameter undo;
创建相关的表空间
create undo tablespace tbs_undo
datafile 'D:\app\Administrator\oradata\ticket\TBS_UNDO.DBF'
size 50m
extent 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 MB
from dba_data_files
where 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 MB
from dba_data_files
where 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 MB
from dba_data_files
where tablespace_name like '%UNDO%';
检查undo表空间中受损文件是否存在
select tablespace_name,status,contents from dba_tablespaces where contents='UNDO';
不存在受损undo空间,然后重新创建。
create undo tablespace tbs_undo
datafile 'D:\app\Administrator\oradata\ticket\TBS_UNDO.DBF'
size 50m
extent management local;





?