DG处理的问题还是蛮多的,但这次遇到一个比较奇葩的事情,表面配置、网络都没啥问题,但主备的同步始终有问题,经过多次调整参数、重新部署问题依旧,最终还是求助mos问题得以解决,现将处理过程记录如下:

一、问题现象

偶尔发现一个主备数据库同步有问题,检查备库发现除了无法完成同步,其他无错误信息,检查主库发现错误信息如下:

set line 200;
set pagesize 2000;
select dest_id,status,error from v$archive_dest;

ORA-12154: TNS:could not resolve the connect identifier specified

alert日志内容如下:

Error 12154 received logging on to the standby
trace内容如下:

*** 2018-07-02 09:37:36.230
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
OCIServerAttach failed -1
.. Detailed OCI error val is 12154 and errmsg is 'ORA-12154: TNS:could not resolve the connect identifier specified
'
*** 2018-07-02 09:37:36.246 4329 krsh.c
Error 12154 received logging on to the standby

二、问题原因

一般遇到ora-12154的错误,首先我们想到的肯定是监听配置和tnsnames.ora配置是否一致,然后看dg的服务名配置是否一致,然后还会检查本地监听(local_listener )是否配置正确,通过上述检查发现都没问题,然后又通过服务名用户名密码连接也没问题。那为什么还是会报服务名无法解析导致归档无法完成的错误呢?

最奇葩的是有些归档是可以传输过去,有些归档是无法传输。这里实在没招了,只能求助mos,在mos上找到了解决方案。(Adding an new Standby fails with error Ora-12154: TNS:could not resolve the connect identifier specified (文档 ID 1240558.1))

CauseAfter adding a new standby database, a corresponding new TNS alias entry was added to the tnsnames.ora on the primary node, but neither the instance nor the archiver processes were restarted.The ARC processes read the tnsnames.ora only once during process initialization, any updates to the tnsnames.ora after startup will not be known to the ARC process and hence the error
ORA-12154: TNS:could not resolve the connect identifier specified
is reported when the ARC processes try to resolve the (new) value for the 'service' attribute.

大致意思是说新的tns别名在主库被添加,实例和归档进程都没有被重启,导致归档进程读取的tnsnames.ora还是初始化启动的时候的内容,所以无法识别新的tnsnames.ora配置的服务器名。

三、解决方案

mos提供了3中解决方案,重启主数据库实例、指定归档服务串、重启归档进程,我这里采用的是第三种,重启归档进程

1. Shutdown and restart the primary database instance.This will cause a (short) outage of the primary database and may not be feasible for this reason.2. Use a connect descriptor for the 'service' parameter.Instead of using a TNS alias for the service parameter (which requires a lookup of the tnsnames.ora file) one can use the connect descriptor itself.Assume the following (new) entry in the tnsnames.ora on the primary node:REMOTE_DEST_NEW = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = standbynode)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = STDBY) ) )The corresponding 'alter system' command would then be:
alter system set log_archive_dest_2 = 'service="(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=standbynode)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=STDBY)))"' ;Please note that there's a length limit for the log_archive_dest_<n> parameter, so this will only work if the length of the connect string plus the length of other attributes specified does not exceed this limit.3. Kill the ARC processes of the primary instance.With RDBMS releases <= 9.2 it was possible to stop and restart the archiver processes by issuing 'archive log stop' followed by 'archive log start'.
However these commands are no longer valid with 10g and above, so to cause a respawn of the archiver processes they must be killed, they will be restarted immediately by the instance.This solution requires due care to avoid accidentally killing other vital background processes.The following script (ksh,bash) may assist in identifying the correct ARC processes that need to be killed:ps -ef|egrep "ora_arc.*_${ORACLE_SID}"|grep -v grep |while read user pid junk
doecho "kill -9 $pid"
done

通过kill 掉主库的归档进程,然后完成alter system switch logfile ;发现数据库数据同步正常。

四、问题总结

查询从库日志应用情况:
select sequence#,archived,applied from v$archived_log order by sequence#;
改变归档路径:
alter system set LOG_ARCHIVE_DEST_STATE_3=defer scope=both;alter system set LOG_ARCHIVE_DEST_3='SERVICE=dbs ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dbs' scope=both;alter system set log_archive_dest_1='location=/oracle/oradata/db/arch VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=db' scope=both;

