1. --RMAN备份介质的移动与再恢复测试
  1. ---------------------------------------------------------2013/09/21
  1.  
  1. 由于目前生产环境中没有集中的备份条件,所以备份要考虑到可以移动再恢复性.这里要测试的就是,RMAN全部备份的介质,我关注是否可以定期的移动到其他存储介质中,到要恢复的时候再拿过来.
  1.  
  1. 1. 备份现有数据库和控制文件.
  1. RMAN> backup database include current controlfile;
  1.  
  1. 2. 移走备份集,到另外的目录/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1.  
  1. 3. 查看过期的备份介质.
  1. RMAN> report obsolete;
  1.  
  1. RMAN retention policy will be applied to the command
  1. RMAN retention policy is set to redundancy 1
  1. Report of obsolete backups and copies
  1. Type                 Key    Completion Time    Filename/Handle
  1. -------------------- ------ ------------------ --------------------
  1. Archive Log          1      15-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_15/o1_mf_1_2_93cc8thy_.arc
  1. Archive Log          2      15-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_15/o1_mf_1_3_93ck0mxm_.arc
  1. Archive Log          3      16-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_16/o1_mf_1_4_93ftwxqj_.arc
  1. Archive Log          4      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_19/o1_mf_1_5_93o9xt7k_.arc
  1. Backup Set           1      19-SEP-13        
  1.   Backup Piece       1      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_19/o1_mf_nnndf_TAG20130919T011640_93odqb65_.bkp
  1. Archive Log          5      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_19/o1_mf_1_6_93qgls17_.arc
  1. Backup Set           2      19-SEP-13        
  1.   Backup Piece       2      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_19/o1_mf_ncsnf_TAG20130919T011640_93odvkkc_.bkp
  1. Archive Log          6      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_19/o1_mf_1_7_93qh7sqx_.arc
  1. Archive Log          7      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_19/o1_mf_1_8_93qs3s52_.arc
  1. Archive Log          8      20-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_20/o1_mf_1_1_93qzp568_.arc
  1. Backup Set           3      19-SEP-13        
  1.   Backup Piece       3      19-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_19/o1_mf_s_826585286_93qs5xdg_.bkp
  1. Archive Log          15     20-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_20/o1_mf_1_1_93t8b5jm_.arc
  1. Backup Set           4      20-SEP-13        
  1.   Backup Piece       4      20-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826666416_93t8gcfz_.bkp
  1. Backup Set           6      21-SEP-13        
  1.   Backup Piece       6      21-SEP-13          /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_21/o1_mf_ncnnf_TAG20130920T235853_93tkd6kk_.bkp
  1.  
  1.  
  1. 4. 删除过期的备份介质.
  1.  
  1. RMAN> delete obsolete(nopormt指定无需确认立即删除)
  1.  
  1. 5. 由于我们已经讲备份的介质移走了,但是RMAN的备份记录中依然存在,清除这些信息。
  1.  
  1. RMAN> crosscheck backup;
  1.  
  1. using channel ORA_DISK_1
  1. crosschecked backup piece: found to be 'EXPIRED'
  1. backup piece handle=/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_20/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp RECID=5 STAMP=826675137
  1. crosschecked backup piece: found to be 'AVAILABLE'
  1. backup piece handle=/u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_21/o1_mf_s_826675611_93tkdfgw_.bkp RECID=7 STAMP=826675613
  1. Crosschecked 2 objects
  1.  
  1. 6. 删除过期的备份信息。
  1.  
  1. RMAN> delete expired backup;
  1.  
  1. using channel ORA_DISK_1
  1.  
  1. List of Backup Pieces
  1. BP Key  BS Key  Pc# Cp# Status      Device Type Piece Name
  1. ------- ------- --- --- ----------- ----------- ----------
  1. 5       5       1   1   EXPIRED     DISK        /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_20/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1.  
  1. Do you really want to delete the above objects (enter YES or NO)? yes
  1. deleted backup piece
  1. backup piece handle=/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/2013_09_20/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp RECID=5 STAMP=826675137
  1. Deleted 1 EXPIRED objects
  1.  
  1. 7. 关闭数据库删除控制文件和数据文件。
  1.  
  1. 8. 启动数据库到nomount下,恢复控制文件。
  1.  
  1. RMAN> startup nomount;
  1.  
  1. Oracle instance started
  1. .
  1. .
  1. RMAN> restore controlfile from autobackup;
  1.  
  1. Starting restore at 21-SEP-13
  1. allocated channel: ORA_DISK_1
  1. channel ORA_DISK_1: SID=18 device type=DISK
  1.  
  1. recovery area destination: /u01/app/oracle/flash_recovery_area/august
  1. database name (or database unique name) used for search: AUGUST
  1. channel ORA_DISK_1: AUTOBACKUP /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_21/o1_mf_s_826675611_93tkdfgw_.bkp found in the recovery area
  1. channel ORA_DISK_1: looking for AUTOBACKUP on day: 20130921
  1. channel ORA_DISK_1: restoring control file from AUTOBACKUP /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_21/o1_mf_s_826675611_93tkdfgw_.bkp
  1. channel ORA_DISK_1: control file restore from AUTOBACKUP complete
  1. output file name=/u01/app/oracle/oradata/august/august/control01.ctl
  1. output file name=/u01/app/oracle/flash_recovery_area/august/august/control02.ctl
  1. Finished restore at 21-SEP-13
  1.  
  1. 9. 改变数据库到mount状态,从备份集中恢复数据库。
  1.  
  1. RMAN> alter database mount;
  1.  
  1. database mounted
  1. released channel: ORA_DISK_1
  1.  
  1. RMAN> restore database from '/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp';
  1.  
  1. Starting restore at 21-SEP-13
  1. Starting implicit crosscheck backup at 21-SEP-13
  1. allocated channel: ORA_DISK_1
  1. channel ORA_DISK_1: SID=18 device type=DISK
  1. Crosschecked 6 objects
  1. Finished implicit crosscheck backup at 21-SEP-13
  1.  
  1. Starting implicit crosscheck copy at 21-SEP-13
  1. using channel ORA_DISK_1
  1. Finished implicit crosscheck copy at 21-SEP-13
  1.  
  1. searching for all files in the recovery area
  1. cataloging files...
  1. cataloging done
  1.  
  1. List of Cataloged Files
  1. =======================
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_1_93tlk8cg_.arc
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_4_93tlvr76_.arc
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_2_93tlkfwz_.arc
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_3_93tlkqgj_.arc
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_20/o1_mf_s_826618674_93rss9os_.bkp
  1. File Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/autobackup/2013_09_21/o1_mf_s_826675611_93tkdfgw_.bkp
  1.  
  1. using channel ORA_DISK_1
  1.  
  1. RMAN-00571: ===========================================================
  1. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  1. RMAN-00571: ===========================================================
  1. RMAN-03002: failure of restore command at 09/21/2013 00:46:57
  1. RMAN-06509: only SPFILE or control file can be restored from AUTOBACKUP
  1.  
  1. --看提示是说oracle不能这样恢复数据库。
  1.  
  1. 那如何使用这个备份集恢复呢?
  1.  
  1. 10. 需要先将备份集catalogRMAN备份记录中去。
  1.  
  1. RMAN> catalog start with '/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp';
  1.  
  1. searching for all files that match the pattern /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1. no files found to be unknown to the database
  1.  
  1. --查看现有的备份信息,此备份集已经能够被识别了。
  1. RMAN> list backup of database;
  1.  
  1. List of Backup Sets
  1. ===================
  1.  
  1. BS Key  Type LV Size       Device Type Elapsed Time Completion Time
  1. ------- ---- -- ---------- ----------- ------------ ---------------
  1. 5       Full    953.57M    DISK        00:07:36     21-SEP-13     
  1.         BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20130920T235853
  1.         Piece Name: /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1.   List of Datafiles in backup set 5
  1.   File LV Type Ckp SCN    Ckp Time  Name
  1.   ---- -- ---- ---------- --------- ----
  1.   1       Full 859599     20-SEP-13 /u01/app/oracle/oradata/august/august/system01.dbf
  1.   2       Full 859599     20-SEP-13 /u01/app/oracle/oradata/august/august/sysaux01.dbf
  1.   3       Full 859599     20-SEP-13 /u01/app/oracle/oradata/august/august/undotbs01.dbf
  1.   4       Full 859599     20-SEP-13 /u01/app/oracle/oradata/august/august/users01.dbf
  1.  
  1. 11. 将备份集信息编目后,就可以使用restore开始恢复数据库了。
  1.  
  1. RMAN> restore database;
  1.  
  1. Starting restore at 21-SEP-13
  1. using channel ORA_DISK_1
  1.  
  1. channel ORA_DISK_1: starting datafile backup set restore
  1. channel ORA_DISK_1: specifying datafile(s) to restore from backup set
  1. channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/august/august/system01.dbf
  1. channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/august/august/sysaux01.dbf
  1. channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/august/august/undotbs01.dbf
  1. channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/august/august/users01.dbf
  1. channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp
  1. channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/august/AUGUST/backupset/o1_mf_nnndf_TAG20130920T235853_93tjxkb9_.bkp tag=TAG20130920T235853
  1. channel ORA_DISK_1: restored backup piece 1
  1. channel ORA_DISK_1: restore complete, elapsed time: 00:05:36
  1. Finished restore at 21-SEP-13
  1.  
  1. 12. 进行介质恢复。
  1.  
  1. RMAN> recover database;
  1.  
  1. Starting recover at 21-SEP-13
  1. using channel ORA_DISK_1
  1.  
  1. starting media recovery
  1.  
  1. archived log for thread 1 with sequence 1 is already on disk as file /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_1_93tlk8cg_.arc
  1. archived log for thread 1 with sequence 2 is already on disk as file /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_2_93tlkfwz_.arc
  1. archived log for thread 1 with sequence 3 is already on disk as file /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_3_93tlkqgj_.arc
  1. archived log for thread 1 with sequence 4 is already on disk as file /u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_4_93tlvr76_.arc
  1. archived log for thread 1 with sequence 5 is already on disk as file /u01/app/oracle/oradata/august/august/redo02.log
  1. archived log file name=/u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_1_93tlk8cg_.arc thread=1 sequence=1
  1. archived log file name=/u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_2_93tlkfwz_.arc thread=1 sequence=2
  1. archived log file name=/u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_3_93tlkqgj_.arc thread=1 sequence=3
  1. archived log file name=/u01/app/oracle/flash_recovery_area/august/AUGUST/archivelog/2013_09_21/o1_mf_1_4_93tlvr76_.arc thread=1 sequence=4
  1. archived log file name=/u01/app/oracle/oradata/august/august/redo02.log thread=1 sequence=5
  1. media recovery complete, elapsed time: 00:00:24
  1. Finished recover at 21-SEP-13
  1.  
  1. RMAN> alter database open;
  1.  
  1. RMAN-00571: ===========================================================
  1. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  1. RMAN-00571: ===========================================================
  1. RMAN-03002: failure of alter db command at 09/21/2013 01:45:51
  1. ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
  1.  
  1. RMAN> alter database open noresetlogs;
  1.  
  1. RMAN-00571: ===========================================================
  1. RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
  1. RMAN-00571: ===========================================================
  1. RMAN-00558: error encountered while parsing input commands
  1. RMAN-01009: syntax error: found "identifier": expecting one of: "resetlogs, ;"
  1. RMAN-01008: the bad identifier was: noresetlogs
  1. RMAN-01007: at line 1 column 21 file: standard input
  1.  
  1. RMAN> alter database open resetlogs;
  1.  
  1. database opened
  1.  
  1. --之前讲过,在使用了备份的控制文件进行恢复之后,是需要用resetlogs方式打开的。
  1.  
  1. 所以总结来说,利用备份集的移动是没有问题的,恢复时只需要重新编目到备份集信息中即可。 [catalog start with dir’]
  1.  

