先来一段官方解释

RMAN can store backup data in a logical structure called a backup set, which is the smallest unit of an RMAN backup. A backup set contains the data from one or more datafiles, archived redo logs, control files, or server parameter file. Backup sets, which are only created and accessed through RMAN, are the only form in which RMAN can write backups to media managers such as tape drives and tape libraries.

A backup set contains one or more binary files in an RMAN-specific format. Each of these files is known as a backup piece. A backup set can contain multiple datafiles.For example, you can back up 10 datafiles into a single backup set consisting of a
single backup piece. In this case, RMAN creates one backup piece as output. The backup set contains only this backup piece.

If you specify the SECTION SIZE parameter on the BACKUP command, then RMAN produces a multisection backup. This is a backup of a single large file, produced bymultiple channels in parallel, each of which produces one backup piece. Each backup
piece contains one file section of the file being backed up.

For non-multisection backups, RMAN only records backup sets in the repository that complete successfully. There is no such thing as a partial backup set. This differs from an unsuccessful multisection backup, where it is possible for RMAN metadata to
contain a record for a partial backup set. In the latter case, you must use the DELETE command to delete the partial backup set.

我的理解就从一个例子开始说吧。

如果配置了参数MAXSETSIZE就可能遇到这个问题

RMAN-03002: failure of backup command at 01/05/2020 18:00:07 RMAN-06183: datafile or datafile copy /oracle/oradata/orcl/users01.dbf (file number 4) larger than MAXSETSIZE

这里设置了MAXSETSIZE为20G,此时的users01.dbf已经超过了20G,导致此报错。

解决方法

1、取消MAXSETSIZE;Oracle 默认值是unlimited,可以设置为 CONFIGURE MAXSETSIZE TO UNLIMITED;

2、调大MAXSETSIZE;此处是20G,可以改为CONFIGURE MAXSETSIZE TO 100G;

为什么会报这种错误?

首先从官文中理解下BACKUP SET和BACKUP PIECE:

1、BACKUP SET是个逻辑概念,是RMAN备份的最小单元;一个BACKUP SET包含一个或多个数据文件、归档日志,控制文件或者SPFILE的数据。

2、一个BACKUP SET可以包含一个或者多个BACKUP PIECE,BACKUP PIECE的数量取决于是否在备份时设置了MAXPIECESIZE(用在 ALLOCATE CHANNEL or CONFIGURE CHANNEL command);

3、BACKUP PIECE是个物理概念,存在于磁盘上;一个BACKUP PIECE可以包含一个或多个数据文件;例如当BACKUP SET只有一个BACKUP PIECE,它就包含所有的数据文件

Oracle的原理是BACKUP SET不能跨数据文件,即如果设置MAXSETSIZE,此值的最小值也要大于占用物理空间最大的数据文件的大小,

生成BACKUP SET的个数(排除控制文件及SPFILE产生的BACKUP SET)= 数据文件占用总物理空间 / MAXSETSIZE

BACKUP PIECE可以跨数据文件,一个BACKUP SET下的多个BACKUP PIECE可能来自一个较大的数据文件,也可能一个BACKUP PIECE包含来自两个数据文件的数据。

以下来自测试环境:

先看数据文件大小,手动添加test表空间并指定1G大小数据文件test01.dbf

[oracle@orcl orcl]$ ls -lh

total 3.0G

-rw-r----- 1 oracle oinstall 9.6M Dec 24 06:00 control01.ctl

-rw-r----- 1 oracle oinstall 347M Dec 24 05:40 example01.dbf

-rw-r----- 1 oracle oinstall  51M Dec 24 05:34 redo01.log

-rw-r----- 1 oracle oinstall  51M Dec 24 06:00 redo02.log

-rw-r----- 1 oracle oinstall  51M Dec 24 05:34 redo03.log

-rw-r----- 1 oracle oinstall 601M Dec 24 05:57 sysaux01.dbf

-rw-r----- 1 oracle oinstall 761M Dec 24 05:59 system01.dbf

-rw-r----- 1 oracle oinstall  30M Dec 24 05:35 temp01.dbf

-rw-r----- 1 oracle oinstall 1.1G Dec 24 05:59 test01.dbf

-rw-r----- 1 oracle oinstall 101M Dec 24 05:59 undotbs01.dbf

-rw-r----- 1 oracle oinstall 5.1M Dec 24 05:39 users01.dbf

执行rman备份后,查看BACKUP SET,此时的MAXSETSIZE设置为1G,MAXPIECESIZE无限制

