oracle数据库崩溃紧急恢复命令

控制文件创建命令生成:
alter database backup controlfile to trace as '路径+文件名';
打开这个文件拷贝命令执行可以重建控制文件。
使用一个隐含参数_allow_resetlogs_corruption强制启动数据库,设置此参数之后,
这时,数据库可以打开。但是数据库中的数据可能不一致,某些查询如果涉及这些不一致的数据,会遇到ora-600错误。
打开数据库后,我们可以从部分恢复的数据文件及其他正常数据文件中导出尽可能多的数据,然后重建数据库,导入之前导出的数据,从而让损失降低到最小。
设置这个隐含参数后,要使用resetlogs选项打开数据库,隐含参数才会生效,否则Oracle在打开数据库时会忽略此参数。
在数据库Open过程中,Oracle会跳过某些一致性检查,从而使数据库可能跳过不一致状态,Open打开:
SQL> connect sys/oracle as sysdba;
SQL> shutdown immediate;
SQL> startup mount;
SQL> alter system set "_allow_resetlogs_corruption"=true scope=spfile;

System altered.

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 33554432 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
SQL> recover database using backup controlfile until cancel;
ORA-00279: change 897612315 generated at 10/19/2005 16:54:18 needed for thread 1
ORA-00289: suggestion : /opt/oracle/oradata/conner/archive/1_160.dbf
ORA-00280: change 897612315 for thread 1 is in sequence #160


Specify log: {=suggested | filename | AUTO | CANCEL}
cancel
ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/opt/oracle/oradata/conner/system01.dbf'


ORA-01112: media recovery not started

输入用来恢复的回滚日志文件时可以使用根据sequence查找是哪个log文件

SQL> alter database open resetlogs;

Database altered.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 97588504 bytes
Fixed Size 451864 bytes
Variable Size 33554432 bytes
Database Buffers 62914560 bytes
Redo Buffers 667648 bytes
Database mounted.
Database opened.

如果进行数据备份等会提示临时表空间为空 重新创建一个临时表空间,并改为默认新的临时表空间
create temporary tablespace temp2 tempfile '/u01/app/oracle/oradata/orcl/TEMP02.DBF' size 100m autoextend on;
alter database default temporary tablespace temp2;
drop tablespace temp including contents and datafiles;



相关文档
最新文档