oracle 11g 从rman全备中恢复控制文件,RMAN备份恢复(控制文件)

控制文件怎么做备份假如删除了一个控制文件,只需要将没有删除的控制文件拷贝一份,然后重命名就可以恢复了;

备份控制文件的语句:

RMAN> list backup of controlfile;----查看备份文件的语句;没有开启自动备份,却有备份,这样的备份我们叫隐式备份;

RMAN> show all;

RMAN configuration

parameters for database with db_unique_name ENMOEDU are:

CONFIGURE

RETENTION POLICY TO REDUNDANCY 1; # default

CONFIGURE BACKUP

OPTIMIZATION OFF; # default

CONFIGURE DEFAULT

DEVICE TYPE TO DISK; # default

CONFIGURE CONTROLFILE AUTOBACKUP OFF; #

default-----------自动备份控制文件是关闭的;

RMAN> CONFIGURE CONTROLFILE

AUTOBACKUP ON;------------------开启自动备份控制文件

new RMAN

configuration parameters:

CONFIGURE

CONTROLFILE AUTOBACKUP ON;

new RMAN

configuration parameters are successfully stored

RMAN> BACKUP TABLESPACE EXAMPLE;

Starting backup at

13-MAR-16

allocated channel:

ORA_DISK_1

channel

ORA_DISK_1: SID=19 device type=DISK

channel

ORA_DISK_1: starting full datafile backup set

channel

ORA_DISK_1: specifying datafile(s) in backup set

input datafile

file number=00005 name=/u01/app/oracle/oradata/enmoedu/example01.dbf

channel

ORA_DISK_1: starting piece 1 at 13-MAR-16

channel

ORA_DISK_1: finished piece 1 at 13-MAR-16

piece

handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2016_03_13/o1_mf_nnndf_TAG20160313T162551_cgb90hfj_.bkp

tag=TAG20160313T162551 comment=NONE

channel

ORA_DISK_1: backup set complete, elapsed time: 00:00:03

Finished backup at

13-MAR-16

Starting Control

File and SPFILE Autobackup at 13-MAR-16

piece

handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2016_03_13/o1_mf_s_906395154_cgb90lph_.bkp

comment=NONE

Finished Control

File and SPFILE Autobackup at 13-MAR-16

RMAN> list backup of controlfile;

List of Backup

Sets

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

BS KeyType LV SizeDevice Type Elapsed Time Completion

Time

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

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

4Full9.36MDISK00:00:0013-MAR-16

BP Key: 4Status: AVAILABLECompressed: NOTag: TAG20160313T162554

Piece Name:

/u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2016_03_13/o1_mf_s_906395154_cgb90lph_.bkp---------因为是开启了自动备份

Control File Included: Ckp SCN:

1046493Ckp time: 13-MAR-16

RMAN> backup current controlfile;-------------手动备份控制文件

Starting backup at

13-MAR-16

using target

database control file instead of recovery catalog

allocated channel:

ORA_DISK_1

channel

ORA_DISK_1: SID=21 device type=DISK

channel

ORA_DISK_1: starting full datafile backup set

channel

ORA_DISK_1: specifying datafile(s) in backup set

including current

control file in backup set

channel

ORA_DISK_1: starting piece 1 at 13-MAR-16

channel

ORA_DISK_1: finished piece 1 at 13-MAR-16

piece

handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2016_03_13/o1_mf_ncnnf_TAG20160313T163100_cgb9b5n3_.bkp

tag=TAG20160313T163100 comment=NONE

channel

ORA_DISK_1: backup set complete, elapsed time: 00:00:01

Finished backup at

13-MAR-16

现在我们删除控制文件做一下恢复控制文件的实验;

[oracle@enmoedu

enmoedu]$ ls

control01.ctlredo01.logredo03.logsystem01.dbfundotbs01.dbf

example01.dbfredo02.logsysaux01.dbftemp01.dbfusers01.dbf

[oracle@enmoedu

enmoedu]$ rm control01.ctl

[oracle@enmoedu

enmoedu]$ ls

example01.dbfredo02.logsysaux01.dbftemp01.dbfusers01.dbf

redo01.logredo03.logsystem01.dbfundotbs01.dbf

SQL> startup

ORACLE instance

started.

Total System

Global Area830930944 bytes

Fixed

Size                2257800 bytes

Variable

Size                536874104 bytes

Database

Buffers        285212672 bytes

Redo

Buffers                6586368 bytes

ORA-00205: error in identifying control

file, check alert log for more info----------------控制文件丢失了,所以数据库是启动不了了;那么现在就恢复控制文件;

RMAN> restore controlfile;

Starting restore

at 13-MAR-16

using target

database control file instead of recovery catalog

allocated channel:

ORA_DISK_1

channel

ORA_DISK_1: SID=10 device type=DISK

RMAN-00571:

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

RMAN-00569:

=============== ERROR MESSAGE STACK FOLLOWS ===============

RMAN-00571:

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

RMAN-03002:

failure of restore command at 03/13/2016 20:10:38

RMAN-06563: control file or SPFILE must

be restored using FROM AUTOBACKUP-------因为我手动备份了一份控制文件,又自动备份了一份控制文件,所以他不知道去哪找,所以必须得指定一个位置;

RMAN> restore controlfilefrom autobackup;

Starting restore

at 13-MAR-16

using channel

ORA_DISK_1

recovery area

destination: /u01/app/oracle/fast_recovery_area

database name (or

database unique name) used for search: ENMOEDU

channel

ORA_DISK_1: AUTOBACKUP

/u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2016_03_13/o1_mf_s_906408140_cgbow726_.bkp

found in the recovery area

AUTOBACKUP search

with format "%F" not attempted because DBID was not set

channel

ORA_DISK_1: restoring control file from AUTOBACKUP

/u01/app/oracle/fast_recovery_area/ENMOEDU/autobackup/2016_03_13/o1_mf_s_906408140_cgbow726_.bkp

channel

ORA_DISK_1: control file restore from AUTOBACKUP complete

output file

name=/u01/app/oracle/oradata/enmoedu/control01.ctl

output file

name=/u01/app/oracle/fast_recovery_area/enmoedu/control02.ctl

Finished restore

at 13-MAR-16

现在我们看数据库能不能启动、???SQL> shutdown immediate

ORA-01507:

database not mounted

ORACLE instance

shut down.

SQL> startup

ORACLE instance

started.

Total System

Global Area830930944 bytes

Fixed

Size                2257800 bytes

Variable

Size                536874104 bytes

Database

Buffers        285212672 bytes

Redo

Buffers                6586368 bytes

Database mounted.

ORA-01589: must use RESETLOGS or

NORESETLOGS option for database open----------此时就得做一次不完全恢复

SQL> alter database open resetlogs;

Database altered.

SQL> startup

ORACLE instance

started.

Total System

Global Area830930944 bytes

Fixed

Size                2257800 bytes

Variable

Size                536874104 bytes

Database

Buffers        285212672 bytes

Redo

Buffers                6586368 bytes

Database mounted.

Database opened.-------------数据库成功启动

看看控制文件有没有回来????

[oracle@enmoedu

enmoedu]$ ls

control01.ctlexample01.dbfredo02.logsysaux01.dbftemp01.dbfusers01.dbf

control02.ctlredo01.logredo03.logsystem01.dbfundotbs01.dbf

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值