Thursday, February 24, 2011

Restoring whole database after deleting a datafile

do a full backup

Starting backup at 24-FEB-11
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=17 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=17 RECID=19 STAMP=743104301
input archived log thread=1 sequence=21 RECID=20 STAMP=743155273
input archived log thread=1 sequence=22 RECID=21 STAMP=743911539
input archived log thread=1 sequence=23 RECID=22 STAMP=743913643
input archived log thread=1 sequence=24 RECID=23 STAMP=743929228
input archived log thread=1 sequence=25 RECID=24 STAMP=743965101
input archived log thread=1 sequence=26 RECID=25 STAMP=743965102
channel ORA_DISK_1: starting piece 1 at 24-FEB-11
channel ORA_DISK_1: finished piece 1 at 24-FEB-11
piece handle=/data/stage/toronto/backup/0cm5g0dg_1_1
tag=TAG20110224T165824 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/arch/toronto/1_17_742858742.dbf RECID=19 STAMP=743104301
archived log file name=/arch/toronto/1_21_742858742.dbf RECID=20 STAMP=743155273
archived log file name=/arch/toronto/1_22_742858742.dbf RECID=21 STAMP=743911539
archived log file name=/arch/toronto/1_23_742858742.dbf RECID=22 STAMP=743913643
archived log file name=/arch/toronto/1_24_742858742.dbf RECID=23 STAMP=743929228
archived log file name=/arch/toronto/1_25_742858742.dbf RECID=24 STAMP=743965101
archived log file name=/arch/toronto/1_26_742858742.dbf RECID=25 STAMP=743965102
Finished backup at 24-FEB-11

Starting backup at 24-FEB-11
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=/data/toronto/toronto/system01.dbf
input datafile file number=00002 name=/data/toronto/toronto/sysaux01.dbf
input datafile file number=00003 name=/data/toronto/toronto/undotbs01.dbf
input datafile file number=00005 name=/data/toronto/toronto/toronto01.dbf
input datafile file number=00004 name=/data/toronto/toronto/users01.dbf
channel ORA_DISK_1: starting piece 1 at 24-FEB-11
channel ORA_DISK_1: finished piece 1 at 24-FEB-11
piece handle=/data/stage/toronto/backup/0dm5g0e0_1_1
tag=TAG20110224T165840 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:47
Finished backup at 24-FEB-11

Starting backup at 24-FEB-11
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=27 RECID=26 STAMP=743965167
channel ORA_DISK_1: starting piece 1 at 24-FEB-11
channel ORA_DISK_1: finished piece 1 at 24-FEB-11
piece handle=/data/stage/toronto/backup/0em5g0fh_1_1
tag=TAG20110224T165928 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/arch/toronto/1_27_742858742.dbf RECID=26 STAMP=743965167
Finished backup at 24-FEB-11

Starting Control File and SPFILE Autobackup at 24-FEB-11
piece handle=/u01/app/oracle/flash_recovery_area/TORONTO/autobackup/2011_02_24/o1_mf_s_743965170_6pfo63kg_.bkp
comment=NONE
Finished Control File and SPFILE Autobackup at 24-FEB-11

... exit RMAN

remove the datafile toronto01.dbf

shutdown and startup mount toronto

start RMAN again

restore the whole database

Starting restore at 24-FEB-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to
/data/toronto/toronto/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to
/data/toronto/toronto/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00003 to
/data/toronto/toronto/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to
/data/toronto/toronto/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to
/data/toronto/toronto/toronto01.dbf
channel ORA_DISK_1: reading from backup piece
/data/stage/toronto/backup/0dm5g0e0_1_1
channel ORA_DISK_1: piece
handle=/data/stage/toronto/backup/0dm5g0e0_1_1 tag=TAG20110224T165840
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 24-FEB-11

... exit RMAN

shutdown and start toronto

check the datafile status, it should be offline

bring it online

verify you can select data from that datafile, in my case, it is table toronto

No comments:

Post a Comment