search
HomeDatabaseMysql TutorialRMAN 配置保留策略

RMAN保留策略关乎数据的完整性,因此事关重大,由用户定义的、基于用户数据恢复所能承受的容忍度来设置。也就是说根据恢复的需要

RMAN保留策略关乎数据的完整性,因此事关重大,由用户定义的、基于用户数据恢复所能承受的容忍度来设置。也就是说根据恢复的需要,用户需要保留几天的数据,或者说用户需要备份的保留几个副本,或者不需要设定保留策略。在生产环境中多数使用的是基于恢复窗口的保留策略,因此需要重点关注与理解其用法。最本文主要描述了RMAN下的三种保留策略方式。

1、什么是备份保留策略
    也就是说备份可以保留多久,需要保留多久的问题,,我们可以通过configure retention policy 来进行配置
    注意,保留策略是相对于恢复而言,也就是说根据恢复的需要来制定保留策略,比如需要恢复到3天以前,或是保留2个不同的副本
    Oracle支持三种保留策略,一个是基于恢复窗口的保留策略,一个是基于冗余的保留策略。一个是无保留策略,三种保留策略互斥,不可同时使用
    当备份保留策略启用后,已生成的备份满足保留策略之后,会被标记为过时,也就是说RMAN认为恢复已经不再需要用到这些备份
    可以通过report obsolete来查看当前数据库的过时的备份。以及使用delete obsolete来删除过时的备份
    对于过时的备份(备份集,镜像副本等),在未使用FRA的情形下,RMAN仅仅是对其加以标注,而不会真正删除这些过时的备份
    对于使用了FRA(闪回区)的情形,RMAN会自动地删除这些过时的备份以循环利用FRA空间。
    注意理解无效的备份或过时的备份,前者执行crosscheck之后,文件没有找到(被删除),后者指文件存在,但是根据保留策略恢复已不再需要用到
    保留策略的使用范围
        完全备份、level 0、控制文件备份
        对于数据文件镜像副本(copy方式),如果RMAN认为该副本不再需要,则可以被删除
        对于数据文件备份集,当在备份集内所有的数据文件为过时时,可以被删除
 

2、基于恢复窗口的保留策略
    该方式用于确保将数据库恢复到特定的时间点。比如需要恢复一周以内的数据,使用恢复窗口RECOVERY WINDOW OF 7 DAYS
    那么所有与恢复到最近7天的完全备份、增量备份、归档日志,都应当被保留,而且有可能7天以前的备份也需要保留
    比如系统中完整地备份是8天以前的,即便当前产生了新的完整备份,上次的完整备份也应当被保留,而不是说只要过了7天这些备份就不再需要
    配置恢复窗口保留策略:
        CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    对于上述配置,每一个数据文件、备份应当满足这个条件:SYSDATE - BACKUP CHECKPOINT TIME >= 7,在这之前的备份则是无效的。
    下面的恢复窗口分析示例图来自Backup and Recovery User's Guide
    恢复窗口分析示例1:

RMAN 配置保留策略

        恢复窗口为7天,数据库处于归档模式
        备份计划是每两周一次全备,分别是: January 1,January 15,January 29,February 12
        对于图中的情形,当前的时间点Jan 23,那么7天的恢复窗口则是Jan 16,要能够确保数据可以恢复到Jan 16,
        那么Jan 14的备份及archive log 500到log 850都应当被保留,Jan 1的备份是过时的

    恢复窗口分析示例2:   

RMAN 配置保留策略

        当前的时间位Jan 30,那么7天的恢复窗口是Jan 23,确保Jan 23可恢复则应当自上一次完整备份到Jan 23的archive log可用。
        即Jan 14的完整备份必须被保留,log 500到log 1150都必须全部被保留

更多详情见请继续阅读下一页的精彩内容:  

推荐阅读:

RMAN 配置归档日志删除策略

Oracle基础教程之通过RMAN复制数据库

RMAN备份策略制定参考内容

RMAN备份学习笔记