RMAN备份介质的移动与再恢复测试 [ catalog start with ‘dir’ ]的更多相关文章

  1. RMAN详细教程(二):备份、检查、维护、恢复

    RMAN详细教程(一):基本命令代码 一.创建增量备份 增量备份级别为0-4,但为方便备份管理,oracle建议只限于0级和1级. 1.差异增量备份(differential incremental ...

  2. Oracle RMAN备份恢复指导书

    目 录 1 目的与范围... 1 2 术语和定义... 1 3 角色和职责... 2 4 使用RMAN备份数据库... 2 4.1.1 检查数据库模式... 2 4.1.2 连接到target数据库. ...

  3. Oracle Rman备份恢复和管理

    参考资料: Oracle之Rman入门指南 一步一步学Rman Rman简介 Rman-Recover manager恢复管理工具. Oracle集成了很多环境的一个数据库备份和恢复的工具. Rman ...

  4. oracle使用rman备份集恢复方式创建ADG

    一.背景 系统: 主库:rhel 6.4 64bit 备库:rhel 6.4 64bit   内存:2G [oracle@dgdb1 ~]$ free -m total used free share ...

  5. oracle数据库rman备份计划及恢复

    1.rman完全恢复的前提条件:历史的datafile,controlfile和spfile备份,加上完整的archivelog和完好的redolog. 2.rman备份脚本: a.RMAN 0级备份 ...

  6. RMAN备份数据库与恢复数据库(整库)

    1 准备 2 1.1 检查数据库归档状态 2 1.2 RMAN登陆目标 2 2 备份全库 2 2.1 创建备份数据存储目录 2 2.2 RMAN备份全库 2 2.3 试验(备份后,改变数据) 5 2. ...

  7. RMAN 备份异机恢复 并创建新DBID

    测试平台信息: Oracle:11gR2 操作系统:Redhat 5.5 Target DB:dave   几点说明: (1)RMAN 异机恢复的时候,db_name必须相同. 如果说要想改成其他的实 ...

  8. RMAN优缺点及RMAN备份及恢复步骤

    RMAN优缺点及RMAN备份及恢复步骤--以下部分来自网络转摘,仅供参考和OS命令备份方式相比,使用RMAN的优点1 备份执行期间不需要人工干预,因此减少了误操作的机会:2 可以有效的将备份和恢复结合 ...

  9. RMAN 的优缺点及RMAN 备份及恢复步骤

    一. RMAN 备份的一些优点和OS命令备份方式相比,使用RMAN的优点 1  备份执行期间不需要人工干预,因此减少了误操作的机会:2  可以有效的将备份和恢复结合起来:3  支持除逻辑备份以外的所有 ...

随机推荐

  1. 推荐系统那点事 —— 基于Spark MLlib的特征选择

    在机器学习中,一般都会按照下面几个步骤:特征提取.数据预处理.特征选择.模型训练.检验优化.那么特征的选择就很关键了,一般模型最后效果的好坏往往都是跟特征的选择有关系的,因为模型本身的参数并没有太多优 ...

  2. Udp实现消息的发送和接收、以及图片的上传

    //Udp实现消息的发送和接收 import java.io.IOException; import java.net.DatagramPacket; import java.net.Datagram ...

  3. 使用C#在VS中开发:未处理AccessViolationException “System.AccessViolationException”类型的未经处理的异常

    未处理AccessViolationException: “System.AccessViolationException”类型的未经处理的异常在System.Data.dll中发生 其他信息:尝试读 ...

  4. 95后实习生的远程办公体验(asp.net mvc\C#技术栈)

    这个月我们做了一件别人看起来很疯狂的事情,就是让一批95后的实习生实行远程办公,效果还不错,于是写此文总结一下. 其实认真算算,我自己的远程工作经验有十年了吧,在北京工作的时候天气不好就申请在家办公, ...

  5. TCP常见的定时器三次握手与四次挥手

    1.TCP常见的定时器 在TCP协议中有的时候需要定期或者按照某个算法对某个事件进行触发,那么这个时候,TCP协议是使用定时器进行实现的.在TCP中,会有七种定时器: 建立连接定时器(connecti ...

  6. Android之IPC(aidl)

    IPC(Inter-Process Conmunication) 进程间通讯 在同一进程中,各个组件进行通信是十分方便的,普通的函数调用就可以解决:但是,对于处于不同进程中的组件来说,要进行通信,就需 ...

  7. web开发之负载均衡的简单架构

    负载均衡 负载均衡的核心思想就是:请求分担 最简单的配置: 一台负载均衡服务器 两台webserver服务器 两台webserver服务器需要配置相同的服务器环境,设置相同的域名指向 负载均衡服务器需 ...

  8. (转)Eclipse中自动添加注释(作者,时间)

    方法一:Eclipse中设置在创建新类时自动生成注释  windows-->preference  Java-->Code Style-->Code Templates  code- ...

  9. 关于前端的photoshop初探的学习笔记

    写在前边 这还是高三的时候暑假的时候学习这个软件时记的笔记呢,今天又在电脑上找到了它,总觉得不应该让他尘封在我的硬盘上,于是挂了出来.温馨提示:比较乱,写给自己看的,看不下去,按ctrl+W 笔记内容 ...

  10. JPush 使用教程

    JPush 使用教程 自己使用的一些经验,为了方便直接从这里复制过去就行. 就当做个笔记,防止长时间忘记之后,还需要去官网看文档. 主要思路: sdk文件 + 三方依赖系统库 + 头文件 + 添加代理 ...