当前位置: 首页 > 编程日记 > 正文

RMAN Backups

image

oracle 主要的备份工具 RMAN

image

其中,open database backup, 不需要把数据库设置成backup状态,

RMAN reads a block until a consistent read is obtained.

看来备份比较重要的三种文件分别是, data file, control file, archivelog file.

Types of Recovery Manager Backups

  • The entire database, every datafile in a tablespace, or a single datafile.
  • The control file
  • All or selected archived logs

Note : The online redo log files are not backed up when using Recovery Manage.

Closed Database Backups

A closed database backup is defined as a backup of the database while it is closed(offline), This is the same as the consistent database backup. If you performing a closed backup, the target database must not be open. If you are using a recovery catalog, the recovery catalog database must be open.

Open Databasee Backups

An open database backup is defined as a backup of any protion of the database while it is open(online). Recovery Manager uses server processes to make copies of datafiles, control files, or archive logs. When using Recovery Manager, do not put tablespaces in backup mode using the ALTER TABLESPACE …BEGIN BACKUP command. RMAN reads a block until a consistent read is obtained.

image

增量备份是RMAN所独有的, 其他的都不可能实现增量备份.

image

image

image

看来 rman 的备份要不然就是 mount 状态 要不就是 open 状态.

RMAN 是一个客户端工具

image

两种方法 : 1. 镜像拷贝, image copy, 就是简单的拷贝命令, ( 不支持增量备份, 这种也可以操作系统层面上的手动copy )

2. 备份集, 里边有备份片, set 是 片( piece ) 的集合. 多个不同类型的文件可以做一个备份集. ( 支持增量备份 )

备份集还分两种: 1. Full backup, all blocks containing data for the files specifiey are backed up.

2. Incremental backup,

注: You can configure automatic control file backup so that the control file is backed up when you issue

a BACKUP or COPY command.

Incremental backup: An incremental backup is a backup of datafiles(只是针对datafile) that include only the blocks that have changed since the last incremental backup. Incremental backups require a base-level( or incremental level 0) backup, which backs up all blocks containing data for the files specified. Incremental level 0 and full backups copy all blocks in datafiles, but full backups cannot be used in an incremental backup strategy.

image

A backup set consists of one or more physical files stored in an RMAN-specific format, on either disk or tape.

备份集也可以被 备份, 备份集包含两种文件: datafile(data file, control file), archived log file.

注: Backup sets may need to be restored by Recovery Manager before recovery can be performed, unlike image copies

which generally are available on disks.( 备份集在在 恢复的时候,要先还原成数据库认识的格式 )

加 control file 方法: 1. Explicitly using the INCLUDE CONTROL FILE syntax

2. Implicitly by backing up file 1(the system datafile)

When a control file is included, it is written in the last datafile backup set.

image

看到没, 只有datafile 支持 incremental 备份

Archived redo log file backup sets cannot be incremental(they are full by default)

A backup set can be written to disk or tape. Oracle provides one tape output by default for most platforms, known as SBT_TAPE(System Backup to Tape), which writes to a tape device when you are using a media manager. (SBT_TAPE, 可见不是磁带的意思, 是一种介质的总称, 只用这种就可以了应该 )

A restore operation must extract files from a backup set before recovery. ( backup set 的格式, 是rman 特有的一种格式, 当需要使用备份的内容恢复数据库时, 需要先将备份集的这种格式转换一下 )

image

1个Piece 可以横跨多个 datafile.

A logical backup set usually only has one backup piece. A backup piece is a single physical file that can

contain one or more Oracle datafiles or archived logs.

backup piece 可以通过 ls 等 linux 命令直接查看了.

例如简单的快速备份, backup database format ‘/u01/app/oracle/md_%U’;

A logical backup set usually only has one backup piece. A backup piece is a single physical file that can contain one or more Oracle datafiles or archived logs.

注意:

image

要限制 backup piece size, 因为有可能超出物理限制( 比如操作系统最大单个文件限制 )

image

