日期:2014-05-16  浏览次数:20375 次

利用dbms_backup_restore恢复数据库

测试环境:OEL+11.2.0.1

实例名:orcl2
DBID:1336959433
场景:Oracle数据库的存储坏了,数据文件和控制文件全部丢失,只有数据文件的备份集,且备份集中无控制文件。(当然了,oracle10g和11g中是自动备份数据文件的)

备份数据库

首先将数据库进行全备

[oracle@DBA2 backup]$ rman target /
 
Recovery Manager: Release 11.2.0.1.0 - Production on Sun Sep 22 00:05:52 2013
 
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
 
connected to target database: ORCL2 (DBID=1336959433)
 
RMAN> backup database format '/backup/orcl_%U' plus archivelog;
 
 
Starting backup at 22-SEP-13
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=38 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=16 STAMP=826760691
input archived log thread=1 sequence=2 RECID=9 STAMP=826760691
input archived log thread=1 sequence=3 RECID=8 STAMP=826760691
input archived log thread=1 sequence=4 RECID=10 STAMP=826760691
input archived log thread=1 sequence=5 RECID=11 STAMP=826760691
input archived log thread=1 sequence=6 RECID=17 STAMP=826760691
input archived log thread=1 sequence=7 RECID=19 STAMP=826760691
input archived log thread=1 sequence=8 RECID=18 STAMP=826760691
input archived log thread=1 sequence=9 RECID=13 STAMP=826760691
input archived log thread=1 sequence=10 RECID=12 STAMP=826760691
input archived log thread=1 sequence=11 RECID=15 STAMP=826760691
input archived log thread=1 sequence=12 RECID=14 STAMP=826760691
input archived log thread=1 sequence=13 RECID=21 STAMP=826760691
input archived log thread=1 sequence=14 RECID=22 STAMP=826760691
input archived log thread=1 sequence=15 RECID=20 STAMP=826760691
input archived log thread=1 sequence=16 RECID=7 STAMP=826760691
input archived log thread=1 sequence=17 RECID=4 STAMP=826760691
input archived log thread=1 sequence=18 RECID=5 STAMP=826760691
input archived log thread=1 sequence=19 RECID=1 STAMP=826760691
input archived log thread=1 sequence=20 RECID=2 STAMP=826760691
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u/oracle/flash_recovery_area/ORCL2/backupset/2013_09_22/o1_mf_annnn_TAG20130922T000600_93vjz8nh_.bkp tag=TAG20130922T000600 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=6 STAMP=826760691
input archived log thread=1 sequence=2 RECID=3 STAMP=826760691
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u/oracle/flash_recovery_area/ORCL2/backupset/2013_09_22/o1_mf_annnn_TAG20130922T000600_93vk288l_.bkp tag=TAG20130922T000600 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=1 RECID=23 STAMP=826761959
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/u/oracle/flash_recove