$rm /u01/app/oracle/oradata/ENMOEDU/redo09*
--删除第九组的全部文件
$ls /u01/app/oracle/oradata/ENMOEDU/redo09*
--查看是否删除成功
Sql> shutdown immediate
Sql> startup
--重启数据库触发出错
Sql> startup mount
Sql> alter database clear logfile group 9;
--重建了第九组的了两个文件,两个文件都是空的;
Sql> alter database open;
cat /u01/app/oracle/oradata/ENMOEDU/redo03*;
--查看物理地址,查看是否生成文件
SQL>select GROUP#,members,BYTES/1024/1024 size_M,STATUS,ARCHIVED from v$log;
--查看日志组及成员
Alert日志中的错误:
Errors in file
/u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/trace/ENMOEDU_lgwr_35031.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ENMOEDU/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
Errors in file /u01/app/oracle/diag/rdbms/enmoedu/ENMOEDU/trace/ENMOEDU_lgwr_35031.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '/u01/app/oracle/oradata/ENMOEDU/redo01.log'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
2).丢失当前redo日志组
select a.group#, a.status, a.archived,b.member
from v$log a,v$logfile b
where a.group#=b.group#;
$rm /u01/app/oracle/oradata/ENMOEDU/redo09*;
alter system switch logfile;
/
/
数据库出现hanging现象,在alert.log中报错;
或重启数据库触发错误:
Sql> shutdown immediate
Sql> startup
--触发出错
SQL> startup mount
ORACLE instance started.
Total System Global Area 237998080 bytes
Fixed Size 2227216 bytes
Variable Size 192938992 bytes
Database Buffers 37748736 bytes
Redo Buffers 5083136 bytes
Database mounted.
SQL> alter database clear logfile group 9;
--丢失current状态日志组,不能这样恢复
alter database clear logfile group 9
*
ERROR at line 1:
ORA-00350: log 9 of instance ENMOEDU (thread 1) needs to be archived
ORA-00312: online log 9 thread 1: '/u01/app/oracle/oradata/ENMOEDU/redo03.log'
SQL> alter database clear unarchived logfile group 9;
--无归档恢复
Database altered.
验证:
!ls /u01/app/oracle/oradata/ENMOEDU/
SQL> select GROUP#,members,BYTES/1024/1024 size_M,STATUS,ARCHIVED from v$log;
----------------------------------------------------------------------------------------------------------------
二、丢失临时文件:
1.--查看临时文件的位置及名称
SYS>select name from v$tempfile;
/u01/app/oracle/oradata/PROD/datafile/o1_mf_temp_b22570tq_.tmp
2.--删除临时文件
SYS>!rm /u01/app/oracle/oradata/PROD/datafile/o1_mf_temp_b22570tq_.tmp
3.--触发错误,临时文件未找到
SYS>create global temporary table tab_temp as select * from dba_objects;
create global temporary table tab_temp as select * from dba_objects
*
ERROR at line 1:
ORA-01116: error in opening database file 201
ORA-01110: data file 201:
'/u01/app/oracle/oradata/PROD/datafile/o1_mf_temp_b22570tq_.tmp'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
4.在知道临时数据文件丢失时,可以不需要重新启动数据库就可以在丢失了临时文件后进行恢复;
SQL> ALTER TABLESPACE temp ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp02.dbf' SIZE 20M;
Tablespace altered.
SQL> ALTER TABLESPACE temp DROP TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf';
Tablespace altered.
5. 1)在11g中还可以重启数据库,数据库会自动重建临时数据文件,可以查看alert日志看相关信息(一般直接第4步就可以了)
shutdown immediate;