The Archiving mode of the rman experiment involves backup, normal shutdown, and recovery of lost data files. 1. Create a backup [SQL] RMAN> backup database plus archivelog; [SQL] hr @ ORCL> create table tt (name varchar2 (20); Table created. hr @ ORCL> insert into tt values ('test1'); 1 row created. hr @ ORCL> insert into tt values ('test2'); 1 row created. hr @ ORCL> insert into tt values ('test3'); 1 row created. hr @ ORCL> commit; Commit complete. hr @ ORCL> select * from tt; NAME- ----------------- Test1 test2 test3 www.2cto.com 3 simulate data file loss [SQL] sys @ ORCL> select default_tablespace from dba_users where username = 'hr'; DEFAULT_TABLESPACE -------- users sys @ ORCL> select dt. tablespace_name, 2 file_id, 3 file_name 4 from dba_tablespaces dt, dba_data_files dd 5 where dt. tablespace_name = dd. tablespace_name; TABLESPA FILE_ID FILE_NAME ---------------------------------------------- -------------------------------------- USERS 4/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_8050fkdh _. dbf SYSAUX 3/u01/app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_8050fk3w _. dbf UNDOTBS1 2/u01/app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_8050fkc6 _. dbf SYSTEM 1/u01/app/oracle/oradata/ORCL/datafile/o1_mf_system_8050fk2z _. dbf EXAMPLE 5/u01/app/oracle/oradata/ORCL/datafile/o1_mf_examp Le_8050jhm7 _. dbf UNDOTBS2 6/u01/app/oracle/oradata/ORCL/datafile/undotbsthi. dbf RMANTBS 7/u01/app/oracle/flash_recovery_area/ORCL/rmantbs01.dbf www.2cto.com sys @ ORCL> shutdown immediate; Database closed. database dismounted. ORACLE instance shut down. sys @ ORCL> host rm-rf/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_8050fkdh _. dbf; restart the database: sys @ ORCL> startup ORACLE instance started. total S Ystem Global Area 419430400 bytes Fixed Size 1219760 bytes Variable Size 121635664 bytes Database Buffers 293601280 bytes Redo Buffers 2973696 bytes Database mounted. ORA-01157: cannot identify/lock data file 4-see DBWR trace file ORA-01110: data file 4: '/u01/app/oracle/oradata/ORCL/datafile/o1_mf_users_8050fkdh _. dbf' www.2cto.com 4 Use rman to repair and restore [SQL] [oracle @ localhost ~] $ Rman target/Recovery Manager: Release 10.2.0.1.0-Production on Mon Aug 6 22:54:36 2012 Copyright (c) 1982,200 5, Oracle. all rights reserved. connected to target database: ORCL (DBID = 1316499950, not open) RMAN> restore datafile 4; Starting restore at 06-AUG-12 using target database control file instead of recovery catalog allocated channel: ORA_DISK_1 channel ORA_DISK_1: sid = 155 devtype = DISK Channel ORA_DISK_1: starting datafile backupset restore channel ORA_DISK_1: specifying datafile (s) to restore from backup set restoring datafile 00004 to/u01/app/oracle/oradata/ORCL/datafile/empty _. dbf channel ORA_DISK_1: reading from backup piece/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_08_06/o1_mf_nnndf_TAG20120806T223510_81zojyz5 _. bkp channel ORA_DISK_1: restored Backup piece 1 piece handle =/u01/app/oracle/flash_recovery_area/ORCL/backupset/2012_08_06/o1_mf_nnndf_TAG20120806T223510_81zojyz5 _. bkp tag = primary channel ORA_DISK_1: restore complete, elapsed time: 00:00:03 Finished restore at 06-AUG-12 RMAN> recover datafile 4; Starting recover at least using channel ORA_DISK_1 restart starting media recovery complete, elapsed Time: 00:00:03 Finished recover at 06-AUG-12 RMAN> alter database open; database opened 5 query data [SQL] hr @ ORCL> select * from tt; NAME ---------------- test1 test2 test3 data all back, recovery successful! Author: linwaterbin