rman常用命令

1.从备份集恢复某个归档日志到指定的目录

run{
allocate channel ci type disk;
set archivelog destination to '/home/oracle/myarchlog';
restore archivelog sequence 299;
release channel ci;
}

 2.删除具体某个归档日志

delete force noprompt archivelog sequence 602;
delete archivelog sequence 602;

 

-------------restore archivelog的各种选项--------------------

1.restore archivelog all 恢复全部归档日志文件
RMAN> restore archivelog all;
2.只恢复 5到8这四个归档日志文件
RMAN> restore archivelog from logseq 5 until logseq 8;
3.恢复从第5个归档日志起
RMAN> restore archivelog from logseq 5;
4.恢复7天内的归档日志
RMAN> restore archivelog from time 'sysdate-7';
5. sequence between 写法
RMAN> restore archivelog sequence between 1 and 3;
6.恢复到哪个日志文件为止
RMAN> restore archivelog until logseq 3;
6.从第五个日志开始恢复
RMAN> restore archivelog low logseq 5;
7.到第5个日志为止
RMAN> restore archivelog high logseq 5;
如果想改变恢复到另外路径下 则可用下面语句
set archivelog destination to 'd:\backup';
RMAN> run
2> {allocate channel ci type disk;
3> set archivelog destination to 'd:\backup';
4> restore archivelog all;
5> release channel ci;
6> }

 

------------恢复有效性检查--------------

 

1.检查备份有效性
##完全恢复
run{
restore database preview; ##或是restore database preview summary;
}

 

##不完全恢复
run{
set until scn 5218728;
restore database preview;
}

 

run{
set until sequence 21; ##不包含21的日志,只恢复到20的日志
restore database preview;
}

 

run{
sql 'alter session set nls_date_format="yyyy-mm-dd hh24:mi:ss"';
set until time='2019-03-09:23:00:00';
restore database preview;
}

 


2.验证备份集是否可用
run{
set until scn 5218728;
restore validate database;
}

 

校验归档日志有效性
restore validate archivelog sequence between 17 and 18;

 

转载于:https://www.cnblogs.com/hxlasky/p/10270140.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值