[置顶] [实验-视频过程]RMAN备份和恢复

RMAN备份和恢复

1、进入rman

 [oracle@el48 orcl]$ rman target /

2、查看原来的备份

 RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
===================


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    1.12G      DISK        00:00:14     19-OCT-15      
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20151019T175040
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_10_19/o1_mf_nnndf_TAG20151019T175040_c29h7k27_.bkp
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 3548842    19-OCT-15 /u01/app/oracle/oradata/orcl/system01.dbf
  2       Full 3548842    19-OCT-15 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  3       Full 3548842    19-OCT-15 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  4       Full 3548842    19-OCT-15 /u01/app/oracle/oradata/orcl/users01.dbf
  5       Full 3548842    19-OCT-15 /u01/app/oracle/oradata/orcl/example01.dbf
  6       Full 3548842    19-OCT-15 

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    9.67M      DISK        00:00:01     19-OCT-15      
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20151019T175040
        Piece Name: /u01/app/oracle/flash_recovery_area/ORCL/backupset/2015_10_19/o1_mf_ncsnf_TAG20151019T175040_c29h818k_.bkp
  SPFILE Included: Modification time: 19-OCT-15
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 3548854      Ckp time: 19-OCT-15

3、为了实验干净,删除原来备份,重新建立备份

RMAN> delete backup;

删除文件目录
[oracle@el48 orcl]$ cd /u01/app/oracle/flash_recovery_area/ORCL/backupset/

[oracle@el48 backupset]$ rm -rf *

4、重新备份数据库

backup database;
5、切换日志
sql  'alter system archive log current';

6模拟事故 、删除所有数据文件

cd /u01/app/oracle/oradata/orcl
rm *.dbf

7、恢复

[oracle@el48 orcl]$ rman target /
    RMAN> startup mount;
    RMAN> restore database;
    RMAN> recover database;
    RMAN> alter database open;

视频:http://v.youku.com/v_show/id_XMTM2MzkyOTQ2NA==.html?from=y1.9-4

你可能感兴趣的:(oracle,数据库,备份,rman)