When using the BACKUP command, you must do the following :

  • Mount or open the target database. Recovery Manager allows you to make an inconsistent backup if the database is in Archivelog mode, but you must apply redo logs to make the backups consistent for use in recovery operations.
  • Manually allocate a channel for execution of the BACKUP command if you are not using automatic channel allocation.

image

filesperset = 2; 表示备份集里有 2 个备份片

image

image

image

image

image

image

You can configure parallel backups by setting the PARALLELISM option of the CONFIGURE command to greater than 1 or manually allocate multiple channels, RMAN parallelizes its operation and writes multiple backup sets in parallel. The server sessions divide the work of backing up the specified files.

image

image

image

备份控制文件的 4 种方法 :

1. 设置自动备份为 auto

2. backup current controlfile;

3. backup datafile  include current controlfile;

4. sql “ alter database backup controlfile to ‘’/tmp/wilson.bin’’”;

image

一般备份 control file 和 spfile 会一起备份起来

备份归档日志文件 archivelog ( 实际上就是文件 copy )

image

所有的 归档文件都要一起拷贝下来.

image

image

image

DELETE ALL INPUT 为了避免重复( 已经备份的archivelog 就直接删除 )

backup database plus archivelog format ‘/u01/backup/db_%U’;

image

image

image

最多可以支持 4 份同样备份集, 多路备份.

backup copies=2

image

镜像拷贝不是很重要(当然, 还不如操作系统层面下直接手动备份呢.)

通过RMAN的镜像拷贝, 控制文件是知道的,而如果只是操作系统操作,那么控制文件就不知道

image

image

image

或者 backup as copy datafile …

image

image

image

image

full backup, whole backup 区别:

whole backup: 整个数据库备份

full backup: 可能是整个tablespace的一个全备.

When performing a fullbackup, an oracle server process reads the entire file and copies all blocks into the backup set, skipping only datafile blocks that have nerver neen used. The server session does not skip blocks when backing up archived redo logs or control files. A full backup is not a part of the incremental backup strategy. You can create and resotre full backups of datafiles, datafile copies, tablespaces, database, control files, archivelog logs and archive log copies. Note that backup sets containing archived redo logs are always full backups.

A full backup differs from a whole database backup, A whole backup is comprised of all of the datafiles and

control file of the target database, whereas a full backup may contain one or more of the datafiles, the control

file or archived redo log files.

differential incremental: 比同级或者同级更低的modified备份.

Incremental Backup

An incremental backup is a backup that includes only the blocks that have changed since a previous incremental backup. 两种类型:

  • Differential backup - 差异备份, the default type of incremental backup which backs up all blocks changed after the most recent backup at level n or lower, 即同级别或者级别更低的, 但是是最后一次的备份, 如果出现差异, 那么就备份这些差异.
  • Cumulative backup - 累积备份, backs up all blocks changed after the most recent backup at level n-1 or lower, 肯定在自己下一层或者更低的备份, 注意, 这种累计备份的含义, 顾名思义, 是要将之前备份的内容, 还有差异的内容一起再备份一遍.

下边的图, 很清晰的说明了差异备份和累积备份.

image

优点: 备份快.

缺点: 恢复慢.

image

优点: 备份慢.

缺点: 恢复快.

image

例如: (案例分析)

You are maintaining a 100GB database, which is continuously growing. Based on existing hardware, you determine that open backups of the entire database take 4 hours. The database is online 24 hours a day, 7 days a week and the backups are consuming too much of the system resources during this period of thime. Level 0 backups cannot be performed more than once a week, but fast recovery in case of failure is required. You therefore decide on the following backup and recovery strategy:

A level 0 backup will be performed each week on the day with the least acticity. You determine this day to be Sunday.

RMAN> BACKUP INFCREMENTAL level 0 database;  -- 对整个数据库进行 level 0 全备

Incremental level 2 backups will be performed every other day, except Wednesday. In this way, (注意, 每周三做了一个累积备份), backups will be fast because only changed blocks from the previous day will be copied:

RMAN> BACKUP INCREMENTAL level 2 database;   -- 差异备份

Wednesday is a day with less database activity, so all blocks changed since Sunday are copied to assist with speed of recovery. For example, if a failure occures on Friday, then only Sunday, Wednesday, and Thursday backups need to be restored(Monday and Tuesday are not required):

