Oracle 从备份恢复缺失的归档日志

1、查询需要恢复时间段的归档日志
select * from v$archive_log where to_date('2020-05-07 18:32:20','yyyy-mm-dd hh24:mi:ss') between first_time and next_time;
rman> list backup of archivelog from logseq ... until logseq ...;

2、把需要的备份文件注册添加到控制文件
rman> catalog backuppiece '/../../...arc';

3、恢复指定序列号的归档日志
rman> restore archivelog from logseq ... until logseq ...;

4、把归档记录到数据库
rman> catalog archivelog '/../../...arc';

如下是使用备份到虚拟带库的备份片来恢复归档日志的方式
rman> 
run{
allocate channel dev_7 type 'sbt_tape' parms 'ENV=(OB2BARTYPE=Oracle8,OB2APPNAME=ynsicp,OB2BARLIST=YNSICP_full_weekly)';
set archivelog destination to '/../'; -- 设置归档恢复时存放的路径,不指定即为归档的默认存放路径
restore archivelog from logseq 37539 until logseq 37567 thread 2;
release channel dev_7;
}

删除3天前的归档
sql 'alter system archive log current';
delete noprompt archivelog  until time 'sysdate-3';

上一篇:MySQL8.0MGR单主/多主安装与切换


下一篇:MySQL的初次使用