白天和黑夜只交替没交换无法想像对方的世界
分类: oracle
2013-06-19 16:07:12
之前整理了一个rdba和dba 的说明文档,参考:
在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:
里提到,可以根据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部分。
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.
with respect to a dirty block in thebuffer cache, the low rba is theaddress of the redo for the first change that was applied to the block since itwas last clean, and the high rba is 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. the checkpoint rba is 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.
the target rba is the point up to which dbwnshould seek to advance the checkpoint rba to satisfy instance recovery objectives.
the on-disk rba is 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 term sync rba is 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 a recovery rba which 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:
email: dvd.dba@gmail.com
dba1 群:62697716(满); dba2 群:62697977(满) dba3 群:62697850(满)
dba 超级群:63306533(满); dba4 群: 83829929(满) dba5群: 142216823(满)
dba6 群:158654907(满) 聊天 群:40132017(满) 聊天2群:69087192(满)
--加群需要在备注说明oracle表空间和数据文件的关系,否则拒绝申请