RMAN> list backup;

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
55      Full    1.03M      DISK        00:00:00     24-DEC-19      
        BP Key: 66   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T060127
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_124_1.bak
  List of Datafiles in backup set 55
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 1757455    24-DEC-19 /u01/app/oracle/oradata/orcl/test01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
56      Full    519.12M    DISK        00:00:09     24-DEC-19      
        BP Key: 67   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T060127
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_125_1.bak
  List of Datafiles in backup set 56
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1757457    24-DEC-19 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  5       Full 1757457    24-DEC-19 /u01/app/oracle/oradata/orcl/example01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
57      Full    652.44M    DISK        00:00:38     24-DEC-19      
        BP Key: 68   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T060127
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_126_1.bak
  List of Datafiles in backup set 57
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1757469    24-DEC-19 /u01/app/oracle/oradata/orcl/system01.dbf
  3       Full 1757469    24-DEC-19 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  4       Full 1757469    24-DEC-19 /u01/app/oracle/oradata/orcl/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
58      Full    9.64M      DISK        00:00:01     24-DEC-19      
        BP Key: 69   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T060127
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_127_1.bak
  SPFILE Included: Modification time: 24-DEC-19
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 1757510      Ckp time: 24-DEC-19
查看BACKUP PIECE大小

-rw-r----- 1 oracle oinstall 1.1M Dec 24 06:01 oradb_ORCL_124_1.bak

--1G的数据文件生成的BACKUP PIECE只有1.1M,证明RMAN只备份USED的数据块

-rw-r----- 1 oracle oinstall 520M Dec 24 06:01 oradb_ORCL_125_1.bak

-rw-r----- 1 oracle oinstall 653M Dec 24 06:02 oradb_ORCL_126_1.bak

-rw-r----- 1 oracle oinstall 9.7M Dec 24 06:02 oradb_ORCL_127_1.bak

手动设置MAXPIECESIZE为300M,MAXSETSIZE依然为1G,再次执行备份

RMAN> list backup;

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

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
59      Full    1.03M      DISK        00:00:00     24-DEC-19      
        BP Key: 70   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T061050
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_128_1.bak
  List of Datafiles in backup set 59
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  6       Full 1758274    24-DEC-19 /u01/app/oracle/oradata/orcl/test01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
60      Full    519.14M    DISK        00:00:36     24-DEC-19      
  List of Datafiles in backup set 60
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 1758276    24-DEC-19 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  5       Full 1758276    24-DEC-19 /u01/app/oracle/oradata/orcl/example01.dbf

Backup Set Copy #1 of backup set 60
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:36     24-DEC-19       NO         TAG20191224T061050

List of Backup Pieces for backup set 60 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    71      1   AVAILABLE   /u01/app/oracle/oradata/Backup/oradb_ORCL_129_1.bak
    72      2   AVAILABLE   /u01/app/oracle/oradata/Backup/oradb_ORCL_129_2.bak

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
61      Full    652.58M    DISK        00:00:34     24-DEC-19      
  List of Datafiles in backup set 61
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 1758319    24-DEC-19 /u01/app/oracle/oradata/orcl/system01.dbf
  3       Full 1758319    24-DEC-19 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  4       Full 1758319    24-DEC-19 /u01/app/oracle/oradata/orcl/users01.dbf

Backup Set Copy #1 of backup set 61
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:00:34     24-DEC-19       NO         TAG20191224T061050

List of Backup Pieces for backup set 61 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    73      1   AVAILABLE   /u01/app/oracle/oradata/Backup/oradb_ORCL_130_1.bak
    74      2   AVAILABLE   /u01/app/oracle/oradata/Backup/oradb_ORCL_130_2.bak
    75      3   AVAILABLE   /u01/app/oracle/oradata/Backup/oradb_ORCL_130_3.bak

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
62      Full    9.64M      DISK        00:00:01     24-DEC-19      
        BP Key: 76   Status: AVAILABLE  Compressed: NO  Tag: TAG20191224T061050
        Piece Name: /u01/app/oracle/oradata/Backup/oradb_ORCL_131_1.bak
  SPFILE Included: Modification time: 24-DEC-19
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 1758361      Ckp time: 24-DEC-19
查看生成的BACKUP PIECE大小,发现被按照最大300M分割成多个文件

-rw-r----- 1 oracle oinstall 1.1M Dec 24 06:10 oradb_ORCL_128_1.bak

-rw-r----- 1 oracle oinstall 300M Dec 24 06:11 oradb_ORCL_129_1.bak

-rw-r----- 1 oracle oinstall 220M Dec 24 06:11 oradb_ORCL_129_2.bak

-rw-r----- 1 oracle oinstall 300M Dec 24 06:11 oradb_ORCL_130_1.bak

-rw-r----- 1 oracle oinstall 300M Dec 24 06:11 oradb_ORCL_130_2.bak

-rw-r----- 1 oracle oinstall  53M Dec 24 06:12 oradb_ORCL_130_3.bak

