oracle 备份到固定目录,控制文件恢复(四) 备份控制文件到指定目录

备份控制文件到指定目录,利用备份控制文件进行恢复

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

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

Database altered.

查看文件

SYS@PROD1>! ls /home/oracle/files/control_bak.ctl

/home/oracle/files/control_bak.ctl

删除所有控制文件

[oracle@host01 PROD1]$ ls control0*

control01.ctl  control03.ctl  control03.ctl.bak

[oracle@host01 PROD1]$ rm control01.ctl control03.ctl

[oracle@host01 PROD1]$ pwd

/u01/app/oracle/fast_recovery_area/PROD1

[oracle@host01 PROD1]$ rm control02.ctl

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

SYS@PROD1>shutdown immediate;

Database closed.

ORA-00210: cannot open the specified control file

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

ORA-27041: unable to open file

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

Additional information: 3

SYS@PROD1>shutdown abort;

ORACLE instance shut down.

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

[oracle@host01 files]$ cp control_bak.ctl /u01/app/oracle/oradata/PROD1/control01.ctl

[oracle@host01 files]$ cp control_bak.ctl /u01/app/oracle/oradata/PROD1/control03.ctl

[oracle@host01 files]$ cp control_bak.ctl /u01/app/oracle/fast_recovery_area/PROD1/control02.ctl

5.启动到mount

SYS@PROD1>startup mount;

ORACLE instance started.

Total System Global Area  835104768 bytes

Fixed Size                  2257840 bytes

Variable Size             520096848 bytes

Database Buffers          310378496 bytes

Redo Buffers                2371584 bytes

Database mounted.

6.尝试打开数据库,提示需要open resetlogs

SYS@PROD1>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@PROD1>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/PROD1/system01.dbf'

执行介质恢复

RMAN> recover database;

Starting recover at 16-DEC-16

Starting implicit crosscheck backup at 16-DEC-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=20 device type=DISK

Crosschecked 5 objects

Finished implicit crosscheck backup at 16-DEC-16

Starting implicit crosscheck copy at 16-DEC-16

using channel ORA_DISK_1

Finished implicit crosscheck copy at 16-DEC-16

searching for all files in the recovery area

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /u01/app/oracle/fast_recovery_area/PROD1/autobackup/2016_11_18/o1_mf_s_928252815_d2xf8zpf_.bkp

File Name: /u01/app/oracle/fast_recovery_area/PROD1/autobackup/2016_12_16/o1_mf_s_930743672_d56scr5w_.bkp

using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/oradata/PROD1/redo01.log

archived log file name=/u01/app/oracle/oradata/PROD1/redo01.log thread=1 sequence=1

media recovery complete, elapsed time: 00:00:00

Finished recover at 16-DEC-16

打开数据库

SYS@PROD1>alter database open;

alter database open

*

ERROR at line 1:

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

SYS@PROD1>alter database open resetlogs;

Database altered.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值