设为首页 收藏本站
查看: 2499|回复: 0

[经验分享] Oracle RBA(Redo Byte Address) 说明

[复制链接]

尚未签到

发表于 2016-7-27 09:52:54 | 显示全部楼层 |阅读模式
  
一. RBA 说明
  之前整理了一个rdba和dba 的说明文档,参考:
  Oracle rdba和 dba 说明
  http://blog.csdn.net/tianlesoftware/article/details/6529346
  
   在MOS的文档:Question About RBA (Redo Block Address) [ID 759966.1] 有对RBA的说明。
  
  A"Redo Block Address" (RBA) describes a physical location within aredo log file.
  
  RBA 由以下三部分组成:
  (1)the log file sequence number (4 bytes)
  (2)the log file block number (4 bytes)
  (3)the byte offset into the block at which the redo record starts (2bytes)
  
  如:RBA[0x19.2.10] 代表 Log squence25, Block number 2 with byte offset 16.
  注意这里的格式:都是16进行。
  
  Redo 与checkpoint 关系很大,当设置log_checkpoints_to_alert 参数为true后,checkpoint 发生时会写入alert log里。
  
  如:
  SYS@dave2(db2)>alter system set log_checkpoints_to_alert=true scope=both;
  System altered.
  SYS@dave2(db2)> alter system switchlogfile;
  System altered.
  
  log里的信息如下:
  Thu Aug 18 18:46:18 2011
  ALTER SYSTEM SETlog_checkpoints_to_alert=TRUE SCOPE=BOTH;
  Thu Aug 18 18:48:07 2011
  Beginning log switch checkpoint up to RBA[0xa.2.10], SCN: 2148380730
  Thread 1 advanced to log sequence 10
  Current log# 3 seq# 10 mem# 0: /u01/app/oracle/oradata/dave2/redo03.log
  Thu Aug 18 18:52:54 2011
  Completed checkpoint up to RBA [0xa.2.10],SCN: 2148380730
  Thu Aug 18 19:08:59 2011
  Incremental checkpoint up to RBA[0xa.736.0], current log tail at RBA [0xa.80a.0]
  Thu Aug 18 19:39:01 2011
  Incremental checkpoint up to RBA[0xa.c96.0], current log tail at RBA [0xa.d7c.0]
  ....
  Fri Aug 19 07:10:00 2011
  Incremental checkpoint up to RBA[0xa.1688a.0], current log tail at RBA [0xb.8328.0]
  Fri Aug 19 07:11:04 2011
  Completed checkpoint up to RBA [0xb.2.10],SCN: 2148412930
  Fri Aug 19 07:40:02 2011
  Incremental checkpoint up to RBA[0xb.896c.0], current log tail at RBA [0xb.89c1.0]
  
  
  根据我们前面的说明,RBA 由三部分组成,第一部分是sequence number,即序列号。
  
  在我们贴出来的log里有2个日志序列:RBA [0xa.1688a.0] 和 RBA [0xb.896c.0]。
  SYS@dave2(db2)> select to_number('a','xx')from dual;
  
  TO_NUMBER('A','XX')
  -------------------
  10
  
  SYS@dave2(db2)> selectto_number('b','xxx') from dual;
  
  TO_NUMBER('B','XXX')
  --------------------
  11
  
  a 对应的是日志序列10,b 对应的是日志序列11.
  
  SYS@dave2(db2)> select sequence# fromv$archived_log;
  
  SEQUENCE#
  ----------
  1
  2
  3
  4
  5
  6
  7
  8
  9
  10
  
  SYS@dave2(db2)> select sequence#,group#,status from v$log;
  
  SEQUENCE#GROUP# STATUS
  ---------- ---------- ----------------
  11 1 CURRENT
  9 2 INACTIVE
  10 3 INACTIVE
  
  根据这个查询结果判断10是已经归档的,11是正在使用的current redo log file。
  
  第二部分就是我们对应的block:
  SYS@dave2(db2)> selectto_number('1688a','xxxxxxxxx') from dual;
  
  TO_NUMBER('1688A','XXXXXXXXX')
  ------------------------------
  92298
  
  在之前的blog:
  Oracle Dump Redo Log File 说明
  http://blog.csdn.net/tianlesoftware/article/details/6670962
  
  里提到,可以根据RBA 来dump redo block:
  
  格式如下:
  ALTER SYSTEM DUMP LOGFILE 'filename' RBAMIN seqno .blockno RBA MAX seqno . blockno;
  
  示例:
  SYS@anqing1(rac1)> alter system dumplogfile'+data/anqing/onlinelog/redo02.log' rbamin 121 10458 rba max125 10472;
  System altered.
  
  这里的参数:seqno .blockno; 就是我们RBA中的前2部分。
  
二. RBA 使用
  RBAs are not necessarily unique within their thread, because the log file sequencenumber may be reset to 1 in all threads if a database is opened with theRESETLOGS option.
  
RBAs are used in the following important ways.
  With respect to a dirty block in thebuffer cache, thelow RBAis theaddress of the redo for the first change that was applied to the block since itwas last clean, and thehigh RBAis the address of the redo for the most recent change to have been applied to theblock.
  
  Dirty buffers are maintained on the buffer cache checkpoint queues in low RBA order. Thecheckpoint RBAis the point up to which DBWn has written buffers from thecheckpoint queues if incremental checkpointing is enabled -- otherwise it isthe RBA of last full thread checkpoint.
  
   The checkpoint RBA is copied into the checkpoint progress record of the controlfile by the checkpoint heartbeat once every 3 seconds. In stance recovery, when needed, begins from the checkpoint RBA recorded in thecontrolfile.
  
  Thetarget RBAis the point up to which DBWnshould seek to advance the checkpoint RBA to satisfy instance recovery objectives.
  
   Theon-disk RBAis the point up to which LGWR has flushed the redo thread to the online log files. DBWn may not write ablock for which the high RBA is beyond the on-disk RBA. Otherwise transactionrecovery (rollback) would not be possible, because the redo needed to undo achange is always in the same redo record as the redo for the change itself.
  
  The termsync RBAis sometimes used to referto the point up to which LGWR is required to sync the thread. However, this isnot a full RBA -- only a redo block number is used at this point.
  
  在上面提到的几种RBA 值可以通过X$BH,和 X$KCCRT 视图进行查看:
  The low and high RBAs for dirty buffers can be seen in X$BH.(There is also arecovery RBAwhich is used to record the progress ofpartial block recovery by PMON.)
  The incremental checkpoint RBA, the target RBA and theon-disk RBA can all be seen in X$TARGETRBA. The incremental checkpointRBA and the on-disk RBA can also be seen in X$KCCCP.
  The full thread checkpoint RBA can be seen in X$KCCRT.
  
  
  
  
  
  -------------------------------------------------------------------------------------------------------
  Blog: http://blog.csdn.net/tianlesoftware
  Weibo: http://weibo.com/tianlesoftware
  Email: dvd.dba@gmail.com
  DBA1 群:62697716(满); DBA2 群:62697977(满)DBA3 群:62697850(满)
  DBA 超级群:63306533(满); DBA4 群: 83829929(满)DBA5群: 142216823(满)
  DBA6 群:158654907(满) 聊天 群:40132017(满) 聊天2群:69087192(满)
  --加群需要在备注说明Oracle表空间和数据文件的关系,否则拒绝申请

运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-250060-1-1.html 上篇帖子: Oracle 查看 对象 持有锁的情况 下篇帖子: Oracle 10g dbms_rowid 包源码
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表