eygle.com   eygle.com
eygle.com eygle
eygle.com  
 

« RHEL4.5中安装Oracle10g DataGuard参考 | 文摘首页 | VERITAS VXVM配置信息简要说明 »

从备份集恢复归档日志的测试与说明
modb.pro

当数据库出现问题,但不需要restore只需recover时,发现要用到的archivelog已经备份并删除了,因为我们备份archivelog一般是采用delete input的,
这时先需要restore archivelog,然后才能做recover,下面介绍一下restore archivelog的用法:

restore archivelog后面可以跟的参数有"all, from, high, like, logseq, low, scn, sequence, time, until"
现在举一列子说明:
1.列出已经备份的archivelog
list backup of archivelog all;
2.预览恢复出程,但不真正恢复
可以在你执行恢复前先看看恢复过程,也可以验证一下你的语法是否写对
restore archivelog all preview; 即在你要执行的restore archivelog命令后加preview
restore archivelog sequence 18 preview;
3.恢复指定时间范围的archivelog
3.1 显示2008-08-13 10:00:00到2008-08-13 11:00:00之间的archivelog
list backup of archivelog time between "to_date('2008-08-13 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2008-08-13 11:00:00','yyyy-mm-dd hh24:mi:ss')";
3.2 预览恢复2008-08-13 10:00:00到2008-08-13 11:00:00之间的archivelog
restore archivelog time between "to_date('2008-08-13 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2008-08-13 11::00','yyyy-mm-dd hh24:mi:ss')" preview;
3.3 真正恢复2008-08-13 10:00:00到2008-08-13 11:00:00之间的archivelog
restore archivelog time between "to_date('2008-08-13 10:00:00','yyyy-mm-dd hh24:mi:ss')" and "to_date('2008-08-13 11::00','yyyy-mm-dd hh24:mi:ss')"
4.恢复指定的archivelog
restore archivelog sequence 18; 恢复sequence为18的archivelog
5.restore archivelog like恢复模糊查询出来的archivelog,这个只能用于通过catalog的备份,用nocatalog的会报错
restore archivelog like '%18%';
6.恢复指定sequence范围的archivelog
restore archivelog from sequence 18 until sequence 20;
或restore archivelog low sequence 18 high sequence 20;
或restore archivelog low logseq 18 high logseq 20;
7.指定archivelog的恢复目的地,如你想把archivelog恢复到一个临时目录时有用,但这个必须包含在run{}里面才能用
set archivelog destination to 'e:\temp';

以上基本上可以解决你恢复archivelog的需求,我是在10.2.0.4版本中测试通过的,欢迎大家补充,转载请说明出处.

---------------------------------------------
以下部分是在本人正式环境中遇到的实际情况,非转载:
备份日志中有以下内容:
通道 t1: 正在指定备份集中的存档日志
输入存档日志线程 =1 序列 =18070 记录 ID=35794 时间戳=671966051
输入存档日志线程 =1 序列 =18071 记录 ID=35796 时间戳=671966351
输入存档日志线程 =1 序列 =18072 记录 ID=35798 时间戳=671966652
输入存档日志线程 =1 序列 =18073 记录 ID=35800 时间戳=671966952
输入存档日志线程 =1 序列 =18074 记录 ID=35802 时间戳=671967249
输入存档日志线程 =1 序列 =18075 记录 ID=35804 时间戳=671967550
输入存档日志线程 =1 序列 =18076 记录 ID=35806 时间戳=671967850
输入存档日志线程 =1 序列 =18077 记录 ID=35808 时间戳=671968151
输入存档日志线程 =1 序列 =18078 记录 ID=35810 时间戳=671968451

单独恢复18071 到18076

rman> run
{ allocate channel t1 type 'sbt_tape' parms 'ENV=(tdpo_optfile=/usr/tivoli/tsm/client/oracle/bin64/tdpo.opt)';
restore archivelog from logseq 18071 until logseq 18076 ;
release channel t1;
}


经过在线环境的实地测试,以上脚本可行

作者:George.ma BLOG:http://blog.chinaunix.net/u/12521/


历史上的今天...

By eygle on 2008-12-20 22:45 | Comments (0) | Oracle摘 | 2133 |


CopyRight © 2004~2020 云和恩墨,成就未来!, All rights reserved.
数据恢复·紧急救援·性能优化 云和恩墨 24x7 热线电话:400-600-8755 业务咨询:010-59007017-7040 or 7037 业务合作: marketing@enmotech.com