案例7:
--利用增量備份進行恢複
1)建立增量備份
-------利用image 備份作為增量備份的0 級備份
RMAN> copy datafile 2 to '/disk1/rman/prod/users_%s.bak';
2)建立2 級差異備份
--------測試環境
08:05:52 SQL> conn scott/tiger
Connected.
08:05:58 SQL>
08:05:58 SQL> insert into emp1 select * from emp1;
4 rows created.
08:06:00 SQL> /
8 rows created.
08:06:01 SQL> commit;
Commit complete.
08:06:03 SQL>
RMAN> backup incremental level 2 format '/disk1/rman/prod/users_2_%s.bak' datafile 2;
RMAN> list backup of datafile 2;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
37 Incr 2 528.00K DISK 00:00:00 18-AUG-11
BP Key: 37 Status: AVAILABLE Compressed: NO Tag: TAG20110818T080650
Piece Name: /disk1/rman/prod/users_2_42.bak
List of Datafiles in backup set 37
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 2 Incr 1404665 18-AUG-11 /u01/app/oracle/oradata/prod/users01.dbf
3)建立 2級差異備份
08:06:03 SQL> insert into emp1 select * from emp1;
16 rows created.
08:07:49 SQL> /
32 rows created.
08:07:51 SQL> commit;
Commit complete.
08:07:53 SQL>
RMAN> backup incremental level 2 format '/disk1/rman/prod/users_2_%s.bak' datafile 2;
4)建立累計增量備份
08:07:53 SQL> insert into emp1 select * from emp1;
64 rows created.
08:08:55 SQL> /
128 rows created.
08:08:55 SQL> commit;
Commit complete.
08:08:57 SQL>
RMAN> backup incremental level 1 cumulative format '/disk1/rman/prod/users_1cu_%s.bak' datafile 2;
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
41 Incr 1 528.00K DISK 00:00:00 18-AUG-11
BP Key: 41 Status: AVAILABLE Compressed: NO Tag: TAG20110818T080942
Piece Name: /disk1/rman/prod/users_1cu_46.bak
List of Datafiles in backup set 41
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
2 1 Incr 1404815 18-AUG-11 /u01/app/oracle/oradata/prod/users01.dbf
--------------恢複
1)測試環境
08:08:57 SQL> select count(*) from emp1;
COUNT(*)
----------
256
08:10:33 SQL> shutdown abort
[oracle@work ~]$ rm /u01/app/oracle/oradata/prod/users01.dbf
2)啟動資料庫
08:10:52 SQL> startup