[20170626]rman merge例子.txt

简介: [20170626]rman merge例子.txt 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER -----------------...

[20170626]rman merge例子.txt

1.环境:
SCOTT@book> @ &r/ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

2.别人问的问题,要建立备份,不断应用日志,常用的方式如下:

RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database ;
recover copy of database with tag 'incr_update' ;
}

--//但这样数据文件建立在闪回区,采用OMF格式.而如果采用如下方式执行:

RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database format '/home/oracle/backup/%b';
recover copy of database with tag 'incr_update' ;
}
Starting backup at 2017-06-26 10:54:36
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=46 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=56 device type=DISK
no parent backup or copy of datafile 2 found
no parent backup or copy of datafile 3 found
no parent backup or copy of datafile 1 found
no parent backup or copy of datafile 5 found
no parent backup or copy of datafile 4 found
no parent backup or copy of datafile 6 found
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_sysaux_do0xvgb8_.dbf tag=INCR_UPDATE RECID=27 STAMP=947674489
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_undotbs1_do0xvgbh_.dbf tag=INCR_UPDATE RECID=26 STAMP=947674489
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_2: starting datafile copy
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_system_do0xvgbn_.dbf tag=INCR_UPDATE RECID=25 STAMP=947674489
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_3: starting datafile copy
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_example_do0xvxh1_.dbf tag=INCR_UPDATE RECID=30 STAMP=947674494
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_users_do0xvxlr_.dbf tag=INCR_UPDATE RECID=29 STAMP=947674494
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/fast_recovery_area/BOOK/datafile/o1_mf_tea_do0xvxog_.dbf tag=INCR_UPDATE RECID=28 STAMP=947674494
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017-06-26 10:54:54

Starting recover at 2017-06-26 10:54:54
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
no copy of datafile 1 found to recover
no copy of datafile 2 found to recover
no copy of datafile 3 found to recover
no copy of datafile 4 found to recover
no copy of datafile 5 found to recover
no copy of datafile 6 found to recover
Finished recover at 2017-06-26 10:54:54

Starting Control File and SPFILE Autobackup at 2017-06-26 10:54:54
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_06_26/o1_mf_s_947674494_do0xvz0h_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-06-26 10:54:55

RMAN> **end-of-file**

--//可以发现这样不行.指定format无效.虽然以上脚本一直可以应用,主要是文件名采用OMF格式.数据文件放在闪回区.
--//可以采用如下方式,先备份成datafilecopy文件.然后注册为增量备份.就ok了,看下面的测试.

RMAN> backup as copy  database format '/home/oracle/backup/%b' tag 'incr_update';
Starting backup at 2017-06-26 11:00:16
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/mnt/ramdisk/book/sysaux01.dbf
channel ORA_DISK_2: starting datafile copy
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
channel ORA_DISK_3: starting datafile copy
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
output file name=/home/oracle/backup/sysaux01.dbf tag=INCR_UPDATE RECID=38 STAMP=947674828
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
output file name=/home/oracle/backup/undotbs01.dbf tag=INCR_UPDATE RECID=39 STAMP=947674828
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_2: starting datafile copy
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
output file name=/home/oracle/backup/system01.dbf tag=INCR_UPDATE RECID=37 STAMP=947674828
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_3: starting datafile copy
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
output file name=/home/oracle/backup/example01.dbf tag=INCR_UPDATE RECID=42 STAMP=947674833
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
output file name=/home/oracle/backup/users01.dbf tag=INCR_UPDATE RECID=41 STAMP=947674833
channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:01
output file name=/home/oracle/backup/tea01.dbf tag=INCR_UPDATE RECID=40 STAMP=947674832
channel ORA_DISK_3: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017-06-26 11:00:33
Starting Control File and SPFILE Autobackup at 2017-06-26 11:00:33
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_06_26/o1_mf_s_947674833_do0y6kmk_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-06-26 11:00:34

--//但是这样的文件非0级备份.参考链接:
--//blog.itpub.net/267265/viewspace-1867253/
--//blog.itpub.net/267265/viewspace-1832475/

RMAN> catalog datafilecopy '/home/oracle/backup/system01.dbf' level 0 ;
cataloged datafile copy
datafile copy file name=/home/oracle/backup/system01.dbf RECID=43 STAMP=947675261

