DataGuard主备归档存在gap的处理办法

2024-03-21 18:32

本文主要是介绍DataGuard主备归档存在gap的处理办法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

DataGuard主备之间可能由于网络等原因,造成备库和主库之间的归档日志不一致,这样就产生了gap。
解决gap的步骤:
1.在备库获得gap的详细信息
2.将需要的归档日志从主库拷贝到备库
3.备库将归档日志注册,然后应用。
 
--备库alert日志提示gap详情  
Media Recovery Waiting for thread 1 sequence 7057
Fetching gap sequence in thread 1, gap sequence 7057-7080
FAL[client]: Error fetching gap sequence, no FAL server specified
Mon Mar 24 11:39:40 CST 2014
FAL[client]: Failed to request gap sequence 
 GAP - thread 1 sequence 7057-7080
 DBID 768411208 branch 784810891
FAL[client]: All defined FAL servers have been attempted.

--也可以在备库查询gap
select * from v$archive_gap;

--为了方便,组装拷贝语句
--如果归档日志在ASM中,先通过rman将归档日志拷贝到OS,然后scp到备库standby归档目录;
--如果归档日志在OS上,直接scp到备库standby归档目录即可。
@Pirmary
select length('+DG1/primary/archivelog/2014_03_21/') from dual;
LENGTH('+DG1/PRIMARY/ARCHIVELOG/2014_03_21/')
---------------------------------------------
                                           35
  
--get copy command
select 'copy archivelog '''||NAME||''' to ''/tmp/'||substr(name,35)||''' ;' 
from v$archived_log 
where  SEQUENCE#>7060 
and SEQUENCE#<=7080 
and thread#=1 
and NAME<>'standby service name';

--copy archive logs from asm to OS
rman target / 
copy archivelog '+DG1/primary/archivelog/2014_03_21/thread_1_seq_7061.393.842805877' to '/tmp/thread_1_seq_7061.393.842805877' ;
copy archivelog '+DG1/primary/archivelog/2014_03_21/thread_1_seq_7062.472.842816319' to '/tmp/thread_1_seq_7062.472.842816319' ;
copy archivelog '+DG1/primary/archivelog/2014_03_21/thread_1_seq_7063.414.842825435' to '/tmp/thread_1_seq_7063.414.842825435' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7064.308.842843087' to '/tmp/thread_1_seq_7064.308.842843087' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7065.278.842847011' to '/tmp/thread_1_seq_7065.278.842847011' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7066.415.842847023' to '/tmp/thread_1_seq_7066.415.842847023' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7067.469.842850077' to '/tmp/thread_1_seq_7067.469.842850077' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7068.402.842864915' to '/tmp/thread_1_seq_7068.402.842864915' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7069.475.842868603' to '/tmp/thread_1_seq_7069.475.842868603' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7070.413.842869761' to '/tmp/thread_1_seq_7070.413.842869761' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7071.312.842871319' to '/tmp/thread_1_seq_7071.312.842871319' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7072.407.842874331' to '/tmp/thread_1_seq_7072.407.842874331' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7073.405.842874917' to '/tmp/thread_1_seq_7073.405.842874917' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7074.328.842875663' to '/tmp/thread_1_seq_7074.328.842875663' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7075.296.842876043' to '/tmp/thread_1_seq_7075.296.842876043' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7076.452.842886921' to '/tmp/thread_1_seq_7076.452.842886921' ;
copy archivelog '+DG1/primary/archivelog/2014_03_22/thread_1_seq_7077.446.842906131' to '/tmp/thread_1_seq_7077.446.842906131' ;
copy archivelog '+DG1/primary/archivelog/2014_03_23/thread_1_seq_7078.348.842928271' to '/tmp/thread_1_seq_7078.348.842928271' ;
copy archivelog '+DG1/primary/archivelog/2014_03_23/thread_1_seq_7079.347.842928277' to '/tmp/thread_1_seq_7079.347.842928277' ;
copy archivelog '+DG1/primary/archivelog/2014_03_23/thread_1_seq_7080.367.842929387' to '/tmp/thread_1_seq_7080.367.842929387' ;


--send archive logs to standby
scp thread_1_seq_70* 10.1.1.10:/tmp

