【备份恢复】利用 备份控制文件到指定目录下的控制文件 恢复控制文件

 备份控制文件指定目录下控制文件恢复

1.备份当前控制文件到指定目录

SYS@ORA11GR2>alter database backup controlfile to '/home/oracle/control_bak.ctl';

 

Database altered.

——验证:

SYS@ORA11GR2>!ls /home/oracle/

control_bak.ctl  oradata

 

2.删除所有控制文件

SYS@ORA11GR2>show parameter control_files

 

NAME                                 TYPE        VALUE

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

control_files                        string      /u01/app/oracle/oradata/ORA11G

                                                 R2/control01.ctl, /u01/app/ora

                                                 cle/oradata/ORA11GR2/control02

                                                 .ctl

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl

/u01/app/oracle/oradata/ORA11GR2/control01.ctl  /u01/app/oracle/oradata/ORA11GR2/control02.ctl

 

SYS@ORA11GR2>!rm /u01/app/oracle/oradata/ORA11GR2/*.ctl

 

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl

ls: /u01/app/oracle/oradata/ORA11GR2/*.ctl: No such file or directory

 

3.此时控制文件已丢失,采用abort方式关闭数据库

SYS@ORA11GR2>shutdown immediate;

Database closed.

ORA-00210: cannot open the specified control file

ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'

ORA-27041: unable to open file

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

Additional information: 3

 

SYS@ORA11GR2>shutdown abort;

ORACLE instance shut down.


4.将备份的控制文件复制到控制文件原目录

SYS@ORA11GR2>!cp /home/oracle/control_bak.ctl /u01/app/oracle/oradata/ORA11GR2/control02.ctl

 

SYS@ORA11GR2>!cp /home/oracle/control_bak.ctl /u01/app/oracle/oradata/ORA11GR2/control01.ctl

 

——验证:

SYS@ORA11GR2>!ls /u01/app/oracle/oradata/ORA11GR2/*.ctl

/u01/app/oracle/oradata/ORA11GR2/control01.ctl  /u01/app/oracle/oradata/ORA11GR2/control02.ctl

 

5.数据库启动到mount模式

SYS@ORA11GR2>startup mount;

ORACLE instance started.

 

Total System Global Area  830930944 bytes

Fixed Size                  2257800 bytes

Variable Size             503319672 bytes

Database Buffers          322961408 bytes

Redo Buffers                2392064 bytes

Database mounted.


6.尝试open数据库,提示使用RESETLOGS or NORESETLOGS选项

SYS@ORA11GR2>alter database open;  

alter database open

*

ERROR at line 1:

ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

 

7.使用resetlogs选项再次尝试打开数据库,提示需要恢复1号数据文件

SYS@ORA11GR2>alter database open resetlogs;

alter database open resetlogs

*

ERROR at line 1:

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'

 

8.我们直接recover database,提示使用BACKUP CONTROLFILE选项

SYS@ORA11GR2>recover database;(利用旧版控制文件信息去找备份时数据文件,将其重置)

ORA-00283: recovery session canceled due to errors

ORA-01610: recovery using the BACKUP CONTROLFILE option must be done

 

9.再次恢复数据库,如果采用默认方式(直接“回车”)那么提示无法获取文件状态,恢复失败

SYS@ORA11GR2>recover database using backup controlfile until cancel;  (利用旧版控制文件信息去找备份时数据文件,将其重置)

ORA-00279: change 1233421 generated at 10/02/2016 15:57:40 needed for thread 1

ORA-00289: suggestion :

/u01/app/FRA/ORA11GR2/archivelog/2016_10_02/o1_mf_1_2_%u_.arc

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

 

Specify log: {=suggested | filename | AUTO | CANCEL}

 

ORA-00308: cannot open archived log

'/u01/app/FRA/ORA11GR2/archivelog/2016_10_02/o1_mf_1_2_%u_.arc'

ORA-27037: unable to obtain file status

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

Additional information: 3

 

ORA-01547: warning: RECOVER succeeded but OPEN RESETLOGS would get error below

ORA-01152: file 1 was not restored from a sufficiently old backup

ORA-01110: data file 1: '/u01/app/oracle/oradata/ORA11GR2/system01.dbf'

——解决: 

10.指定当前redo路径进行恢复,成功

SYS@ORA11GR2>select group#,status from v$log where status='CURRENT';

 

    GROUP# STATUS

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

         2 CURRENT

 

SYS@ORA11GR2>select group#,member from v$logfile where group#=2;

 

    GROUP#                        MEMBER

 

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

         2                 /u01/app/oracle/oradata/ORA11GR2/redo02.log

 

SYS@ORA11GR2>recover database using backup controlfile until cancel;
   应用当前正在用的日志去恢复数据库                 

ORA-00279: change 1233421 generated at 10/02/2016 15:57:40 needed for thread 1

ORA-00289: suggestion :

/u01/app/FRA/ORA11GR2/archivelog/2016_10_02/o1_mf_1_2_%u_.arc

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

 

 

Specify log: {=suggested | filename | AUTO | CANCEL}

/u01/app/oracle/oradata/ORA11GR2/redo02.log

Log applied.

Media recovery complete.

——再次以resetlogs方式启动数据库

SYS@ORA11GR2>alter database open resetlogs;

 

Database altered.

SYS@ORA11GR2>select status from v$instance;

 

STATUS

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

OPEN

完成!!!!!!!!!!!!!!!!

 


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/31397003/viewspace-2126545/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/31397003/viewspace-2126545/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值