RMAN> BACKUP INCREMENTAL level 1 database;   -- 累积备份

On Thursday, the incremental backup was replaced by a full backup. Because this does not change the backup base level, Friday’s backup copy changes since Wednesday. The backup therefore can be discarded before the next level 0. If by mistake the backup on Thusday was a level 0, then the backup on Friday copys all changed blocks since Thursday, which is the new base level. This backup must now be kept until the next level 0. ?

image

incremental 0 级备份可以作为 增量备份的基础, 全备不可以.

累积备份的特点是, 同一个level, 后边的备份会将前边的备份的内容, 同样备份, 这样, 当发生 recovery 时, 同一个level 的backup set, 只要执行最后一个就可以了.

例如:

RMAN> BACKUP INCREMENTAL levle 2 cumulative database;

image

备份策略:

0 级备份固定时间间隔

每天做一个差异备份, 灵活搭配 c 和 d ( d: different incremental backup, c: cumulative backup )

image

基本上不用考虑, 基本上所有的数据库都是 archivelog 模式.

另外自动备份 control file.

SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE disk TO ‘controlfile_%F’;

注意: 这个格式, 默认的只是 %F, 修改格式里边必须包含 %F, 例如 control_%F.

image

给backup 文件起一个好一点的逻辑名字

image

image

image

相关文章:

异步使用委托delegate --- BeginInvoke和EndInvoke方法

当我们定义一个委托的时候,一般语言运行时会自动帮委托定义BeginInvoke 和 EndInvoke两个方法,这两个方法的作用是可以异步调用委托。 方法BeginInvoke有两个参数: AsyncCallBack:回调函数,是一个委托,没有…

C语言网络编程:TCP编程模型

编程模型 TCP编程模型如下 TCP服务器的工作过程如下: 服务器创建一个专门的“文件描述符”来监听来自客户端的“三次握手”,然后建立链接链接建立成功后,服务器会分配一个专门的“通信文件描述符”,用于实现与该客户端的通信 …

九度 1553:时钟(模拟题)

题目描述:如图,给定任意时刻,求时针和分针的夹角(劣弧所对应的角)。 输入:输入包含多组测试数据,每组测试数据由一个按hh:mm表示的时刻组成。 输出:对于每组测试数据,输出一个浮点数&#xff0c…

python3.7.4安装教程桌面_Python 3.7.4 for Windows的安装

一、Python简介Python是一款通用型的计算机程序设计语言,Python对编程人员来讲是一款很是有利的工具,可让您快速编写代码,并且代码运行速度很是快。Python具备很是简捷而清晰的语法特色,适合完成各类高层任务,几乎能够…

CSS 合法颜色值

2019独角兽企业重金招聘Python工程师标准>>> 连接地址:http://www.w3school.com.cn/css/css_colors_legal.asp 转载于:https://my.oschina.net/syc2013/blog/109970

SQL 关于apply的两种形式cross apply 和 outer apply

SQL 关于apply的两种形式cross apply 和 outer apply阅读目录 SQL 关于apply的两种形式cross apply 和 outer applySql学习第四天——SQL 关于with cube ,with rollup 和 grouping回到目录SQL 关于apply的两种形式cross apply 和 outer apply SQL 关于apply的两种形…

C语言网络编程:TCP客户端实现

文章目录客户端通信步骤为什么客户端没有bind和listen客户端connect函数介绍局域网内客户端和服务器通信代码实例客户端通信步骤 根据基本TCP网络通信编程模型 我们可以知道客户端的实现主要有几个步骤 socket创建客户端通信的套接字文件,并指定通信的协议族和数…

java不能对什么类型进行转换_关于java:“不兼容类型:void无法转换为…”是什么意思?...

Java编译消息是什么:"Incompatible types: void cannot be converted to ..."的意思,以及我该如何解决。 一些编译器使用不同的措词; 例如"Type mismatch: cannot convert from void to ..."要么"Incompatible type…

屏蔽Drupal中的“Notice: Undefined index”警告

