1)Take a full backup;
4)delete alls datafile
at step 5 restore will recreate the datafile in conjunction with RMAN and controlfile.Lets see
RMAN> backup database; Starting backup at 12-AUG-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=140 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=00001 name=/u01/app/oracle/oradata/mmi/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/mmi/sysaux01.dbf input datafile file number=00003 name=/u01/app/oracle/oradata/mmi/undotbs01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/mmi/users01.dbf channel ORA_DISK_1: starting piece 1 at 12-AUG-09 channel ORA_DISK_1: finished piece 1 at 12-AUG-09 piece handle=/u01/app/oracle/flash_recovery_area/MMI/backupset/2009_08_12/o1_mf_nnndf_TAG20090812T145015_58542s82_.bkp tag=TAG20090812T145015 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45 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 12-AUG-09 channel ORA_DISK_1: finished piece 1 at 12-AUG-09 piece handle=/u01/app/oracle/flash_recovery_area/MMI/backupset/2009_08_12/o1_mf_ncsnf_TAG20090812T145015_585446c6_.bkp tag=TAG20090812T145015 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 12-AUG-09 SQL> create tablespace mytablespace datafile '/u01/app/oracle/oradata/mmi/mydatafile.dbf' size 10M 2 / Tablespace created. SQL> shutdown immediate Database closed. Database dismounted. ORACLE instance shut down.Delete alls datafile using OS
RMAN> connect target sys/sys connected to target database (not started) RMAN> startup mount Oracle instance started database mounted Total System Global Area 1620115456 bytes Fixed Size 2144864 bytes Variable Size 922748320 bytes Database Buffers 687865856 bytes Redo Buffers 7356416 bytes RMAN> restore database; Starting restore at 12-AUG-09 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=154 device type=DISK creating datafile file number=5 name=/u01/app/oracle/oradata/mmi/mydatafile.dbf 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 /u01/app/oracle/oradata/mmi/system01.dbf channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/mmi/sysaux01.dbf channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/mmi/undotbs01.dbf channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/mmi/users01.dbf channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/MMI/backupset/2009_08_12/o1_mf_nnndf_TAG20090812T145015_58542s82_.bkp channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/MMI/backupset/2009_08_12/o1_mf_nnndf_TAG20090812T145015_58542s82_.bkp tag=TAG20090812T145015 channel ORA_DISK_1: restored backup piece 1 channel ORA_DISK_1: restore complete, elapsed time: 00:00:45 Finished restore at 12-AUG-09Stop here dont make recovery here go to /u01/app/oracle/oradata/mmi you will see there is datafile named mydatafile.dbf will be created.The control file knows about the datafile even though datafile is not backed up, if controlfile knows about datafile then restore creates the datafile in the original location with RMAN tool. During user managed restore , controlfile will not play this role with yours OS copying command and you will encounter following error during recovery like.. ORA-01157: cannot identify/lock data file 6 - see DBWR trace file ORA-01110: data file 6: '/u01/app/oracle/oradata/mmi/mydatafile.dbf' the reason for above error is that you are doing restore and recovery by using user managed backup and recovery,control file knows about the data file even though data file is not backed up, if control file knows about data file then restore creates the data file in the original location in corrdination with RMAN but with user manged restore and recovery controlfile not able to coordinate with OS utility copy and paste. In short during user managed restore , control file will not play this role with yours OS copying command .It is RMAN which coordinate with control file.