catalog datafilecopy '/home/oracle/backup/sysaux01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/example01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/undotbs01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/users01.dbf' level 0 ;
catalog datafilecopy '/home/oracle/backup/tea01.dbf' level 0 ;

--//不知道如何一次搞定.

RMAN> recover copy of database with tag incr_update;
Starting recover at 2017-06-26 11:12:07
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
no copy of datafile 1 found to recover
no copy of datafile 2 found to recover
no copy of datafile 3 found to recover
no copy of datafile 4 found to recover
no copy of datafile 5 found to recover
no copy of datafile 6 found to recover
Finished recover at 2017-06-26 11:12:07
Starting Control File and SPFILE Autobackup at 2017-06-26 11:12:07
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_06_26/o1_mf_s_947675527_do0yw76w_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-06-26 11:12:08

$ cat merge.rman
RUN
{
backup incremental level 1 for recover of copy with tag 'incr_update' database ;
recover copy of database with tag 'incr_update' ;
}

Starting backup at 2017-06-26 11:19:50
using target database control file instead of recovery catalog
channel ORA_DISK_3: SID=46 device type=DISK
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=00002 name=/mnt/ramdisk/book/sysaux01.dbf
input datafile file number=00005 name=/mnt/ramdisk/book/example01.dbf
channel ORA_DISK_1: starting piece 1 at 2017-06-26 11:19:51
channel ORA_DISK_2: starting incremental level 1 datafile backup set
channel ORA_DISK_2: specifying datafile(s) in backup set
input datafile file number=00003 name=/mnt/ramdisk/book/undotbs01.dbf
input datafile file number=00006 name=/mnt/ramdisk/book/tea01.dbf
channel ORA_DISK_2: starting piece 1 at 2017-06-26 11:19:51
channel ORA_DISK_3: starting incremental level 1 datafile backup set
channel ORA_DISK_3: specifying datafile(s) in backup set
input datafile file number=00001 name=/mnt/ramdisk/book/system01.dbf
input datafile file number=00004 name=/mnt/ramdisk/book/users01.dbf
channel ORA_DISK_3: starting piece 1 at 2017-06-26 11:19:52
channel ORA_DISK_1: finished piece 1 at 2017-06-26 11:19:53
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqyz_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_2: finished piece 1 at 2017-06-26 11:19:53
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqz6_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_2: backup set complete, elapsed time: 00:00:02
channel ORA_DISK_3: finished piece 1 at 2017-06-26 11:19:53
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbr04_.bkp tag=INCR_UPDATE comment=NONE
channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01
Finished backup at 2017-06-26 11:19:53

Starting recover at 2017-06-26 11:19:53
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting incremental datafile backup set restore
channel ORA_DISK_1: specifying datafile copies to recover
recovering datafile copy file number=00001 name=/home/oracle/backup/system01.dbf
recovering datafile copy file number=00004 name=/home/oracle/backup/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbr04_.bkp
channel ORA_DISK_2: starting incremental datafile backup set restore
channel ORA_DISK_2: specifying datafile copies to recover
recovering datafile copy file number=00002 name=/home/oracle/backup/sysaux01.dbf
recovering datafile copy file number=00005 name=/home/oracle/backup/example01.dbf
channel ORA_DISK_2: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqyz_.bkp
channel ORA_DISK_3: starting incremental datafile backup set restore
channel ORA_DISK_3: specifying datafile copies to recover
recovering datafile copy file number=00003 name=/home/oracle/backup/undotbs01.dbf
recovering datafile copy file number=00006 name=/home/oracle/backup/tea01.dbf
channel ORA_DISK_3: reading from backup piece /u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqz6_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbr04_.bkp tag=INCR_UPDATE
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:00
channel ORA_DISK_2: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqyz_.bkp tag=INCR_UPDATE
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:00:00
channel ORA_DISK_3: piece handle=/u01/app/oracle/fast_recovery_area/BOOK/backupset/2017_06_26/o1_mf_nnnd1_INCR_UPDATE_do0zbqz6_.bkp tag=INCR_UPDATE
channel ORA_DISK_3: restored backup piece 1
channel ORA_DISK_3: restore complete, elapsed time: 00:00:00
Finished recover at 2017-06-26 11:19:53

