如何利用RMAN Debug和10046 Trace来诊断RMAN问题?
在这篇文章中,我想介绍一下如何对RMAN的问题做debug。 我们借助于下面这个场景,说明如何Debug RMAN 问题。
在11.2.0.4上,物理备库上执行归档备份时,出现了下面的错误:
[oracle@test1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Mar 25 13:58:59 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: R11204 (DBID=2001766638, not open)
RMAN> backup archivelog all;
Starting backup at 25-MAR-14
using target database control file instead of recovery catalog
RMAN-06820: WARNING: failed to archive current log at primary database<==============报错无法连接到主库
Connect identifier for DB_UNIQUE_NAME R11204 not configured
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=58 RECID=1 STAMP=842172838 <==============后面的归档备份还是成功的
input archived log thread=1 sequence=59 RECID=2 STAMP=842172838
input archived log thread=1 sequence=60 RECID=3 STAMP=842172928
input archived log thread=1 sequence=61 RECID=4 STAMP=842173275
input archived log thread=1 sequence=62 RECID=5 STAMP=842175748
input archived log thread=1 sequence=63 RECID=6 STAMP=842182033
input archived log thread=1 sequence=64 RECID=7 STAMP=842185463
input archived log thread=1 sequence=65 RECID=9 STAMP=842432288
input archived log thread=1 sequence=66 RECID=8 STAMP=842432286
input archived log thread=1 sequence=67 RECID=10 STAMP=842432291
input archived log thread=1 sequence=68 RECID=11 STAMP=842432322
channel ORA_DISK_1: starting piece 1 at 25-MAR-14
channel ORA_DISK_1: finished piece 1 at 25-MAR-14
piece handle=/u01/app/oracle/fast_recovery_area/SDY/backupset/2014_03_25/o1_mf_annnn_TAG20140325T135903_9m2hlj0p_.bkp tag=TAG20140325T135903 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 25-MAR-14
注:11.2.0.4有一个新的特性,就是备库上备份归档时,它会连接到主库上,让主库进行一次log switch,所以上面的错误是备库无法连接到主库进行log switch,上面最主要的错误是“Connect identifier for DB_UNIQUE_NAME R11204 not configured ”,看起来是备库要连接主库时需要用到的连接串没有配置正确。这时我们的疑问是这个连接串是在哪里设置的?
首先我们用一下Rman Debug:
[oracle@test1 ~]$ rman target / debug trace=/tmp/rman_debug
RMAN> backup archivelog all;
RMAN-03090: Starting backup at 25-MAR-14
RMAN-06009: using target database control file instead of recovery catalog
RMAN-06820: WARNING: failed to archive current log at primary database
RMAN-06613: Connect identifier for DB_UNIQUE_NAME R11204 not configured
...
针对生成的/tmp/rman_debug,我们发现连接串用了为空“lprimary_db_cs = NULL”
DBGSQL: TARGET> begin :lprimary_db_cs := sys.dbms_backup_restore.get_connect_identifier (dbuname=> :primary_dbunam
e); end;
DBGSQL: sqlcode = 0
DBGSQL: B :lprimary_db_cs = NULL《==========这是主库的连接串
DBGSQL: B :primary_dbuname = R11204
DBGRCVMAN: getConfig: configurations exists for this site
RMAN-06820: WARNING: failed to archive current log at primary database
DBGMISC: ENTERED krmkursr [14:08:50.007]
也就是RMAN调用了一个内部的包 sys.dbms_backup_restore.get_connect_identifier来获得在备库连接主库时需要用到的串。这时我们需要知道这个串是在哪里设置的,为何为空。
接下来,针对RMAN进行10046 trace:
[oracle@test1 ~]$ rman target / debug trace=/tmp/rman_debug
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 17 09:00:00 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
RMAN-06568: connected to target database: R11204 (DBID=2001766638, not open)
RMAN> sql "alter session set tracefile_identifier=''rman_10046''";
RMAN-06009: using target database control file instead of recovery catalog
RMAN-06162: sql statement: alter session set tracefile_identifier=''rman_10046''
RMAN> sql "alter session set events ''10046 trace name context forever,level 12''";
RMAN-06162: sql statement: alter session set events ''10046 trace name context forever,level 12''
RMAN> backup archivelog all;
RMAN-03090: Starting backup at 25-MAR-14
RMAN-06820: WARNING: failed to archive current log at primary database
RMAN-06613: Connect identifier for DB_UNIQUE_NAME R11204 not configured
...
查看生成的trace file,这个文件在udump下:
$cd /u01/app/diag/rdbms/sdy/SDY/trace
$ls -ltr
-rw-r----- 1 oracle oinstall 1037463 Mar 25 14:11 SDY_ora_3792_rman_10046.trc
PARSING IN CURSOR #140366085001120 len=119 dep=0 uid=0 oct=47 lid=0 tim=1395736859520777 hv=3388798669 ad='7ec65738' sqlid='7pwt2c34
ztxqd'
begin :lprimary_db_cs := sys.dbms_backup_restore.get_connect_identifier (dbuname=> :primary_dbuname); end;
END OF STMT
PARSE #140366085001120:c=0,e=285,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,plh=0,tim=1395736859520776
BINDS #140366085001120:
Bind#0
oacdty=01 mxl=2000(1536) mxlc=00 mal=00 scl=00 pre=00
oacflg=01 fl2=1000000 frm=01 csi=873 siz=2128 off=0
kxsbbbfp=7fa986a27f08 bln=2000 avl=00 flg=05
Bind#1
oacdty=01 mxl=128(90) mxlc=00 mal=00 scl=00 pre=00
oacflg=01 fl2=1000000 frm=01 csi=873 siz=0 off=2000
kxsbbbfp=7fa986a286d8 bln=128 avl=06 flg=01
value="R11204"
*** ACTION NAME:(0000018 STARTED189) 2014-03-25 14:10:59.521
WAIT #140366085001120: nam='control file sequential read' ela= 10 file#=0 block#=1 blocks=1 obj#=-1 tim=1395736859521532
WAIT #140366085001120: nam='control file sequential read' ela= 4 file#=0 block#=16 blocks=1 obj#=-1 tim=1395736859521566
WAIT #140366085001120: nam='control file sequential read' ela= 4 file#=0 block#=18 blocks=1 obj#=-1 tim=1395736859521580
WAIT #140366085001120: nam='control file sequential read' ela= 4 file#=0 block#=281 blocks=1 obj#=-1 tim=1395736859521594
WAIT #140366085001120: nam='control file sequential read' ela= 4 file#=0 block#=1 blocks=1 obj#=-1 tim=1395736859521614
WAIT #140366085001120: nam='control file sequential read' ela= 3 file#=0 block#=16 blocks=1 obj#=-1 tim=1395736859521627
WAIT #140366085001120: nam='control file sequential read' ela= 2 file#=0 block#=18 blocks=1 obj#=-1 tim=1395736859521638
WAIT #140366085001120: nam='control file sequential read' ela= 3 file#=0 block#=281 blocks=1 obj#=-1 tim=1395736859521650
krsd_get_primary_connect_string: found pcs '' by FAL_SERVER lookup <====================用FAL_SERVER找到了连接串''
所以这个10046 trace,很清楚地告诉我们它是从参数FAL_SERVER上获得了连接串''。
这时,连接到备库,查看参数FAL_SERVER,它的值的确为空:
SQL> show parameter fal
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
fal_client string
fal_server string
到此,我们通过RMAN debug和10046 trace,获得了我们想要的信息。
总结一下:
如果在执行RMAN命令后,遇到了性能问题或者需要深入跟踪一个错误,那么可以考虑使用rman debug:
$ rman target <connection> catalog <connection> debug trace=/tmp/rmanDebug.trc log=/tmp/rmanLog.txt
run {
...Run your backup commands here
}
如果还需要跟进一步的跟踪可以再使用10046 trace:
$ rman target <connection> catalog <connection> debug trace=/tmp/rmanDebug.trc log=/tmp/rmanLog.txt
RMAN> sql "alter session set tracefile_identifier=''rman_10046''";
RMAN> sql "alter session set events ''10046 trace name context forever,level 12''";
RMAN> run-your-commands;
RMAN> exit;
需要注意的是,上面的这些方法可能会生成大量文件,需要考虑对磁盘空间的压力以及对RMAN的性能的影响。
可以参考MOS文档:RMAN: Quick Debugging Guide (Doc ID 1198753.1)
如何利用RMAN Debug和10046 Trace来诊断RMAN问题?的更多相关文章
- 如何利用RMAN Debug和10046 Trace来诊断RMAN问题?
学习转摘:https://blogs.oracle.com/Database4CN/entry/%E5%A6%82%E4%BD%95%E5%88%A9%E7%94%A8rman_debug%E5%92 ...
- System.Diagnostics命名空间里的Debug类和Trace类的用途
在 .NET 类库中有一个 System.Diagnostics 命名空间,该命名空间提供了一些与系统进程.事件日志.和性能计数器进行交互的类库.当中包括了两个对开发人员而言十分有用的类--Debug ...
- debug类和trace类的区别
在 .net 类库中有一个 system.diagnostics 命名空间,该命名空间提供了一些与系统进程.事件日志.和性能计数器进行交互的类库.当中包括了两个对开发人员而言十分有用的类——debug ...
- 10046 trace详解(1)
10046 trace帮助我们解析一条/多条SQL.PL/SQL语句的运行状态,这些状态包括:Parse/Fetch/Execute三个阶段中遇到的等待事件.消耗的物理和逻辑读.CPU时间.执行计划等 ...
- Oracle 10046 trace文件分析
生成10046 trace文件: SQL> create table t10046 as select * from dba_objects; Table created. SQL> se ...
- [Oracle]如何查看 10046 trace 中的 tim= ... 的具体时刻
可以在 Linux 下,用下列方式: 如10046 trace 文件中如果有如下的内容:... tim = 1503032923 可以用 date 命令加 option 来看它的时刻: date - ...
- 10046 trace and sql
1. SQLT 下载 从metalink上下载SQLT工具,参考文档 (以下大部分(SQL可以在sqlt\utl 目录下找到)) 1.1 SQLT 安装 SQLT安装在自己的schema SQLT ...
- Oracle 基于 RMAN 的不完全恢复(incomplete recovery by RMAN)
Oracle 数据库可以实现数据库不完全恢复与完全恢复.完全恢复是将数据库恢复到最新时刻,也就是无损恢复,保证数据库无丢失的恢复.而不完全恢复则是根据需要特意将数据库恢复到某个过去的特定时间点或特定的 ...
- 转 RMAN: RAC Backup, Restore and Recovery using RMAN
PURPOSE The purpose of this document is to give a quick guide for using RMAN on RAC databases. We wi ...
随机推荐
- Boosting和Bagging的异同
二者都是集成学习算法,都是将多个弱学习器组合成强学习器的方法. 1.Bagging (主要关注降低方差) Bagging即套袋法,其算法过程如下: A)从原始样本集中抽取训练集.每轮从原始样本集中使用 ...
- 《Head First 设计模式》读后总结:基础,原则,模式
基础 抽象 封装 多态 继承 原则 封装变化 多用组合,少用继承 针对接口编程,不针对实现编程 为交互对象之间的松耦合设计而努力 类应该对扩展开放,对修改关闭 依赖抽象,不要依赖具体类 只和朋友交谈 ...
- asp.net web api 跨域,带cookie
官网上有一个介绍 http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api 但是只支 ...
- HTML常用的标签中,行内元素和块级元素
块元素(block element) HTML标签分类明细 * address - 地址 * blockquote - 块引用 * center - 举中对齐块 * dir - 目录列表 * div ...
- [android] 手机卫士黑名单功能(短信拦截)
前面我们把需要拦截的手机号都存储和展示出来了,接下来是使用广播接收者拦截短信了,这个广播接收者需要和一个服务绑定,服务开启的时候,接收者存在,服务停掉时,接收者关闭 在service包下定义一个类Ca ...
- [javaSE] 并发编程(线程间通信)
新建一个资源类Resource 定义成员变量String name 定义成员变量int age 新建一个输入类Input,实现Runnable接口 定义一个构造方法Input(),传入参数:Resou ...
- winform:简单文件资源管理器
今天全部学习内容的体现就是winform的资源管理器.这个资源管理器主要由一个textbox获取路径,然后在treeview那里通过递归的方式呈现目录树,当用户点击treeview的节点是,会触发Af ...
- 由表生成代码:mybatis-generator入门
application.properties ## mapper xml 文件地址 mybatis.mapper-locations=classpath*:mapper/*Mapper.xml ##数 ...
- 【学习笔记】--- 老男孩学Python,day18 面向对象------抽象类(接口类), 多态, 封装
抽象类,接口类 Python没有接口这个概念 抽象类(接口类): 目的是制定一个规范 要学会归一化设计,有重复的东西就要想把它们合并起来 from abc import ABCMeta, abstra ...
- webpack开发工具
source map 用来调试打包后的代码 const path = require('path'); const HtmlWebpackPlugin = require('html-webpack- ...