ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Oracle11新特性——备份恢复功能增强(五)

Oracle11新特性——备份恢复功能增强(五)

原创 Linux操作系统 作者:yangtingkun 时间:2007-11-24 00:00:00 0 删除 编辑

打算写一系列的文章介绍11g的新特性和变化。

Oracle11g在备份和恢复方面新增了很多的功能,无论是性能、功能性、安全性和可操作性方面都有了不同程度的提高。

这一篇介绍RMAN对长期备份的优化。

Oracle11新特性——备份恢复功能增强(一):http://yangtingkun.itpub.net/post/468/412991

Oracle11新特性——备份恢复功能增强(二):http://yangtingkun.itpub.net/post/468/414647

Oracle11新特性——备份恢复功能增强(三):http://yangtingkun.itpub.net/post/468/414834

Oracle11新特性——备份恢复功能增强(四):http://yangtingkun.itpub.net/post/468/414941


Oracle11g对于长期备份进行了优化,在以前的版本中,如果指定LOGS则意味着以后所有的日志都不会OBSOLETE。而如果指定NOLOGS则这个备份无法进行恢复。

11g中,rman会把维护数据库一致性的日志包含在结果集中,不会影响到后面日志的判断。

10g中备份keep forever必须添加logsnologs选项:

RMAN> backup keep forever database;

MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558:
分析输入命令时出错
RMAN-01009:
语法错误: 找到 "database": 应为: "consistent, logs, nologs" 中的一个
RMAN-01007:
在第 1 行第 21 , 文件: standard input

MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558:
分析输入命令时出错
RMAN-01009:
语法错误: 找到 ";": 应为: "allocate, alter, backup, beginline, blockrecover, catalog, change, connect, copy, convert, create, crosscheck, configure, duplicate, debug, delete, drop, exit, endinline, flashback, host, {, library, list, mount, open, print, quit, recover, register, release, replace, report, renormalize, reset, restore, resync, rman, run, rpctest, set, setlimit, sql, switch, spool, startup, shutdown, send, show, test, transport, upgrade, unregister, validate" 中的一个
RMAN-01007:
在第 1 行第 29 , 文件: standard input

RMAN> backup keep forever logs database;

启动 backup 25-9 -07使用通道 ORA_DISK_1使用通道 ORA_DISK_2备份永远不会废弃备份失效时, 从该备份恢复所需的存档日志也会失效通道 ORA_DISK_1: 启动全部数据文件备份集通道 ORA_DISK_1: 正在指定备份集中的数据文件输入数据文件 fno=00001 name=/data1/oradata/test/test/system01.dbf输入数据文件 fno=00002 name=/data1/oradata/test/test/undotbs01.dbf通道 ORA_DISK_1: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 启动全部数据文件备份集通道 ORA_DISK_2: 正在指定备份集中的数据文件输入数据文件 fno=00003 name=/data1/oradata/test/test/sysaux01.dbf输入数据文件 fno=00004 name=/data1/oradata/test/test/users01.dbf输入数据文件 fno=00005 name=/data1/oradata/test/test/yangtk01.dbf通道 ORA_DISK_2: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1gispp9n_1_1 标记=TAG20070925T023014 注释=NONE通道 ORA_DISK_2: 备份集已完成, 经过时间:00:00:15通道 ORA_DISK_1: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1fispp9n_1_1 标记=TAG20070925T023014 注释=NONE通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:18完成 backup 25-9 -07

启动 Control File and SPFILE Autobackup 25-9 -07 handle=/data1/backup/test/c-1920405094-20070925-05 comment=NONE完成 Control File and SPFILE Autobackup 25-9 -07

RMAN> backup archivelog all;

启动 backup 25-9 -07当前日志已存档使用通道 ORA_DISK_1使用通道 ORA_DISK_2通道 ORA_DISK_1: 正在启动存档日志备份集通道 ORA_DISK_1: 正在指定备份集中的存档日志输入存档日志线程 =1 序列 =102 记录 ID=107 时间戳=634184611通道 ORA_DISK_1: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 正在启动存档日志备份集通道 ORA_DISK_2: 正在指定备份集中的存档日志输入存档日志线程 =1 序列 =103 记录 ID=108 时间戳=634185679通道 ORA_DISK_2: 正在启动段 1 25-9 -07通道 ORA_DISK_1: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1iisppui_1_1 标记=TAG20070925T024121 注释=NONE通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:02通道 ORA_DISK_2: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1jisppui_1_1 标记=TAG20070925T024121 注释=NONE通道 ORA_DISK_2: 备份集已完成, 经过时间:00:00:02完成 backup 25-9 -07

启动 Control File and SPFILE Autobackup 25-9 -07 handle=/data1/backup/test/c-1920405094-20070925-06 comment=NONE完成 Control File and SPFILE Autobackup 25-9 -07

RMAN> backup database plus archivelog;