Starting Control File and SPFILE Autobackup at 2017-06-26 11:19:53
piece handle=/u01/app/oracle/fast_recovery_area/BOOK/autobackup/2017_06_26/o1_mf_s_947675993_do0zbson_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 2017-06-26 11:19:54

RMAN> **end-of-file**

3.可以做一个简单验证:
$ strings /home/oracle/backup/tea01.dbf | grep -i zzzz

SCOTT@book> create table ttt tablespace tea as select 'zzzzz' name  from dual connect by level<=10;
Table created.

RMAN> @ merge.rman

$ strings /home/oracle/backup/tea01.dbf | grep -i zzzz|wc
     10      10      69

--//说明ok!!

目录
相关文章
|
运维 Cloud Native 持续交付
深入理解云原生架构及其在现代企业中的应用
随着数字化转型的浪潮席卷全球,企业正面临着前所未有的挑战与机遇。云计算技术的迅猛发展,特别是云原生架构的兴起,正在重塑企业的IT基础设施和软件开发模式。本文将深入探讨云原生的核心概念、关键技术以及如何在企业中实施云原生策略,以实现更高效的资源利用和更快的市场响应速度。通过分析云原生架构的优势和面临的挑战,我们将揭示它如何助力企业在激烈的市场竞争中保持领先地位。
325 13
|
网络协议 开发工具 网络虚拟化
SourceTree git 配置代理
SourceTree git 配置代理
587 1
|
关系型数据库 Serverless 分布式数据库
云原生数据库PolarDB
这是一位拥有云原生数据库PolarDB使用经验的运维工程师首次尝试PolarDB的Serverless版本。Serverless架构通过免除服务器管理任务,简化开发流程并降低运维成本,使开发者能够专注于核心业务逻辑。尽管初次接触Serverless可能面临一定的学习曲线,但其带来的灵活性、易于扩展性以及更低的维护复杂度等优势显著。本介绍还详细描述了如何在阿里云平台上创建和配置PolarDB MySQL版Serverless集群,包括申请试用、创建数据库账号、建立数据库、通过DMS连接集群并执行基本的SQL操作,为新手提供了全面的操作还提到了有关Serverless集群的一些特定功能需求和限制。
152 14
|
存储 Kubernetes 微服务
kubernetes简介-这是一篇学习k8s必看的文章
kubernetes简介-这是一篇学习k8s必看的文章
|
SQL NoSQL 关系型数据库
性能与扩展性的考量:SQL vs NoSQL
【8月更文第24天】在选择数据库系统时,开发者和架构师面临着一个关键决策:是选择传统的SQL(结构化查询语言)数据库还是现代的NoSQL(非关系型)数据库。这两种类型各有优劣,尤其是在性能和扩展性方面。本文将深入探讨SQL和NoSQL数据库在这两个方面的差异,并通过具体的代码示例来展示它们各自的优势。
364 0
|
程序员 C语言 Python
[oeasy]python0007_ print函数_字符串_display_电传打字机_程序员的浪漫
[oeasy]python0007_ print函数_字符串_display_电传打字机_程序员的浪漫
130 5
[oeasy]python0007_ print函数_字符串_display_电传打字机_程序员的浪漫
|
设计模式 Java 数据安全/隐私保护
小谈设计模式(4)—单一职责原则
小谈设计模式(4)—单一职责原则
|
运维 监控 Kubernetes
读《SRE:Google运维解密》一点思考
## 0、为什么诞生SRE? + 原因一:企业成本的增长通用户的增长不成线性变化。但是随着系统的复杂度提升,组建越来越多,用户的流量压力也越来越大,相关的变更也会越来越多,各模块之间的变更顺序也会越来越复杂。
4868 0
读《SRE:Google运维解密》一点思考
|
消息中间件 存储 移动开发
【消息中间件】原生PHP对接Uni H5、APP、微信小程序实时通讯消息服务
【消息中间件】原生PHP对接Uni H5、APP、微信小程序实时通讯消息服务
418 0
|
前端开发 Unix 开发者
CSS中常用的颜色格式
CSS中常用的颜色格式
481 0