--get  standby register archivelog command
--同样在主库执行,获得注册语句
select 'ALTER DATABASE REGISTER PHYSICAL LOGFILE ''/tmp/'||substr(name,35)||''';' from v$archived_log where  SEQUENCE#>7060 and SEQUENCE#<=7080 and thread#=1 and NAME<>'standby service name';

ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7061.393.842805877';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7062.472.842816319';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7063.414.842825435';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7064.308.842843087';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7065.278.842847011';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7066.415.842847023';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7067.469.842850077';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7068.402.842864915';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7069.475.842868603';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7070.413.842869761';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7071.312.842871319';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7072.407.842874331';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7073.405.842874917';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7074.328.842875663';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7075.296.842876043';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7076.452.842886921';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7077.446.842906131';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7078.348.842928271';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7079.347.842928277';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7080.367.842929387';



@Standby
--register gap archivelog to standby
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7061.393.842805877';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7062.472.842816319';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7063.414.842825435';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7064.308.842843087';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7065.278.842847011';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7066.415.842847023';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7067.469.842850077';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7068.402.842864915';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7069.475.842868603';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7070.413.842869761';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7071.312.842871319';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7072.407.842874331';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7073.405.842874917';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7074.328.842875663';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7075.296.842876043';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7076.452.842886921';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7077.446.842906131';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7078.348.842928271';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7079.347.842928277';
ALTER DATABASE REGISTER PHYSICAL LOGFILE '/tmp/thread_1_seq_7080.367.842929387';

--if standby is real apply,then standby will AUTO Apply archivelog
--if not,please open real apply 
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;

--get real apply info
set linesize 200
col name for a70
alter session set nls_date_format='yyyy-mm-dd hh24:mi:ss';
select  NAME,THREAD#,FIRST_TIME,sequence#,applied from v$archived_log order by  FIRST_TIME,THREAD#,sequence#,DEST_ID;

--you can see alert log ,it also show archivelog apply info
tail -f alert.log

--make sure no gap between Primary and Standby
SQL> select * from v$archive_gap;

--Clean
@Priamry
cd /tmp
rm thread_*

RMAN> crosscheck archivelog all;
RMAN> list archivelog all;
RMAN> delete expired archivelog all;

这篇关于DataGuard主备归档存在gap的处理办法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/833534

相关文章

无人叉车3d激光slam多房间建图定位异常处理方案-墙体画线地图切分方案

墙体画线地图切分方案 针对问题:墙体两侧特征混淆误匹配,导致建图和定位偏差,表现为过门跳变、外月台走歪等 ·解决思路:预期的根治方案IGICP需要较长时间完成上线,先使用切分地图的工程化方案,即墙体两侧切分为不同地图,在某一侧只使用该侧地图进行定位 方案思路 切分原理:切分地图基于关键帧位置,而非点云。 理论基础:光照是直线的,一帧点云必定只能照射到墙的一侧,无法同时照到两侧实践考虑:关

【生成模型系列(初级)】嵌入(Embedding)方程——自然语言处理的数学灵魂【通俗理解】

【通俗理解】嵌入(Embedding)方程——自然语言处理的数学灵魂 关键词提炼 #嵌入方程 #自然语言处理 #词向量 #机器学习 #神经网络 #向量空间模型 #Siri #Google翻译 #AlexNet 第一节:嵌入方程的类比与核心概念【尽可能通俗】 嵌入方程可以被看作是自然语言处理中的“翻译机”,它将文本中的单词或短语转换成计算机能够理解的数学形式,即向量。 正如翻译机将一种语言

Thymeleaf:生成静态文件及异常处理java.lang.NoClassDefFoundError: ognl/PropertyAccessor

我们需要引入包: <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><dependency><groupId>org.springframework</groupId><artifactId>sp

easyui同时验证账户格式和ajax是否存在

accountName: {validator: function (value, param) {if (!/^[a-zA-Z][a-zA-Z0-9_]{3,15}$/i.test(value)) {$.fn.validatebox.defaults.rules.accountName.message = '账户名称不合法(字母开头,允许4-16字节,允许字母数字下划线)';return fal

【408DS算法题】039进阶-判断图中路径是否存在

Index 题目分析实现总结 题目 对于给定的图G,设计函数实现判断G中是否含有从start结点到stop结点的路径。 分析实现 对于图的路径的存在性判断,有两种做法:(本文的实现均基于邻接矩阵存储方式的图) 1.图的BFS BFS的思路相对比较直观——从起始结点出发进行层次遍历,遍历过程中遇到结点i就表示存在路径start->i,故只需判断每个结点i是否就是stop

jenkins 插件执行shell命令时,提示“Command not found”处理方法

首先提示找不到“Command not found,可能我们第一反应是查看目标机器是否已支持该命令,不过如果相信能找到这里来的朋友估计遇到的跟我一样,其实目标机器是没有问题的通过一些远程工具执行shell命令是可以执行。奇怪的就是通过jenkinsSSH插件无法执行,经一番折腾各种搜索发现是jenkins没有加载/etc/profile导致。 【解决办法】: 需要在jenkins调用shell脚

明明的随机数处理问题分析与解决方案

明明的随机数处理问题分析与解决方案 引言问题描述解决方案数据结构设计具体步骤伪代码C语言实现详细解释读取输入去重操作排序操作输出结果复杂度分析 引言 明明生成了N个1到500之间的随机整数,我们需要对这些整数进行处理,删去重复的数字,然后进行排序并输出结果。本文将详细讲解如何通过算法、数据结构以及C语言来解决这个问题。我们将会使用数组和哈希表来实现去重操作,再利用排序算法对结果

8. 自然语言处理中的深度学习:从词向量到BERT

引言 深度学习在自然语言处理(NLP)领域的应用极大地推动了语言理解和生成技术的发展。通过从词向量到预训练模型(如BERT)的演进,NLP技术在机器翻译、情感分析、问答系统等任务中取得了显著成果。本篇博文将探讨深度学习在NLP中的核心技术,包括词向量、序列模型(如RNN、LSTM),以及BERT等预训练模型的崛起及其实际应用。 1. 词向量的生成与应用 词向量(Word Embedding)

使用协程实现高并发的I/O处理

文章目录 1. 协程简介1.1 什么是协程?1.2 协程的特点1.3 Python 中的协程 2. 协程的基本概念2.1 事件循环2.2 协程函数2.3 Future 对象 3. 使用协程实现高并发的 I/O 处理3.1 网络请求3.2 文件读写 4. 实际应用场景4.1 网络爬虫4.2 文件处理 5. 性能分析5.1 上下文切换开销5.2 I/O 等待时间 6. 最佳实践6.1 使用 as

Level3 — PART 3 — 自然语言处理与文本分析

目录 自然语言处理概要 分词与词性标注 N-Gram 分词 分词及词性标注的难点 法则式分词法 全切分 FMM和BMM Bi-direction MM 优缺点 统计式分词法 N-Gram概率模型 HMM概率模型 词性标注(Part-of-Speech Tagging) HMM 文本挖掘概要 信息检索(Information Retrieval) 全文扫描 关键词