首页 > 代码库 > 利用备份的控制文件恢复

利用备份的控制文件恢复

 

cp +DATA/ora11g/backup/control01.ctl +DATA/ora11g/controlfile/control01.ctl

alter system set control_files=‘+DATA/ora11g/controlfile/control01.ctl‘ scope=spfile;

shutdown immediate

startup mount

select group#,status from v$log;

select group#,member from v$logfile;

select group#,thread#,sequence# from v$archive;

recover database using backup controlfile until cancel;

alter database open resetlogs;

 

------------------------------------------------------------------------------------------------------------------------------------------------

示例

alter database backup controlfile to ‘+DATA/ora11g/backup/control01.ctl‘;

alter database backup controlfile to trace;

alter database backup controlfile to trace as ‘/u02/app/trace123.trc’;

 

[oracle@pc2 trace]$ pwd

/u02/app/diag/rdbms/ora11g/ora11g/trace

[oracle@pc2 trace]$ ls -tl  查看时间最近的trace文件(ora11g_ora_*.trc),其中有创建控制文件的全部命令

total 968

-rw-r----- 1 oracle asmadmin 20320 Dec 19 10:31 ora11g_mmon_3942.trc

-rw-r----- 1 oracle asmadmin  2198 Dec 19 10:31 ora11g_mmon_3942.trm

-rw-r----- 1 oracle asmadmin 48189 Dec 19 10:18 alert_ora11g.log

-rw-r----- 1 oracle asmadmin  6959 Dec 19 10:18 ora11g_ora_31212.trc

-rw-r----- 1 oracle asmadmin   194 Dec 19 10:18 ora11g_ora_31212.trm

 

SYS@ora11g>startup

ORACLE instance started.

Total System Global Area  830930944 bytes

Fixed Size                  2231048 bytes

Variable Size             629146872 bytes

Database Buffers          192937984 bytes

Redo Buffers                6615040 bytes

ORA-00205: error in identifying control file, check alert log for more info

 

cp +DATA/ora11g/backup/control01.ctl +DATA/ora11g/controlfile/control01.ctl

 

alter system set control_files=‘+DATA/ora11g/controlfile/control01.ctl‘ scope=spfile;

 

SYS@ora11g>alter database mount;

ERROR at line 1:

ORA-00205: error in identifying control file, check alert log for more info

 

SYS@ora11g>shutdown immediate

ORA-01507: database not mounted

ORACLE instance shut down.

 

SYS@ora11g>startup mount

ORACLE instance started.

Total System Global Area  830930944 bytes

Fixed Size                  2231048 bytes

Variable Size             629146872 bytes

Database Buffers          192937984 bytes

Redo Buffers                6615040 bytes

Database mounted.

 

SYS@ora11g>select group#,status from v$log;

    GROUP# STATUS

---------- ----------------

         1 INACTIVE

         3 INACTIVE

         2 CURRENT

 

SYS@ora11g>select group#,member from v$logfile;

    GROUP# MEMBER

---------- --------------------------------------------------

         3 +DATA/ora11g/onlinelog/group_3.266.833721683

         3 +DATA/ora11g/onlinelog/group_3.267.833721685

         2 +DATA/ora11g/onlinelog/group_2.264.833721681

         2 +DATA/ora11g/onlinelog/group_2.265.833721683

         1 +DATA/ora11g/onlinelog/group_1.262.833721677

         1 +DATA/ora11g/onlinelog/group_1.263.833721679

 

SYS@ora11g>select group#,thread#,sequence# from v$archive;

 

SYS@ora11g>recover database using backup controlfile until cancel;

ORA-00279: change 1104788 generated at 12/11/2013 13:27:34 needed for thread 1

ORA-00289: suggestion : +DATA

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

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

+DATA/ora11g/onlinelog/group_2.264.833721681

Log applied.

Media recovery complete.

 

SYS@ora11g>recover database using backup controlfile until cancel;

ORA-00279: change 1105381 generated at 12/19/2013 11:07:09 needed for thread 1

ORA-00289: suggestion : +DATA

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

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

+DATA/ora11g/onlinelog/group_2.265.833721683

Log applied.

Media recovery complete.

 

SYS@ora11g>alter database open resetlogs;

Database altered.

利用备份的控制文件恢复