启动 backup 25-9 -07当前日志已存档使用通道 ORA_DISK_1使用通道 ORA_DISK_2通道 ORA_DISK_1: 正在启动存档日志备份集通道 ORA_DISK_1: 正在指定备份集中的存档日志输入存档日志线程 =1 序列 =102 记录 ID=107 时间戳=634184611通道 ORA_DISK_1: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 正在启动存档日志备份集通道 ORA_DISK_2: 正在指定备份集中的存档日志输入存档日志线程 =1 序列 =103 记录 ID=108 时间戳=634185679输入存档日志线程 =1 序列 =104 记录 ID=109 时间戳=634185710通道 ORA_DISK_2: 正在启动段 1 25-9 -07通道 ORA_DISK_1: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1lisppvg_1_1 标记=TAG20070925T024152 注释=NONE通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:02通道 ORA_DISK_2: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1misppvg_1_1 标记=TAG20070925T024152 注释=NONE通道 ORA_DISK_2: 备份集已完成, 经过时间:00:00:02完成 backup 25-9 -07

启动 backup 25-9 -07使用通道 ORA_DISK_1使用通道 ORA_DISK_2通道 ORA_DISK_1: 启动全部数据文件备份集通道 ORA_DISK_1: 正在指定备份集中的数据文件输入数据文件 fno=00001 name=/data1/oradata/test/test/system01.dbf输入数据文件 fno=00002 name=/data1/oradata/test/test/undotbs01.dbf通道 ORA_DISK_1: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 启动全部数据文件备份集通道 ORA_DISK_2: 正在指定备份集中的数据文件输入数据文件 fno=00003 name=/data1/oradata/test/test/sysaux01.dbf输入数据文件 fno=00004 name=/data1/oradata/test/test/users01.dbf输入数据文件 fno=00005 name=/data1/oradata/test/test/yangtk01.dbf通道 ORA_DISK_2: 正在启动段 1 25-9 -07通道 ORA_DISK_2: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1oisppvj_1_1 标记=TAG20070925T024154 注释=NONE通道 ORA_DISK_2: 备份集已完成, 经过时间:00:00:15通道 ORA_DISK_1: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1nisppvj_1_1 标记=TAG20070925T024154 注释=NONE通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:18完成 backup 25-9 -07

启动 backup 25-9 -07当前日志已存档使用通道 ORA_DISK_1使用通道 ORA_DISK_2通道 ORA_DISK_1: 正在启动存档日志备份集通道 ORA_DISK_1: 正在指定备份集中的存档日志输入存档日志线程 =1 序列 =105 记录 ID=110 时间戳=634185733通道 ORA_DISK_1: 正在启动段 1 25-9 -07通道 ORA_DISK_1: 已完成段 1 25-9 -07段句柄=/data1/backup/test/1pispq08_1_1 标记=TAG20070925T024216 注释=NONE通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:02完成 backup 25-9 -07

启动 Control File and SPFILE Autobackup 25-9 -07 handle=/data1/backup/test/c-1920405094-20070925-07 comment=NONE完成 Control File and SPFILE Autobackup 25-9 -07

RMAN> crosscheck archivelog all;

释放的通道: ORA_DISK_1释放的通道: ORA_DISK_2分配的通道: ORA_DISK_1通道 ORA_DISK_1: sid=134 devtype=DISK分配的通道: ORA_DISK_2通道 ORA_DISK_2: sid=133 devtype=DISK对归档日志的验证失败存档日志文件名 =/data1/oradata/test/archivelog/1_102_622258662.dbf 记录 ID=107 时间戳 =634184611对归档日志的验证失败存档日志文件名 =/data1/oradata/test/archivelog/1_103_622258662.dbf 记录 ID=108 时间戳 =634185679对归档日志的验证失败存档日志文件名 =/data1/oradata/test/archivelog/1_104_622258662.dbf 记录 ID=109 时间戳 =634185710对归档日志的验证失败存档日志文件名 =/data1/oradata/test/archivelog/1_105_622258662.dbf 记录 ID=110 时间戳 =634185733已交叉检验的 4 对象


RMAN> report obsolete;

RMAN 保留策略将应用于该命令 RMAN 保留策略设置为冗余 1已废弃的备份和副本报表类型 关键字 完成时间 文件名/句柄
-------------------- ------ ------------------ --------------------
存档日志 664 25-9 -07 /data1/oradata/test/archivelog/1_102_622258662.dbf备份集 817 25-9 -07 备份段 820 25-9 -07 /data1/backup/test/c-1920405094-20070925-05备份集 865 25-9 -07 备份段 869 25-9 -07 /data1/backup/test/1iisppui_1_1备份集 886 25-9 -07 备份段 888 25-9 -07 /data1/backup/test/c-1920405094-20070925-06备份集 941 25-9 -07 备份段 947 25-9 -07 /data1/backup/test/1lisppvg_1_1

在10g中,由于指定了LOGSKEEP FOREVER备份,所以随后的所有ARCHIVELOG都不会在认为OBSOLETE

而在11g中,Oracle会将需要的归档日志和数据库备份一起备份,这样不但数据库是可以恢复的,而且不会影响后续归档日志的OBSOLETE判断:

$ rman target / catalog cata_log/cata_log

Recovery Manager: Release 11.1.0.6.0 - Production on Sat Nov 24 17:14:01 2007

Copyright (c) 1982, 2007, Oracle. All rights reserved.

connected to target database: TEST11G (DBID=790993044)
connected to recovery catalog database

RMAN> backup keep forever database;

Starting backup at 24-NOV-07
current log archived

using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/data/oracle/oradata/test11g/undotbs01.dbf
input datafile file number=00002 name=/data/oracle/oradata/test11g/sysaux01.dbf
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
input datafile file number=00005 name=/data/oracle/oradata/test11g/yangtk01.dbf
input datafile file number=00004 name=/data/oracle/oradata/test11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2ij1saao_1_1 tag=TAG20071124T175427 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:26

current log archived
using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=89 RECID=33 STAMP=639511036
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2jj1safv_1_1 tag=TAG20071124T175427 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2kj1sagj_1_1 tag=TAG20071124T175427 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01

using channel ORA_DISK_1
backup will never be obsolete
archived logs required to recover from this backup will be backed up
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2lj1sah6_1_1 tag=TAG20071124T175427 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-NOV-07

RMAN> backup archivelog all;

Starting backup at 24-NOV-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=88 RECID=32 STAMP=639510869
input archived log thread=1 sequence=89 RECID=33 STAMP=639511036
input archived log thread=1 sequence=90 RECID=34 STAMP=639511805
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2mj1sb80_1_1 tag=TAG20071124T181008 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-NOV-07

RMAN> backup database plus archivelog;


Starting backup at 24-NOV-07
current log archived
using channel ORA_DISK_1
skipping archived log file /data/oradata/test11g/archivelog/1_88_639087572.dbf; already backed up 1 time(s)
skipping archived log file /data/oradata/test11g/archivelog/1_89_639087572.dbf; already backed up 1 time(s)
skipping archived log file /data/oradata/test11g/archivelog/1_90_639087572.dbf; already backed up 1 time(s)
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=91 RECID=35 STAMP=639512716
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2nj1sc4f_1_1 tag=TAG20071124T182518 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-NOV-07

Starting backup at 24-NOV-07
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00003 name=/data/oracle/oradata/test11g/undotbs01.dbf
input datafile file number=00002 name=/data/oracle/oradata/test11g/sysaux01.dbf
input datafile file number=00001 name=/data/oracle/oradata/test11g/system01.dbf
input datafile file number=00005 name=/data/oracle/oradata/test11g/yangtk01.dbf
input datafile file number=00004 name=/data/oracle/oradata/test11g/users01.dbf
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2oj1sc53_1_1 tag=TAG20071124T182538 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:35
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2pj1scag_1_1 tag=TAG20071124T182538 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-NOV-07

Starting backup at 24-NOV-07
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=92 RECID=36 STAMP=639512934
channel ORA_DISK_1: starting piece 1 at 24-NOV-07
channel ORA_DISK_1: finished piece 1 at 24-NOV-07
piece handle=/data/backup/2qj1scb9_1_1 tag=TAG20071124T182856 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 24-NOV-07

RMAN> crosscheck archivelog all;

released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=66 device type=DISK
validation succeeded for archived log
archived log file name=/data/oradata/test11g/archivelog/1_88_639087572.dbf RECID=32 STAMP=639510869
validation succeeded for archived log
archived log file name=/data/oradata/test11g/archivelog/1_89_639087572.dbf RECID=33 STAMP=639511036
validation succeeded for archived log
archived log file name=/data/oradata/test11g/archivelog/1_90_639087572.dbf RECID=34 STAMP=639511805
validation succeeded for archived log
archived log file name=/data/oradata/test11g/archivelog/1_91_639087572.dbf RECID=35 STAMP=639512716
validation succeeded for archived log
archived log file name=/data/oradata/test11g/archivelog/1_92_639087572.dbf RECID=36 STAMP=639512934
Crosschecked 5 objects

RMAN> report obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type Key Completion Time Filename/Handle
-------------------- ------ ------------------ --------------------
Archive Log 352 24-NOV-07 /data/oradata/test11g/archivelog/1_88_639087572.dbf
Archive Log 372 24-NOV-07 /data/oradata/test11g/archivelog/1_89_639087572.dbf
Archive Log 436 24-NOV-07 /data/oradata/test11g/archivelog/1_90_639087572.dbf
Archive Log 488 24-NOV-07 /data/oradata/test11g/archivelog/1_91_639087572.dbf
Backup Set 458 24-NOV-07
Backup Piece 460 24-NOV-07 /data/backup/2mj1sb80_1_1
Backup Set 516 24-NOV-07
Backup Piece 522 24-NOV-07 /data/backup/2nj1sc4f_1_1

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-69513/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10366089