原因:drupal默认使用E_ALL,即输出所有错误和警告。我们只需要修改错误显示级别即可。 方法: 1. 打开\sites\default\settings.php 追加一行 ini_set(error_reporting, E_ALL ^ E_NOTICE); 这句话的意思是输出除了所有警告的所有错误。 注意该…

【AJAX】DWR入门教程

DWR(Direct Web Remoting)是一个WEB远程调用框架.利用这个框架可以让AJAX开发变得很简单.利用DWR可以在客户端利用JavaScript直接调用服务端的Java方法并返回值给JavaScript就好像直接本地客户端调用一样(DWR根据Java类来动态生成JavaScrip代码).它的最新版本DWR0.6添加许多特性…

$.ajax居然触发popstate事件?

我使用$.ajax用来实现一个搜索效果 近段时间因为苹果上微信浏览器的不知明原因需要处理返回事件,因此加多了popstate事件监听用来分别处理苹果跟安卓的返回。 可是居然影响到了我前面的ajax搜索功能,异常情况是:点击搜索按钮-调用ajax请求-直…

C语言网络编程:UDP通信实现

文章目录UDP的特点:UDP的用途UDP编程模型UDP通信代码实现UDP的特点: udp 协议是一种无链接的不可靠传输协议,且UDP每次发送到分组数据大小都是固定的,它的主要特点如下: 不建立连接没有应答机制不会根据网络状况的好坏…

智能跳过节假日算法java_java计算两个日期之前的天数实例(排除节假日和周末)...

java计算两个日期之前的天数实例(排除节假日和周末)发布时间:2020-09-02 23:07:01来源:脚本之家阅读:108作者:jingxian如题所说,计算两个日期之前的天数,排除节假日和周末。这里天数的类型为double&#xf…

一步步学习SPD2010--第十四章节--在Web页面使用控件(3)--验证用户数据输入

通过使用验证控件,你可以验证用户输入到控件的数据。插入的控件可以是HTML标签或者标准ASP.NET控件。 在本次练习中,你创建数据输入表单,并使用RequiredFieldValidation控件来强制输入。 转载于:https://www.cnblogs.com/crazygolf/p…

【C#】Gif文件生成

使用codeplex的GifCreator http://gifcreator.codeplex.com 来处理Gif文件 引用库文件Gif.Components.dll 1、把Gif文件转成Png文件 /// <summary>/// 把Gif文件转成Png文件&#xff0c;放在directory目录下/// </summary>/// <param name"file">&…

深度学习各种环境问题积累

1. Pytorch 首先要安装anaconda&#xff1a; 推荐清华镜像 https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/ 拖到最后&#xff0c;下载最新版即可。 安装完毕要安装pytorch运行环境&#xff1a; # If your main Python version is not 3.5 or 3.6 conda create -n te…

C语言网络编程:TCP实现多线程实现多客户端

TCP通信的编程模型如下&#xff1a; TCP通信是必须要有一个服务器&#xff0c;通过accept函数与客户端socket进行三次握手连接创建的通信描述符与客户端进行数据传输。 此时可以将accept函数的连接设置为多线程形式&#xff0c;轮训监听&#xff0c;每获取到一个客户端的连接&…

Linux C连接Mysql

首先确定系统上安装了GCC和MYSQL了没有, 如果没有先安装.CentOS用 yum -y install gcc yum -y install mysql-server 此外还必须安装mysql-devel 安装成功检测: [rootliu mysql]# rpm -qa | grep gcc libgcc-4.4.7-4.el6.x86_64 gcc-4.4.7-4.el6.x86_64 [rootliu mysql]# rpm…

java servlet 多线程_Servlet的多线程和线程安全

线程安全首先说明一下对线程安全的讨论&#xff0c;哪种情况我们可以称作线程安全&#xff1f;网上对线程安全有很多描述&#xff0c;我比较喜欢《Java并发编程实战》给出的定义&#xff0c;“当多个线程访问某个类时&#xff0c;不管运行时环境采用何种调度方式&#xff0c;或…

JMeter 聚合报告之 90% Line 参数说明

