Heim  >  Artikel  >  Datenbank  >  利用dbms_backup_restore恢复数据库

利用dbms_backup_restore恢复数据库

WBOY
WBOYOriginal
2016-06-07 17:35:161056Durchsuche

场景:Oracle数据库的存储坏了,数据文件和控制文件全部丢失,只有数据文件的备份集,且备份集中无控制文件。(当然了,oracle10

测试环境: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_recovery_area/ORCL2/backupset/2013_09_22/o1_mf_annnn_TAG20130922T000600_93vk29cw_.bkp tag=TAG20130922T000600 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-13
 
Starting backup at 22-SEP-13
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/oradata/orcl2/system01.dbf
input datafile file number=00002 name=/oradata/orcl2/undotbs01.dbf
input datafile file number=00003 name=/oradata/orcl2/sysaux01.dbf
input datafile file number=00005 name=/oradata/orcl2/seven.dbf
input datafile file number=00004 name=/oradata/orcl2/users01.dbf
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/backup/orcl_04okeoqa_1_1 tag=TAG20130922T000738 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:05
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 22-SEP-13
channel ORA_DISK_1: finished piece 1 at 22-SEP-13
piece handle=/backup/orcl_05okeou7_1_1 tag=TAG20130922T000738 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-13
 
Starting backup at 22-SEP-13
current log archived
using channel ORA_DISK_1
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=2 RECID=24 STAMP=826762186
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_TAG20130922T000946_93vk6b6o_.bkp tag=TAG20130922T000946 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-13
 
RMAN>
查看备份文件:
[oracle@DBA2 backup]$ ls
-rw-r-----  1 oracle oinstall 1182695424 Sep 22 00:09 orcl_04okeoqa_1_1
-rw-r-----  1 oracle oinstall  10158080 Sep 22 00:09 orcl_05okeou7_1_1


orcl_04okeoqa_1_1是数据文件的备份集,orcl_05okeou7_1_1是控制文件和参数文件的备份集。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn