ORACLE与DB2对CR不同的处理方式的比较
oracle怎么处理cr
在oracle里面当一个block的data被update,那么一个较老的版本的block会被存在回滚段--undo tablespace里面。值得注意的是回滚段的不是用来做crash reacovery,而是针对事务处理的。这就意味着,不较老的data block存在回滚段里面,但是改变数据的undo、redo的镜象存在redo logs里面。
每一个oracle的block(db2里面叫page)都和scn相互关联。从逻辑上看,scn是确定data page版本的一个时间戳。所以当一个block里面的一行纪录被update的时候,这个block的当前版本和当前的scn号会被拷贝到回滚段里面,然后这个data block会被updata,并且获得一个新的scn(存在block的头部)
在oracle里面发起一个查询,它不会遵循ansi标准的隔离级别。为了完成查询,每个语句都会收集语句开始执行的时间戳和scn号。然后它会去读data block,检查这个data block的scn是否比语句的scn高。如果data block的scn较高,那么oracle知道这个block在语句执行开始后必定被uodate过了,所以这个事务要去回滚段里面找一个较老满足这个查询的版本。大概会有这么几个步骤:
1. statement A starts and is assigned SCN 105
2. the statement starts a table scan of table X (for example)
3. for every block that is read in from disk into the bufferpool, the SCN ofthat block is checked
4. if the block SCN is greater than SCN 105 then the block is duplicated(cloned) inside the bufferpool
5. lets assume that the block SCN is 108
6. the statement then sidetracks into the rollback segment looking for thelast transaction to update this page. The transaction that updated thisblock to 108 is undone on the clone block using the information found inthe rollback segment. So the block now has SCN 107 (for example).
7. continue cloning the block and applying the rollback segment images asin step 6 until you have a block that has an SCN < 105 (yourtransactions SCN)
8. then continue to read the next block from the table into the bufferpool(and go to step 6 as needed)
oracle怎么处理cr
在oracle里面当一个block的data被update,那么一个较老的版本的block会被存在回滚段--undo tablespace里面。值得注意的是回滚段的不是用来做crash reacovery,而是针对事务处理的。这就意味着,不较老的data block存在回滚段里面,但是改变数据的undo、redo的镜象存在redo logs里面。
每一个oracle的block(db2里面叫page)都和scn相互关联。从逻辑上看,scn是确定data page版本的一个时间戳。所以当一个block里面的一行纪录被update的时候,这个block的当前版本和当前的scn号会被拷贝到回滚段里面,然后这个data block会被updata,并且获得一个新的scn(存在block的头部)
在oracle里面发起一个查询,它不会遵循ansi标准的隔离级别。为了完成查询,每个语句都会收集语句开始执行的时间戳和scn号。然后它会去读data block,检查这个data block的scn是否比语句的scn高。如果data block的scn较高,那么oracle知道这个block在语句执行开始后必定被uodate过了,所以这个事务要去回滚段里面找一个较老满足这个查询的版本。大概会有这么几个步骤:
1. statement A starts and is assigned SCN 105
2. the statement starts a table scan of table X (for example)
3. for every block that is read in from disk into the bufferpool, the SCN ofthat block is checked
4. if the block SCN is greater than SCN 105 then the block is duplicated(cloned) inside the bufferpool
5. lets assume that the block SCN is 108
6. the statement then sidetracks into the rollback segment looking for thelast transaction to update this page. The transaction that updated thisblock to 108 is undone on the clone block using the information found inthe rollback segment. So the block now has SCN 107 (for example).
7. continue cloning the block and applying the rollback segment images asin step 6 until you have a block that has an SCN < 105 (yourtransactions SCN)
8. then continue to read the next block from the table into the bufferpool(and go to step 6 as needed)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4096/viewspace-52461/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/4096/viewspace-52461/