-rw-r----- 1 oracle oinstall 9.7M Dec 24 06:12 oradb_ORCL_131_1.bak

结论:

1、BACKUP SET设置不能小于最大占用物理空间的数据文件大小

2、不根据是否使用块判断,只根据占用的物理空间判断分成多少BACKUP SET,当前数据文件总量大约2.7G,根据1G的MAXSETSIZE将全部数据文件备份为3个BACKUP SET

3、RMAN只备份已经使用的块

4、概念不要混淆,MAXSETSIZE指的是BACKUPSET大小,MAXPIECESIZE指的是BACKUP PIECE大小

BACKUP SET和BACKUP PIECE相关推荐

  1. rman backup database force 功能

    FORCE Causes RMAN to ignore backup optimization. In other words, even if CONFIGURE BACKUP OPTIMIZATI ...

  2. RMAN backup

    RMAN备份命令  1.备份数据库 RMAN> show all; RMAN configuration parameters are: CONFIGURE RETENTION POLICY T ...

  3. 053试题 181/182/183/558/600/608/631/636/657/661/664/668/670/696 - RMAN backup

    题目: 181.Your database has a backup that was taken yesterday (Tuesday) between 13:00 and 15:00 hours. ...

  4. Hadoop Backup Node

    要了解Hadoop Backup Node,要从Namenode的元数据说起. 我们都知道Namenode的元数据非常重要,如果元数据损坏,所有存储在datanode中的数据都读不出来了.另外,如果N ...

  5. veeam.Backup.and.Replication 6 测试之二--backup和replication功能

    首先加入ESXI或vcenter才能对vm进行操作 现在先加入一台ESXI5,作为primary server,如果直接加入vcenter,会直接把vcenter下的所有ESXI都全部加进去 在加入E ...

  6. Oracle Rman 命令详解(List report backup configure)

    一.list常用命令总结备忘 list命令列出控制文件.RMAN恢复目录中备份信息, 是我们对所有可见的数据库备份文件的一个最直观的了解的方法 list incarnation;     list b ...

  7. delete expired backup 和 delete obsolete

    delete expired删除的是那些本来RMAN以为存在但是实际上在磁盘或者磁带上已经被删除了的信息,删除的只是RMAN资料库中的记录:delete obsolete则删除旧于备份保留策略定义的备 ...

  8. sql backup database备份d盘_ClickHouse 备份与恢复

    本文转载自 万能修实验室 作者:公先生 ID: dropudatabase 我们评估一款数据库产品,除了稳定性和易用性外,数据安全也十分重要,备份与恢复往往是最后一道安全门. 但如果备份策略不完善.恢 ...

  9. SAP HANA Backup and Recovery

    2019独角兽企业重金招聘Python工程师标准>>> SAP HANA Backup and Recovery Skip to end of metadata Created by ...

  10. aws rds监控慢sql_使用AWS Backup备份AWS RDS SQL Server数据库

    aws rds监控慢sql This article gives you an overview of creating backups of AWS RDS SQL Server database ...

最新文章

  1. “rm -rf”相当于Windows?
  2. GitHub 给安全行业的四大启示
  3. 用PHP实现POP3邮件的收取(一)
  4. 在生产中运行Java:SRE的观点
  5. java 主线程等待_Java实现主线程等待子线程
  6. Flyway 数据库脚本版本控制工具
  7. page compaction代码分析之一
  8. web打印网页指定区域
  9. 身份证前六位对应代码
  10. 我看现在的seo培训机构
  11. UBports使用和开发资料(Linux手机操作系统)
  12. 如何快速增加qq名片赞
  13. forEach()与each()方法的区别
  14. 《编程之美》笔记之——24点游戏
  15. fluentdpm模型公式_fluent离散相DPM模型模拟
  16. 仿凡科,微企点建站功能预览
  17. Creo服务器管理器配置文件,Creo配置文件Config介绍及设置方法 | 坐倚北风
  18. 查看PCIE槽位是x8 还是 x6
  19. 【疑难总结】float文字环绕的坑
  20. 申万一级行业指数的BUG

热门文章

  1. 《孙子兵法与经理人统帅之道》读后感
  2. java 将对象置空_Java 中将对象引用置 null 的作用?
  3. 自定义SharePoint新网站创建过程(2)
  4. 群发邮件服务器软件,邮件服务器软件:邮件群发是否已死?
  5. 超声波测距 c语言程序流程图,超声波测距单片机C程序+原理图+PCB源文件
  6. Cinema DNG raw视频处理
  7. wex5 页面跳转
  8. 高维正方体(找规律+二项式定理+逆元)
  9. 8个优秀的CSS实践,超详细
  10. Python中sep是函数吗?该怎么使用?