Oracle数据库备份加密 RMAN加密

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
MySQL String Types: Storage, Performance, and Best PracticesMySQL String Types: Storage, Performance, and Best PracticesMay 10, 2025 am 12:02 AM

MySQLstringtypesimpactstorageandperformanceasfollows:1)CHARisfixed-length,alwaysusingthesamestoragespace,whichcanbefasterbutlessspace-efficient.2)VARCHARisvariable-length,morespace-efficientbutpotentiallyslower.3)TEXTisforlargetext,storedoutsiderows,

Understanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreUnderstanding MySQL String Types: VARCHAR, TEXT, CHAR, and MoreMay 10, 2025 am 12:02 AM

MySQLstringtypesincludeVARCHAR,TEXT,CHAR,ENUM,andSET.1)VARCHARisversatileforvariable-lengthstringsuptoaspecifiedlimit.2)TEXTisidealforlargetextstoragewithoutadefinedlength.3)CHARisfixed-length,suitableforconsistentdatalikecodes.4)ENUMenforcesdatainte

What are the String Data Types in MySQL?What are the String Data Types in MySQL?May 10, 2025 am 12:01 AM

MySQLoffersvariousstringdatatypes:1)CHARforfixed-lengthstrings,2)VARCHARforvariable-lengthtext,3)BINARYandVARBINARYforbinarydata,4)BLOBandTEXTforlargedata,and5)ENUMandSETforcontrolledinput.Eachtypehasspecificusesandperformancecharacteristics,sochoose

How to Grant Permissions to New MySQL UsersHow to Grant Permissions to New MySQL UsersMay 09, 2025 am 12:16 AM

TograntpermissionstonewMySQLusers,followthesesteps:1)AccessMySQLasauserwithsufficientprivileges,2)CreateanewuserwiththeCREATEUSERcommand,3)UsetheGRANTcommandtospecifypermissionslikeSELECT,INSERT,UPDATE,orALLPRIVILEGESonspecificdatabasesortables,and4)

How to Add Users in MySQL: A Step-by-Step GuideHow to Add Users in MySQL: A Step-by-Step GuideMay 09, 2025 am 12:14 AM

ToaddusersinMySQLeffectivelyandsecurely,followthesesteps:1)UsetheCREATEUSERstatementtoaddanewuser,specifyingthehostandastrongpassword.2)GrantnecessaryprivilegesusingtheGRANTstatement,adheringtotheprincipleofleastprivilege.3)Implementsecuritymeasuresl

MySQL: Adding a new user with complex permissionsMySQL: Adding a new user with complex permissionsMay 09, 2025 am 12:09 AM

ToaddanewuserwithcomplexpermissionsinMySQL,followthesesteps:1)CreatetheuserwithCREATEUSER'newuser'@'localhost'IDENTIFIEDBY'password';.2)Grantreadaccesstoalltablesin'mydatabase'withGRANTSELECTONmydatabase.TO'newuser'@'localhost';.3)Grantwriteaccessto'

MySQL: String Data Types and CollationsMySQL: String Data Types and CollationsMay 09, 2025 am 12:08 AM

The string data types in MySQL include CHAR, VARCHAR, BINARY, VARBINARY, BLOB, and TEXT. The collations determine the comparison and sorting of strings. 1.CHAR is suitable for fixed-length strings, VARCHAR is suitable for variable-length strings. 2.BINARY and VARBINARY are used for binary data, and BLOB and TEXT are used for large object data. 3. Sorting rules such as utf8mb4_unicode_ci ignores upper and lower case and is suitable for user names; utf8mb4_bin is case sensitive and is suitable for fields that require precise comparison.

MySQL: What length should I use for VARCHARs?MySQL: What length should I use for VARCHARs?May 09, 2025 am 12:06 AM

The best MySQLVARCHAR column length selection should be based on data analysis, consider future growth, evaluate performance impacts, and character set requirements. 1) Analyze the data to determine typical lengths; 2) Reserve future expansion space; 3) Pay attention to the impact of large lengths on performance; 4) Consider the impact of character sets on storage. Through these steps, the efficiency and scalability of the database can be optimized.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment