当前位置:操作系统 > Unix/Linux >>

[每日一题] 11gOCP 1z0-053 :2013-10-9 backup with the KEEP option

[每日一题] 11gOCP 1z0-053 :2013-10-9 backup with the KEEP option
 
 
正确答案:AB
      在Oracle 11g中,可以使用backup ….keep命令保留比RMAN备份保留策略所指定的时间更长的备份。使用这个命令,可以构造能保留数年的归档备份,以满足特定的目的,如满足管理需求等。也可以出于测试目的,利用归档备份对数据库进行定期还原。这些归档备份包含还原和恢复一个数据库必需的所有文件。
在Oracle 10g中,使用keep选项覆盖一个备份已配置的保留策略。Keep选项使备份不受一个指定时间段的保留策略的限制。Keep forever选项(需要一个恢复目录)规定一个备份或副本永不过期。在Oracle 11g中,用keep 和keep forever选项完成与以前基本相同的事情,但是来自以前版本某些选项现在不用了,现在有一个的选项,名为restore point。因为backup keep命令的归档备份特性的核心,我从几个方面来介绍一下这条命令。
1、  Oracle 10g中的backup ….keep命令
在Oracle 11g之前,backup … keep命令有以下几个选:
■keep标记不受限制(exempt),unkeep标记备份受所配置的备份保留策略的限制;
■logs指出只要相关的备份可用,RMAN就必须保留恢复所需要的归档重做日志,nologs选项指出不保留恢复备份的归档重做日志;
■forever和until time指出一个备份不受所配置的备份保留策略限制的时间长度。
  如果指定keep forever子句,则必须使用恢复目录。
   
2、  backup … keep命令更改
在backup …keep命令的新版中,保留keep、 nokeep 、forever和until time选顶。但是不再有logs和nologs选项,增加了一个新选项restore point。Restore point选项让RMAN自动创建一个还原点,此还原点对应于RMAN必须将目标数据库备份恢复的SCN,以保持数据库的一致。换句话说,restore point子句指出RMAN可恢复归档备份的时间。当然,在使用restore point子句时,必须指定一个还原点。
 
3、  归档备份
Oracle 11g中的backup … keep命令的用途是指某个备份为一个独立的归档备份,不受所配置的任何备份保留策略的限制。除了不受备份保留策略的限制之外,在还原和恢复数据库所需的所有文件都是归档备份的成份这个意义下,该归档备份还是一个包括一切的备份(all-inclusive backup)。注意,这个包括一切的归档备份被备份到单一磁盘或磁带上。归档备份可以用于历史用途,或者用来在供测试的另一个系统上还原生产数据库。
  以前,如果保留联机备份一个较长时间段。RMAN将自动对该时间段保留所有归档重做日志,以备你想进行该时间段中的一个时间恢复。归档备份会有少许不同,因为你的目的并不是时间恢复,而是需要保留一个备份指定的时间长度,同时保留恢复该备份所需的归档重做日志。因此,在指定keep选项(keep forever和keep until)时,RMAN只保留数据文件的备份、恢复联机备份所需的归档重做日志和必要的自动备份文件。从而,归档备份作为一个整体比保留通常的RMAN备份一段时间所占的空间要少得多。
 
4、  创建归档备份
创建归档备份有两种方法。
方法一,可使用backup …keep命令创建不受保留策略限制的备份。
[html] 
RMAN> backup database   
format '/backup/rman/%U'  
keep until time 'sysdate+30'  
restore point firstmonth;2> 3> 4>   
  
Starting backup at 09-OCT-13  
using target database control file instead of recovery catalog  
current log archived  
  
allocated channel: ORA_DISK_1  
channel ORA_DISK_1: SID=147 device type=DISK  
backup will be obsolete on date 08-NOV-13  
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=00001 name=/u01/app/oracle/oradata/ocm/system01.dbf  
input datafile file number=00002 name=/u01/app/oracle/oradata/ocm/sysaux01.dbf  
input datafile file number=00005 name=/u01/app/oracle/oradata/ocm/example01.dbf  
input datafile file number=00003 name=/u01/app/oracle/oradata/ocm/undotbs01.dbf  
input datafile file number=00006 name=/u01/app/oracle/oradata/ocm/gyj01.dbf  
input datafile file number=00007 name=/u01/app/oracle/oradata/ocm/gyj02.dbf  
input datafile file number=00008 name=/u01/app/oracle/oradata/ocm/tp01.dbf  
input datafile file number=00009 name=/u01/app/oracle/oradata/ocm/mrkt01.dbf  
input datafile file number=00004 name=/u01/app/oracle/oradata/ocm/users01.dbf  
channel ORA_DISK_1: starting piece 1 at 09-OCT-13  
channel ORA_DISK_1: finished piece 1 at 09-OCT-13  
piece handle=/backup/rman/17om02gs_1_1 tag=TAG20131009T165347 comment=NONE  
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55  
  
using channel ORA_DISK_1  
backup will be obsolete on date 08-NOV-13  
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 09-OCT-13  
channel ORA_DISK_1: finished piece 1 at 09-OCT-13  
piece handle=/backup/rman/18om02ik_1_1 tag=TAG20131009T165347 comment=NONE  
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01  
  
  
current log archived  
using channel ORA_DISK_1  
backup will be obsolete on date 08-NOV-13  
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=88 RECID=74 STAMP=828377685  
channel ORA_DISK_1: starting piece 1 at 09-OCT-13  
channel ORA_DISK_1: finished piece 1 at 09-OCT-13  
piece handle=/backup/rman/19om02im_1_1 tag=TAG20131009T165347 comment=NONE  
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01  
  
using channel ORA_DISK_1  
backup will be obsolete on date 08-NOV-13  
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 09-OCT-13  
channel ORA_DISK_1: finished piece 1 at 09-OCT-13  
piece handle=/backup/rman/1aom02in_1_1 tag=TAG20131009T165347 comment=NONE  
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01  
Finished backup at 09-OCT-13  
 
      这个例子中使用了keep until time子句,它使RMAN在指定(sysdate+30)时间一过就标记此备份为废弃的。当然,如果指定的是keep forever子句,此备份将永不废弃。也就是说,此备份将永远不被备份保留策略删除。
 
[html] 
RMAN> backup database   
2> format '/backup/rman/%U'  
3> keep forever  
4> restore point firstforever;  
  
Starting backup at 09-OCT-13  
current log archived  
  
using channel ORA_DISK_1  
RMAN-00571: =========================
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,