How is the behaviour of backupset in RMAN?
سؤال
I found this definition on WEB:
A logical grouping of backup files -- the backup pieces -- that are created when you issue an RMAN backup command. A backup set is RMAN’s name for a collection of files associated with a backup. A backup set is composed of one or more backup pieces.
but I don't understand why when I make one backup of whole database the rman creates several backupsets
Here is the output about one backup that I make (I've used parallelism 4)
[oracle@orcl12 ~]$ rman target /
Recovery Manager: Release 12.2.0.1.0 - Production on Sat Jul 20 12:48:52 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1525136414)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
161 3.92M DISK 00:00:01 20/07/2019 12:06:12
BP Key: 161 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120610
Piece Name: /u01/app/oracle/recovery_area/ORCL/backupset/2019_07_20/o1_mf_annnn_TAG20190720T120610_gm6ch3t2_.bkp
List of Archived Logs in backup set 161
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 58 14688057 20/07/2019 11:55:34 14693433 20/07/2019 12:06:09
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
162 Full 307.59M DISK 00:03:59 20/07/2019 12:10:15
BP Key: 162 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F4405983DB33E47E055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6chcwh_.bkp
List of Datafiles in backup set 162
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
10 Full 14693446 20/07/2019 12:06:16 NO /u01/app/oracle/oradata/orcl/orclpdb/sysaux01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
163 Full 276.60M DISK 00:04:11 20/07/2019 12:10:27
BP Key: 163 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F43A22D9E7528CCE055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6chg3m_.bkp
List of Datafiles in backup set 163
Container ID: 2, PDB Name: PDB$SEED
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
6 Full 1441967 12/01/2019 11:41:59 NO /u01/app/oracle/oradata/orcl/pdbseed/sysaux01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
164 Full 503.65M DISK 00:05:59 20/07/2019 12:12:14
BP Key: 164 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6ch8s4_.bkp
List of Datafiles in backup set 164
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
3 Full 14693445 20/07/2019 12:06:16 NO /u01/app/oracle/oradata/orcl/sysaux01.dbf
7 Full 14693445 20/07/2019 12:06:16 NO /u01/app/oracle/oradata/orcl/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
165 Full 738.59M DISK 00:06:22 20/07/2019 12:12:37
BP Key: 165 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6ch803_.bkp
List of Datafiles in backup set 165
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
1 Full 14693444 20/07/2019 12:06:15 NO /u01/app/oracle/oradata/orcl/system01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
166 Full 285.26M DISK 00:01:08 20/07/2019 12:13:58
BP Key: 166 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6cvr4x_.bkp
List of Datafiles in backup set 166
Container ID: 4, PDB Name: HOMOL
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
57 Full 14693594 20/07/2019 12:12:54 NO /u01/app/oracle/oradata/orcl/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/datafile/o1_mf_sysaux_glh6b049_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
167 Full 198.24M DISK 00:01:35 20/07/2019 12:15:22
BP Key: 167 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F43A22D9E7528CCE055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6cxvsl_.bkp
List of Datafiles in backup set 167
Container ID: 2, PDB Name: PDB$SEED
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
5 Full 1441967 12/01/2019 11:41:59 NO /u01/app/oracle/oradata/orcl/pdbseed/system01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
168 Full 222.91M DISK 00:02:53 20/07/2019 12:15:49
BP Key: 168 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F4405983DB33E47E055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6cxov8_.bkp
List of Datafiles in backup set 168
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
9 Full 14693605 20/07/2019 12:13:22 NO /u01/app/oracle/oradata/orcl/orclpdb/system01.dbf
12 Full 14693605 20/07/2019 12:13:22 NO /u01/app/oracle/oradata/orcl/orclpdb/users01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
169 Full 204.08M DISK 00:02:21 20/07/2019 12:17:20
BP Key: 169 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d1dhk_.bkp
List of Datafiles in backup set 169
Container ID: 4, PDB Name: HOMOL
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
56 Full 14693679 20/07/2019 12:15:52 NO /u01/app/oracle/oradata/orcl/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/datafile/o1_mf_system_glh69zz4_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
170 Full 3.07M DISK 00:02:04 20/07/2019 12:18:00
BP Key: 170 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F4405983DB33E47E055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d4lp2_.bkp
List of Datafiles in backup set 170
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
11 Full 14693696 20/07/2019 12:16:40 NO /u01/app/oracle/oradata/orcl/orclpdb/undotbs01.dbf
60 Full 14693696 20/07/2019 12:16:40 NO /u01/app/oracle/product/12.2.0/dbhome_1/dbs/brelele
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
171 Full 7.98M DISK 00:00:36 20/07/2019 12:18:13
BP Key: 171 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F4405983DB33E47E055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d5kdw_.bkp
List of Datafiles in backup set 171
Container ID: 3, PDB Name: ORCLPDB
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
55 Full 14693724 20/07/2019 12:17:54 NO /u01/app/oracle/oradata/orcl/ORCL/7F4405983DB33E47E055FAC8EF8905E8/datafile/o1_mf_rman_gldpgddc_.dbf
61 Full 14693724 20/07/2019 12:17:54 NO /u01/app/oracle/product/12.2.0/dbhome_1/dbs/brelele2
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
172 Full 37.42M DISK 00:00:34 20/07/2019 12:18:44
BP Key: 172 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/7F43A22D9E7528CCE055FAC8EF8905E8/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d61cl_.bkp
List of Datafiles in backup set 172
Container ID: 2, PDB Name: PDB$SEED
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
8 Full 1441967 12/01/2019 11:41:59 NO /u01/app/oracle/oradata/orcl/pdbseed/undotbs01.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
173 Full 2.57M DISK 00:00:31 20/07/2019 12:19:01
BP Key: 173 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d6nnb_.bkp
List of Datafiles in backup set 173
Container ID: 4, PDB Name: HOMOL
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
58 Full 14693749 20/07/2019 12:18:34 NO /u01/app/oracle/oradata/orcl/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/datafile/o1_mf_undotbs1_glh6b04c_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
174 Full 1.04M DISK 00:00:32 20/07/2019 12:19:16
BP Key: 174 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d7mhm_.bkp
List of Datafiles in backup set 174
Container ID: 4, PDB Name: HOMOL
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
59 Full 14693756 20/07/2019 12:18:51 NO /u01/app/oracle/oradata/orcl/ORCL/8D6E79BBBC2A140CE0531400A8C06C3B/datafile/o1_mf_users_glh795h1_.dbf
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
175 Full 16.57M DISK 00:00:16 20/07/2019 12:19:21
BP Key: 175 Status: AVAILABLE Compressed: NO Tag: TAG20190720T120613
Piece Name: /u01/app/oracle/recovery_area/ORCL/backupset/2019_07_20/o1_mf_nnndf_TAG20190720T120613_gm6d7q9r_.bkp
List of Datafiles in backup set 175
File LV Type Ckp SCN Ckp Time Abs Fuz SCN Sparse Name
---- -- ---- ---------- ------------------- ----------- ------ ----
4 Full 14694166 20/07/2019 12:19:15 14694171 NO /u01/app/oracle/oradata/orcl/undotbs01.dbf
28 Full 14694166 20/07/2019 12:19:15 NO /u01/app/oracle/oradata/orcl/ORCL/datafile/o1_mf_haha_gb1k1h6b_.dbf
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -------------------
176 4.99M DISK 00:00:00 20/07/2019 12:19:37
BP Key: 176 Status: AVAILABLE Compressed: NO Tag: TAG20190720T121936
Piece Name: /u01/app/oracle/recovery_area/ORCL/backupset/2019_07_20/o1_mf_annnn_TAG20190720T121936_gm6d89jz_.bkp
List of Archived Logs in backup set 176
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ------------------- ---------- ---------
1 59 14693433 20/07/2019 12:06:09 14694370 20/07/2019 12:19:30
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ -------------------
177 Full 18.09M DISK 00:00:05 20/07/2019 12:19:54
BP Key: 177 Status: AVAILABLE Compressed: NO Tag: TAG20190720T121948
Piece Name: /u01/app/oracle/recovery_area/ORCL/autobackup/2019_07_20/o1_mf_s_1014121189_gm6d8tj6_.bkp
SPFILE Included: Modification time: 20/07/2019 12:18:10
SPFILE db_unique_name: ORCL
Control File Included: Ckp SCN: 14694951 Ckp time: 20/07/2019 12:19:49
shouldn't the rman creates one backupset for one backup and in this backupset include all backup pieces?
My RMAN configurations:
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
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 RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.2.0/dbhome_1/dbs/snapcf_orcl.f'; # default
المحلول
Using backup database plus archivelog rman will make several steps:
- log switch (creates new archivelog)
- backup of archivelogs
- backup of datafiles
- log switch (creates new archivelog)
- backup of archivelogs for the time of db backup
- backup of controlfile and spfile;
So here rman will create at least 4 backupsets: two - with archivelogs, one - with datafiles, and one with CF and spfile.
If you are using parallelism of 4 - then rman will work in 4 processes(threads), and every process will generate its own backupset.
For datafiles rman will divide this work between 4 processes, and every process will backup their datafiles.
The same for the archivelogs - if there are many - you'll see 4 backupsets for them.
نصائح أخرى
Also from the Database Backup and Recovery User's Guide.
The total number and size of backup sets depends mostly on an internal RMAN algorithm. However, you can influence RMAN behavior with the MAXSETSIZE parameter in the CONFIGURE or BACKUP command. By limiting the size of the backup set, the parameter indirectly limits the number of files in the set and can possibly force RMAN to create additional backup sets. Also, you can specify BACKUP ... FILESPERSET to specify the maximum number of files in each backup set.