关于控制文件和redo log损坏的恢复

    前段时间一朋友自己电脑上的开发测试用的数据库出了点问题,电脑操作系统是Win8,直接在Win8上安装了Oracle11g,后来系统自动升级到Win8.1,Oracle相关的服务全都不见了,想想把数据文件、参数据文件、控制文件、redo log备份一下,然后重装一下,但在复制控制文件的时候,总是无法复制,最终放弃了备份控制文件,打算装好后重建控制文件。一切还算顺利,因为数据文件和redo log都是完整的,所以重建控制文件也很顺利。

    由此想到春节前有一台服务器因断电而导致控制文件和redo log损坏,当时用了备份文件恢复了数据库,现在想一下是否可以通过重建控制文件的方式来恢复,就找了一个测试机做了一个测试,操作步骤如下:(未做解释)

 

[[email protected]:/u02/oradata/dba]$ ll

total 2336140

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:21 control01.ctl

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:21 control02.ctl

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:21 control03.ctl

-rw-r----- 1 oracle oinstall 104865792 Mar 31 09:21 example01.dbf

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:21 redo01.log

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:21 redo02.log

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:21 redo03.log

-rw-r----- 1 oracle oinstall 629153792 Mar 31 09:21 sysaux01.dbf

-rw-r----- 1 oracle oinstall 754982912 Mar 31 09:21 system01.dbf

-rw-r----- 1 oracle oinstall  88088576 Mar 30 16:56 temp01.dbf

-rw-r----- 1 oracle oinstall 676339712 Mar 31 09:21 undotbs01.dbf

-rw-r----- 1 oracle oinstall   5251072 Mar 31 09:21 users01.dbf

[[email protected]:/u02/oradata/dba]$ rm *.ctl 

[[email protected]:/u02/oradata/dba]$ rm *.log

[[email protected]:/u02/oradata/dba]$ ll

total 2153968

-rw-r----- 1 oracle oinstall 104865792 Mar 31 09:21 example01.dbf

-rw-r----- 1 oracle oinstall 629153792 Mar 31 09:21 sysaux01.dbf

-rw-r----- 1 oracle oinstall 754982912 Mar 31 09:21 system01.dbf

-rw-r----- 1 oracle oinstall  88088576 Mar 30 16:56 temp01.dbf

-rw-r----- 1 oracle oinstall 676339712 Mar 31 09:21 undotbs01.dbf

-rw-r----- 1 oracle oinstall   5251072 Mar 31 09:21 users01.dbf

[[email protected]:/u02/oradata/dba]$ sqlplus / as sysdba



SQL*Plus: Release 11.2.0.3.0 Production on Tue Mar 31 09:22:07 2015



Copyright (c) 1982, 2011, Oracle.  All rights reserved.



Connected to an idle instance.



SQL> startup nomount

ORACLE instance started.



Total System Global Area 8551575552 bytes

Fixed Size                  2245480 bytes

Variable Size             939527320 bytes

Database Buffers         7600078848 bytes

Redo Buffers                9723904 bytes

SQL> CREATE CONTROLFILE REUSE DATABASE "DBA" RESETLOGS  NOARCHIVELOG

  2      MAXLOGFILES 16

  3      MAXLOGMEMBERS 3

  4      MAXDATAFILES 100

  5      MAXINSTANCES 8

  6      MAXLOGHISTORY 10

  7  LOGFILE

  8    GROUP 1 '/u02/oradata/dba/redo01.log'  SIZE 50M,

  9    GROUP 2 '/u02/oradata/dba/redo02.log'  SIZE 50M,

 10    GROUP 3 '/u02/oradata/dba/redo03.log'  SIZE 50M

 11  -- STANDBY LOGFILE

 12  DATAFILE

 13    '/u02/oradata/dba/system01.dbf',

 14    '/u02/oradata/dba/undotbs01.dbf',

 15    '/u02/oradata/dba/sysaux01.dbf',

 16    '/u02/oradata/dba/users01.dbf',

 17    '/u02/oradata/dba/example01.dbf'

 18  CHARACTER SET ZHS16GBK

 19  ;



Control file created.



SQL> recover database using backup controlfile until cancel;

ORA-00279: change 2078375 generated at 03/31/2015 09:21:31 needed for thread 1

ORA-00289: suggestion : /u03/arch_log/1_1_875784077.dbf

ORA-00280: change 2078375 for thread 1 is in sequence #1





Specify log: {<RET>=suggested | filename | AUTO | CANCEL}

auto

ORA-00308: cannot open archived log '/u03/arch_log/1_1_875784077.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3





ORA-00308: cannot open archived log '/u03/arch_log/1_1_875784077.dbf'

ORA-27037: unable to obtain file status

Linux-x86_64 Error: 2: No such file or directory

Additional information: 3





SQL> alter database open resetlogs;



Database altered.



SQL> exit

Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

[[email protected]:/u02/oradata/dba]$ ll

total 2336140

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:28 control01.ctl

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:28 control02.ctl

-rw-r----- 1 oracle oinstall   9748480 Mar 31 09:28 control03.ctl

-rw-r----- 1 oracle oinstall 104865792 Mar 31 09:24 example01.dbf

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:27 redo01.log

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:24 redo02.log

-rw-r----- 1 oracle oinstall  52429312 Mar 31 09:24 redo03.log

-rw-r----- 1 oracle oinstall 629153792 Mar 31 09:24 sysaux01.dbf

-rw-r----- 1 oracle oinstall 754982912 Mar 31 09:24 system01.dbf

-rw-r----- 1 oracle oinstall  88088576 Mar 30 16:56 temp01.dbf

-rw-r----- 1 oracle oinstall 676339712 Mar 31 09:24 undotbs01.dbf

-rw-r----- 1 oracle oinstall   5251072 Mar 31 09:24 users01.dbf

[[email protected]:/u02/oradata/dba]$ 

 

你可能感兴趣的:(redo)