Case 6:
--Recover data with image (mirrored backup)
1) Establish a mirrored backup
rman> Delete backup;
rman> list backup;
rman> Backup as Copy datafile 2 format '/disk1/rman/prod/users_%s.bak ';
rman> list copy of DataFile 2;
List of datafile copies
Key File S Completion time CKP SCN CKP time Name
------- ---- - --------------- ---------- --------------- ----
2 A 18-aug-11 1383523 18-aug-11/disk1/rman/prod/users_38.bak
2) test environment
07:59:17 sql> Conn Scott/tiger
Connected.
07:59:20 sql>
07:59:20 sql> SELECT * from EMP1;
EMPNO ename JOB MGR hiredate SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH Clerk 7902 17-dec-80 800 20
7499 ALLEN salesman 7698 20-feb-81 1600 300 30
07:59:27 sql> INSERT INTO the EMP1 select * from EMP1;
2 rows created.
07:59:46 sql> SELECT * from EMP1;
EMPNO ename JOB MGR hiredate SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH Clerk 7902 17-dec-80 800 20
7499 ALLEN salesman 7698 20-feb-81 1600 300 30
7369 SMITH Clerk 7902 17-dec-80 800 20
7499 ALLEN salesman 7698 20-feb-81 1600 300 30
07:59:48 sql> commit;
Commit complete.
07:59:49 sql> Conn/as SYSDBA
Connected.
07:59:52 sql>
07:59:52 sql> shutdown Abort
ORACLE instance shut down.
[Oracle@work ~]$ rm/u01/app/oracle/oradata/prod/users01.dbf
3) Start the database
07:59:56 sql> Startup
ORACLE instance started.
Total System Global area 314572800 bytes
Fixed Size 1219184 bytes
Variable Size 79693200 bytes
Database buffers 230686720 bytes
Redo buffers 2973696 bytes
Database mounted.
Ora-01157:cannot identify/lock data file 2-see DBWR trace file
Ora-01110:data file 2: '/U01/APP/ORACLE/ORADATA/PROD/USERS01.DBF '
08:00:37 sql> Select File#,error from V$recover_file;