1. | 创建数据库备份 创建完全数据库备份 启用快速增量备份 创建双重备份集 创建归档备份以用于长期保留 创建多部分备份 创建压缩备份 创建加密备份 报告和维护备份
|
2 | 创建整体数据库备份: RAMN>backup database plus archivelog;(归档日志文件副本,数据文件副本,控制文件,SPFILE) |
3 | 通过压缩未使用的空间备份801 |
4 | RMAN备份类型 RMAN 可创建多级增量备份,如下所示: ? 差异:是增量备份的默认类型,备份自上次增量备份(1 级或 0 级)以来更改过的所 有块 ? 累积:备份自上次 0 级备份以来更改过的所有块 示例 ? 要执行 0 级增量备份,请使用以下命令: RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE; ? 要执行差异增量备份,请使用以下命令: RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE; ? 要执行累积增量备份,请使用以下命令: RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
--------------------------------------------------------------------------------------------------------------------- 建立0级增量备份的全库备份: RMAN> backup incremental level=0 database;
Starting backup at 2016-01-16 11:44:37 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 0 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00003 name=/u01/app/oracle/oradata/ENMO11G/undotbs01.dbf input datafile file number=00001 name=/u01/app/oracle/oradata/ENMO11G/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/ENMO11G/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/ENMO11G/enmoedu01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/ENMO11G/enmoedubig.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/ENMO11G/users01.dbf channel ORA_DISK_1: starting piece 1 at 2016-01-16 11:44:37 channel ORA_DISK_1: finished piece 1 at 2016-01-16 11:46:12 piece handle=/u01/app/oracle/fast_recovery_area/ENMO11G/backupset/2016_01_16/o1_mf_nnnd0_TAG20160116T114437_c9mh55l6_.bkp tag=TAG20160116T114437 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:35 channel ORA_DISK_1: starting incremental level 0 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 2016-01-16 11:46:13 channel ORA_DISK_1: finished piece 1 at 2016-01-16 11:46:14 piece handle=/u01/app/oracle/fast_recovery_area/ENMO11G/backupset/2016_01_16/o1_mf_ncnn0_TAG20160116T114437_c9mh85pv_.bkp tag=TAG20160116T114437 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2016-01-16 11:46:14 --------------------------------------------------------------------------------------------------------------------------------------- 为数据文件user01.dbf建立增量级别1级备份 RMAN> backup incremental level=1 datafile 4;
Starting backup at 2016-01-16 11:48:59 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00004 name=/u01/app/oracle/oradata/ENMO11G/users01.dbf channel ORA_DISK_1: starting piece 1 at 2016-01-16 11:49:00 channel ORA_DISK_1: finished piece 1 at 2016-01-16 11:49:01 piece handle=/u01/app/oracle/fast_recovery_area/ENMO11G/backupset/2016_01_16/o1_mf_nnnd1_TAG20160116T114859_c9mhfd2l_.bkp tag=TAG20160116T114859 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01 Finished backup at 2016-01-16 11:49:01
------------------------------------------------------------------------------------------------------------------------------------------ 以cumulative 增量级别方式的创建数据库全库备份(累积备份) RMAN> backup incremental level=1 cumulative database;
Starting backup at 2016-01-16 11:51:06 using channel ORA_DISK_1 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00003 name=/u01/app/oracle/oradata/ENMO11G/undotbs01.dbf input datafile file number=00001 name=/u01/app/oracle/oradata/ENMO11G/system01.dbf input datafile file number=00002 name=/u01/app/oracle/oradata/ENMO11G/sysaux01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/ENMO11G/enmoedu01.dbf input datafile file number=00006 name=/u01/app/oracle/oradata/ENMO11G/enmoedubig.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/ENMO11G/users01.dbf channel ORA_DISK_1: starting piece 1 at 2016-01-16 11:51:06 channel ORA_DISK_1: finished piece 1 at 2016-01-16 11:52:21 piece handle=/u01/app/oracle/fast_recovery_area/ENMO11G/backupset/2016_01_16/o1_mf_nnnd1_TAG20160116T115106_c9mhkbcb_.bkp tag=TAG20160116T115106 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:01:15 channel ORA_DISK_1: starting incremental level 1 datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set including current control file in backup set channel ORA_DISK_1: starting piece 1 at 2016-01-16 11:52:22 channel ORA_DISK_1: finished piece 1 at 2016-01-16 11:52:24 piece handle=/u01/app/oracle/fast_recovery_area/ENMO11G/backupset/2016_01_16/o1_mf_ncnn1_TAG20160116T115106_c9mhmq0c_.bkp tag=TAG20160116T115106 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02 Finished backup at 2016-01-16 11:52:24 ------------------------------------------------------------------------------------------------------------------------------------ 数据库恢复到三天前的任何一个时刻: RMAN> configure retention policy to recovery window of 3 days;
new RMAN configuration parameters: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS; new RMAN configuration parameters are successfully stored
|
5 | rman备份相关的动态性能视图: SQL> desc v$archived_log; Name Null? Type ----------------------------------------- -------- ---------------------------- RECID NUMBER STAMP NUMBER NAME VARCHAR2(513) DEST_ID NUMBER THREAD# NUMBER SEQUENCE# NUMBER RESETLOGS_CHANGE# NUMBER RESETLOGS_TIME DATE RESETLOGS_ID NUMBER FIRST_CHANGE# NUMBER FIRST_TIME DATE NEXT_CHANGE# NUMBER NEXT_TIME DATE BLOCKS NUMBER BLOCK_SIZE NUMBER CREATOR VARCHAR2(7) REGISTRAR VARCHAR2(7) STANDBY_DEST VARCHAR2(3) ARCHIVED VARCHAR2(3) APPLIED VARCHAR2(9) DELETED VARCHAR2(3) STATUS VARCHAR2(1) COMPLETION_TIME DATE DICTIONARY_BEGIN VARCHAR2(3) DICTIONARY_END VARCHAR2(3) END_OF_REDO VARCHAR2(3) BACKUP_COUNT NUMBER ARCHIVAL_THREAD# NUMBER ACTIVATION# NUMBER IS_RECOVERY_DEST_FILE VARCHAR2(3) COMPRESSED VARCHAR2(3) FAL VARCHAR2(3) END_OF_REDO_TYPE VARCHAR2(10) BACKED_BY_VSS VARCHAR2(3)
SQL> select recid,stamp from v$archived_log;
RECID STAMP ---------- ---------- 1 901199534 2 901199536 3 901199539 4 901199539 5 901200027 6 901200027 7 901200030 8 901200030 9 901200274 10 901200274 11 901212153
RECID STAMP ---------- ---------- 12 901212157 13 901214467 14 901214471 15 901218429 16 901241096 17 901241166 18 901241170 19 901243194 20 901243196 21 901277131 22 901277135
RECID STAMP ---------- ---------- 23 901277471 24 901277749 25 901277755
25 rows selected. -------------------------------------------------------------------------------------------------------- v$backup_set视图中显示当前创建的备份集信息。 SQL> desc v$backup_set; Name Null? Type ----------------------------------------- -------- ---------------------------- RECID NUMBER STAMP NUMBER SET_STAMP NUMBER SET_COUNT NUMBER BACKUP_TYPE VARCHAR2(1) CONTROLFILE_INCLUDED VARCHAR2(3) INCREMENTAL_LEVEL NUMBER PIECES NUMBER START_TIME DATE COMPLETION_TIME DATE ELAPSED_SECONDS NUMBER BLOCK_SIZE NUMBER INPUT_FILE_SCAN_ONLY VARCHAR2(3) KEEP VARCHAR2(3) KEEP_UNTIL DATE KEEP_OPTIONS VARCHAR2(11) MULTI_SECTION VARCHAR2(3)
SQL> select recid,set_stamp,backup_type,pieces from v$backup_set;
RECID SET_STAMP B PIECES ---------- ---------- - ---------- 9 901241167 D 1 12 901277349 D 1 14 901277614 D 1 15 901277636 D 1 16 901277721 D 1 17 901277749 L 1 18 901277753 D 1 19 901277755 L 1 20 901280677 D 1 21 901280772 D 1 22 901280886 I 1
RECID SET_STAMP B PIECES ---------- ---------- - ---------- 23 901280901 I 1 24 901280940 I 1 25 901281066 I 1 26 901281141 I 1
15 rows selected. ----------------------------------------------------------------------------------------------------------------- v$backup_piece视图中显示备份片段的信息。 SQL> desc v$backup_piece; Name Null? Type ----------------------------------------- -------- ---------------------------- RECID NUMBER STAMP NUMBER SET_STAMP NUMBER SET_COUNT NUMBER PIECE# NUMBER COPY# NUMBER DEVICE_TYPE VARCHAR2(17) HANDLE VARCHAR2(513) COMMENTS VARCHAR2(64) MEDIA VARCHAR2(65) MEDIA_POOL NUMBER CONCUR VARCHAR2(3) TAG VARCHAR2(32) STATUS VARCHAR2(1) START_TIME DATE COMPLETION_TIME DATE ELAPSED_SECONDS NUMBER DELETED VARCHAR2(3) BYTES NUMBER IS_RECOVERY_DEST_FILE VARCHAR2(3) RMAN_STATUS_RECID NUMBER RMAN_STATUS_STAMP NUMBER COMPRESSED VARCHAR2(3) BACKED_BY_VSS VARCHAR2(3) ENCRYPTED VARCHAR2(3) BACKED_BY_OSB VARCHAR2(3)
SQL> select BACKED_BY_VSS,BACKED_BY_OSB,COMPLETION_TIME from v$backup_piece;
BAC BAC COMPLETIO --- --- --------- NO NO 15-JAN-16 NO NO 15-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16
BAC BAC COMPLETIO --- --- --------- NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16
BAC BAC COMPLETIO --- --- --------- NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16
BAC BAC COMPLETIO --- --- --------- NO NO 16-JAN-16 NO NO 16-JAN-16 NO NO 16-JAN-16
36 rows selected. ------------------------------------------------------------------------------------------------------------------------- v$backup_corruption视图中记录了备份集中发现的损坏的数据库: SQL> desc v$backup_corruption; Name Null? Type ----------------------------------------- -------- ---------------------------- RECID NUMBER STAMP NUMBER SET_STAMP NUMBER SET_COUNT NUMBER PIECE# NUMBER FILE# NUMBER BLOCK# NUMBER BLOCKS NUMBER CORRUPTION_CHANGE# NUMBER MARKED_CORRUPT VARCHAR2(3) CORRUPTION_TYPE VARCHAR2(9)
SQL> select PIECE#,FILE#, BLOCKS, BLOCKS, CORRUPTION_CHANGE# from v$backup_corruption;
no rows selected
|
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30606702/viewspace-1980233/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30606702/viewspace-1980233/