Oracle 11g ADG 配置没问题,但死活不同步案例相关推荐

  1. mysql和oracle共用服务器_如何用oracle 11g客户端 配置连接服务器数据库?同一台服务器上装MySQL和oracle会有冲突么...

    在上一篇文章中,小编为您详细介绍了关于<模拟飞行10 咋设置多显示器10?>相关知识.本篇中小编将再为您讲解标题如何用oracle 11g客户端 配置连接服务器数据库?同一台服务器上装My ...

  2. curr_conv oracle,Oracle 11g ADG Automatic Block Repair(ABMR自动块修复)功能测试

    ORACLE 11g ACTIVE Data Guard 不仅提供了physical standby 可以open read-only ,还提供了一个无论是主备库发现currupt block的情况下 ...

  3. Windows10 安装Oracle 11g 的配置详解(1)

    一.安装Oracle 11g前的环境准备 配置 NET Framework 3.5 如果没有提前安装好NET Framework 3.5,会在安装快结束的时候报错,很坑. 首先打开 控制面板 找到 程 ...

  4. Oracle数据库adg数据没同步,Oracle 11g备库无法开启ADG的原因分析

    今天碰到一个有些奇怪的问题,但是奇怪的现象背后都是有本质的因果. 下午在做一个环境的检查时,发现备库是在mount阶段,这可是一个11gR2的库,没有ADG实在是太浪费了,对于这种情况感觉太不应该了. ...

  5. oracle em agent,ORACLE 11G EM 配置命令及问题处理

    11g装好以后,一直未用EM,昨天晚上和今天晚上终于抽时间把EM启动起来了,还遇到一点小问题, 1.EM配置的一些命令 创建一个EM资料库 emca -repos create 重建一个EM资料库 e ...

  6. 注意:ORACLE 11G ADG RAC 这个情况下并不能高可用

    墨墨导读:一套11 G r2(11.2.0.3)版本的2节点RAC adg环境,节点1因为硬件原因异常crash(apply redo 节点), 但同时实例2上的应用也都断开了(原来都是open). ...

  7. Oracle起步——Oracle 11g安装配置

    安装步骤: 1.首先先下载好Oracle安装包,将下载好后的两个压缩文件解压至同一文件夹下,该文件夹为database: 2.解压完毕后,在该目录下打开setup.exe,执行安装程序后会出现启动安装 ...

  8. oracle 11g重新安装配置,Oracle 11g数据库安装和卸载教程

    Oracle11g的安装教程 同时解压缩两个zip文件,生成一个database文件夹,进入到database文件夹,点击setup 去掉安全更新的选项,直接下一步 选择创建和配置数据库,点击下一步 ...

  9. docker 拉取oracle_Docker 拉取 oracle 11g镜像配置-Go语言中文社区

    话不多说 开始记录docker拉取阿里的oracle11g 镜像并进行配置, 用pl/sql 可以登录为最终结果 navicat连接是在最后一步 但是根据这个进行配置会有一些问题,所以写这篇记录一下, ...

最新文章

  1. java视频播放器制作_java创建简易视频播放器
  2. Ubuntu操作系统安装之开发人员必备
  3. 反转链表的golang实现
  4. super icon
  5. linux文字模式怎么传文件夹,虚拟机VMWare文本模式Linux 与 Windows 文件互传
  6. 解决The current branch is not configured for pull No value for key branch.master.merge found in config
  7. 具有Spring的简单工作流引擎
  8. wgs84转经纬度_wgs84经纬度转为cgcs2000平面坐标
  9. perl语言学习笔记(3)列表与数组、子程序’、参数
  10. sina微博登录框和twitter的比较
  11. 知了课堂 python_知了传课 - 主页
  12. win10 修改电脑密码 取消登录密码
  13. 关于电脑突然产生数字文件夹用360删不掉的情况
  14. viso 画背景框_officevisio怎么设置背景图和图纸...
  15. 三、box 盒子模型
  16. Unity 打包IOS平台错误
  17. phpstorm 用git pull或者 git push报错 protocol error: bad line length character: Acti
  18. excel导出文件加密
  19. C++ 模板元编程的应用有哪些,意义是什么?
  20. EXCEL插件-下载-Excel地图插件简介

热门文章

  1. PyTorch 深度学习:31分钟快速入门——Batch Normalization
  2. 北航博士,研究所月入两万,是一种什么体验?
  3. 4000字超干货!《统计学习方法》啃书指南
  4. xml文件中同时满足多个条件_问与答81: 如何求一组数据中满足多个条件的最大值?...
  5. win10恢复出厂设置_电脑Win10系统恢复出厂设置
  6. 编写tcp服务器发送hex格式_Android网络编程-TCP/IP协议
  7. html模拟右键系统菜单,HTML中自定义右键菜单功能
  8. 读书笔记——计算机网络CN
  9. LeetCode刷题(39)--Set Matrix Zeros
  10. cp无法创建普通文件权限不够_MAC从管理员变成了普通用户怎么办?