Oracle RMAN-增量备份
全备份
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.02G DISK 00:01:46 08-DEC-17 (1号备份是全备份,备份的尺寸大小是1.02G,备份到硬盘上面,后面是什么时间备份的。)
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1038388 08-DEC-17 /u01/oracle/oradata/system01.dbf
2 Full 1038388 08-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 Full 1038388 08-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 Full 1038388 08-DEC-17 /u01/oracle/oradata/users01.dbf
(1.02个G的大小是上面4个文件加起来的大小)
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 9.36M DISK 00:00:01 08-DEC-17
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
SPFILE Included: Modification time: 08-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1038423 Ckp time: 08-DEC-17
[oracle@localhost oradata]$ ls -la /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08
total 1075948
drwxr-x--- 2 oracle oinstall 4096 Dec 8 03:22 .
drwxr-x--- 3 oracle oinstall 4096 Dec 8 03:20 ..
-rw-r----- 1 oracle oinstall 9830400 Dec 8 03:22 o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
-rw-r----- 1 oracle oinstall 1091928064 Dec 8 03:22 o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
.bkp文件为什么放在backupset下面是由configure文件来做决定的。
通过rman产生的这两个文件因为备份的是在本地,可以将这个文件拷贝出去,拷贝到另外一块硬盘上面。如果要恢复,就将其还原到原来的位置进行恢复。
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
[root@localhost 2017_12_08]# cp o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp /rman
[root@localhost 2017_12_08]# ls /rman
o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORADB are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_oradb.f'; # default
可以看到configuration有一些缺省的参数,在使用backup database的时候没有指定任何参数,使用的就是默认的configuration的参数。但是使用backup database的时候也可以指定参数。
在非catalog模式下面使用rman备份,备份的信息是放在控制文件里面,通过查看任意一个控制文件可以看到里面有rman的备份信息。
[oracle@oracle oradb]$ ls
control01.ctl control02.ctl redo01.log redo02.log redo03.log sysaux01.dbf system01.dbf temp01.dbf undotbs01.dbf user01.dbf
[oracle@oracle oradb]$ strings control01.ctl
2017-12-11T06:21:55
RMAN
2017-12-11T06:21:55
list
2017-12-11T06:21:55
backup
2017-12-11T06:21:55
list
2017-12-11T06:21:55
list
2017-12-11T06:21:55
RMAN
2017-12-11T06:21:55
list
2017-12-11T06:21:55
backup
2017-12-11T06:21:55
list
2017-12-11T06:21:55
List
将来要使用catalog方式,会将备份的信息放在catalog database里面去。
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.02G DISK 00:01:46 08-DEC-17
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1038388 08-DEC-17 /u01/oracle/oradata/system01.dbf
2 Full 1038388 08-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 Full 1038388 08-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 Full 1038388 08-DEC-17 /u01/oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 9.36M DISK 00:00:01 08-DEC-17
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
SPFILE Included: Modification time: 08-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1038423 Ckp time: 08-DEC-17
上次做的全备份,back up piece是一个文件,如o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp,上面全部的信息就是一个backup set,backupset是一个备份集,是一个集合。在备份集合里面有backup piece,即一个文件。
o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
这两个文件(backup piece)组成了backupset,将来要进行恢复的时候,缺一不可。
0级增量备份
RMAN> backup incremental level=0 database;
Starting backup at 10-DEC-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=42 device type=DISK
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=00001 name=/u01/oracle/oradata/system01.dbf
input datafile file number=00002 name=/u01/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/undotbs01.dbf
input datafile file number=00004 name=/u01/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 10-DEC-17
channel ORA_DISK_1: finished piece 1 at 10-DEC-17
piece handle=/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd0_TAG20171210T165527_f2vow0f1_.bkp tag=TAG20171210T165527 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 10-DEC-17
channel ORA_DISK_1: finished piece 1 at 10-DEC-17
piece handle=/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn0_TAG20171210T165527_f2voxsq9_.bkp tag=TAG20171210T165527 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-DEC-17
0级增量备份和全备份差不多,都是将整个数据库备份下来。唯一的区别就是全备份不可以作为增量备份的基础。但是0级增量备份可以作为增量备份的基础。比如做了全备份做1级增量备份,那么1级增量备份不可以在全备份的基础上做一级增量备份。在做1级增量备份是在0级增量备份的基础上做1级增量备份的。
RMAN> list backupset;
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1 Full 1.02G DISK 00:01:46 08-DEC-17
BP Key: 1 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
List of Datafiles in backup set 1
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 1038388 08-DEC-17 /u01/oracle/oradata/system01.dbf
2 Full 1038388 08-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 Full 1038388 08-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 Full 1038388 08-DEC-17 /u01/oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2 Full 9.36M DISK 00:00:01 08-DEC-17
BP Key: 2 Status: AVAILABLE Compressed: NO Tag: TAG20171208T032031
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
SPFILE Included: Modification time: 08-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1038423 Ckp time: 08-DEC-17
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Incr 0 1.01G DISK 00:00:50 10-DEC-17
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20171210T165527
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd0_TAG20171210T165527_f2vow0f1_.bkp
List of Datafiles in backup set 3
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/system01.dbf
2 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Incr 0 9.36M DISK 00:00:01 10-DEC-17
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20171210T165527
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn0_TAG20171210T165527_f2voxsq9_.bkp
SPFILE Included: Modification time: 10-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1067960 Ckp time: 10-DEC-17
通过3,4和1,2对比可以看到,0级增量备份和全部数据库的备份的文件大小几乎相同。其实0级增量备份和全库备份都差不多,只不过0级增量可以作为后续增量备份的基础。
在0级增量备份级里面,tag的值都是一样的。在增量备份的9.36M的备份片里面(SPFILE Included,Control File Included)包含了参数文件和控制文件。同理1.01G的备份片里面包含了下面这些文件。
1 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/system01.dbf
2 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/users01.dbf
1级增量备份
RMAN> backup incremental level=1 database;
Starting backup at 10-DEC-17
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=00001 name=/u01/oracle/oradata/system01.dbf
input datafile file number=00002 name=/u01/oracle/oradata/sysaux01.dbf
input datafile file number=00003 name=/u01/oracle/oradata/undotbs01.dbf
input datafile file number=00004 name=/u01/oracle/oradata/users01.dbf
channel ORA_DISK_1: starting piece 1 at 10-DEC-17
channel ORA_DISK_1: finished piece 1 at 10-DEC-17
piece handle=/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd1_TAG20171210T171449_f2vq09gl_.bkp tag=TAG20171210T171449 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 10-DEC-17
channel ORA_DISK_1: finished piece 1 at 10-DEC-17
piece handle=/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn1_TAG20171210T171449_f2vq1gh8_.bkp tag=TAG20171210T171449 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 10-DEC-17
现在用list backupset看看
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Incr 0 1.01G DISK 00:00:50 10-DEC-17
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20171210T165527
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd0_TAG20171210T165527_f2vow0f1_.bkp
List of Datafiles in backup set 3
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/system01.dbf
2 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 0 Incr 1067941 10-DEC-17 /u01/oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
4 Incr 0 9.36M DISK 00:00:01 10-DEC-17
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20171210T165527
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn0_TAG20171210T165527_f2voxsq9_.bkp
SPFILE Included: Modification time: 10-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1067960 Ckp time: 10-DEC-17
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
5 Incr 1 4.17M DISK 00:00:28 10-DEC-17
BP Key: 5 Status: AVAILABLE Compressed: NO Tag: TAG20171210T171449
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd1_TAG20171210T171449_f2vq09gl_.bkp
List of Datafiles in backup set 5
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 1 Incr 1068885 10-DEC-17 /u01/oracle/oradata/system01.dbf
2 1 Incr 1068885 10-DEC-17 /u01/oracle/oradata/sysaux01.dbf
3 1 Incr 1068885 10-DEC-17 /u01/oracle/oradata/undotbs01.dbf
4 1 Incr 1068885 10-DEC-17 /u01/oracle/oradata/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
6 Incr 1 9.36M DISK 00:00:01 10-DEC-17
BP Key: 6 Status: AVAILABLE Compressed: NO Tag: TAG20171210T171449
Piece Name: /u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn1_TAG20171210T171449_f2vq1gh8_.bkp
SPFILE Included: Modification time: 10-DEC-17
SPFILE db_unique_name: ORADB
Control File Included: Ckp SCN: 1068897 Ckp time: 10-DEC-17
因为对数据库几乎没有做什么操作,所以1级增量备份产生的备份片比较写,但是需要一段时间,因为1级增量备份产生的备份片要和0级增量备份做比较。
在控制文件里面可以看到使用rman备份的信息。
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
TAG20171208T032031
loY9koY9
loY9
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
TAG20171208T032031
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd0_TAG20171210T165527_f2vow0f1_.bkp
TAG20171210T165527
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn0_TAG20171210T165527_f2voxsq9_.bkp
TAG20171210T165527
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd1_TAG20171210T171449_f2vq09gl_.bkp
TAG20171210T171449
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn1_TAG20171210T171449_f2vq1gh8_.bkp
TAG20171210T171449
ioY9
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T032031_f2nxd0wz_.bkp
TAG20171208T032031
loY9koY9
loY9
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T032031_f2nxhdkj_.bkp
TAG20171208T032031
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_nnnd0_TAG20171210T165527_f2vow0f1_.bkp
TAG20171210T165527
DISK
/u01/oracle/fast_recovery_area/ORADB/backupset/2017_12_10/o1_mf_ncsn0_TAG20171210T165527_f2voxsq9_.bkp
目录 返回
首页