其实要说明这个参数的含义非常简单&#xff0c;可能你早就知道他的含义&#xff0c;但我对这个参数一直有误解&#xff0c;而且还一直以为是“真理”&#xff0c;原于一次面试&#xff0c;被问到了这个问题&#xff0c;所以引起我这个参数的重新认识。 先说说我错误的认识&…

CCF-碰撞的小球

问题描述数轴上有一条长度为L&#xff08;L为偶数)的线段&#xff0c;左端点在原点&#xff0c;右端点在坐标L处。有n个不计体积的小球在线段上&#xff0c;开始时所有的小球都处在偶数坐标上&#xff0c;速度方向向右&#xff0c;速度大小为1单位长度每秒。当小球到达线段的端…

C语言网络编程:多路IO select实现多客户端

文章目录阻塞式的服务器程序多线程服务器程序非阻塞式服务器程序基于事件响应的服务器程序事件响应服务器程序的实现select阻塞式的服务器程序 我们接触过最多的最基础的网络通信模型为TCP/UDP通信模型&#xff0c;以下为TCP通信模型的基本流程C语言网络编程&#xff1a;TCP客…

MVC 中的 ViewModel

此文章总结自&#xff1a;http://rachelappel.com/use-viewmodels-to-manage-data-amp-organize-code-in-asp.net-mvc-applications ViewModel 这个概念不只是在在MVC模式中有&#xff0c;你会在很多关于MVC、MVP、MVVM的文章中见到这个说法&#xff0c;并且这个概念在任何技术…

java udp tcp协议_【java】TCP和UDP传输协议

TCP协议和UDP协议的比较TCP的全称是Transmission Control Protocol (传输控制协议)传输控制协议&#xff0c;是一种面向连接的协议&#xff0c;类似打电话在通信的整个过程中保持连接保证了数据传递的可靠性和有序性是一种全双工的字节流通信方式服务器压力比较大&#xff0c;资…

dot3_bump_mapping

为什么80%的码农都做不了架构师&#xff1f;>>> //----------------------------------------------------------------------------- // Name: ogl_dot3_bump_mapping.cpp // Author: Kevin Harris // Last Modified: 04/21/05 // Descript…

WPF入门教程-转载

最近为了做炫酷的UI&#xff0c;了解了WPF&#xff0c;之前一直是使用winform的&#xff0c;界面也是古老的不行。在园里找到了一个大佬以前写的教程&#xff0c;备注一下。按照系列教程走下来&#xff0c;可以直接上手了。备忘传送门>>>link&#xff1a;DotNet菜园-W…

记一次shell脚本推后台stopped的问题

我们知道linux 下shell可以被分为交互式脚本和非交互式脚本。 交互式脚本即 输入命令之后shell会等待你的输入&#xff0c;当你输入之后命令会被立即提交从而执行。这个时候我们常见的终端bash&#xff0c;以及login提示等都是交互式命令。 非交互式脚本即shell解释器不需要等待…

封装,继承,多态

一、封装&#xff1a; 封装是实现面向对象程序设计的第一步&#xff0c;封装就是将数据或函数等集合在一个个的单元中&#xff08;我们称之为类&#xff09;。被封装的对象通常被称为抽象数据类型。 封装的意义&#xff1a;   封装的意义在于保护或者防止代码&#xff08;数据…

java将一个数转成36进制的数_编程实现将一个N进制数转换成M进制数。

python: 手写算法版&#xff1a; def conversion_num(num, src, dest): rtn # 1、校验源和目标是否相同 if src dest: rtn num # 2、转成10进制# if src ! 10: num_str str(num) num_str num_str[::-1] exe_num 0 dec_num 0 for num_char in num_str: # 十六进制处理 i…

iOS之Storyboard导航大揭秘(1)

本文使用的软件版本&#xff1a; IOS&#xff1a;6.1 XCode&#xff1a;4.6 Storyboard&#xff08;故事板&#xff09;是XCode4.2才开始支持的&#xff0c;为了使设计View更容易。尽管用以前的nib&#xff08;xib&#xff09;拖拖拽拽也没问题&#xff0c;不过却需要 在各种文…