ITPub博客

首页 > Linux操作系统 > Linux操作系统 > Db2和oracle的一致性读(CR)--2者比较

Db2和oracle的一致性读(CR)--2者比较

原创 Linux操作系统 作者:bpmfhu 时间:2019-06-26 16:24:06 0 删除 编辑
oracle,db2对cr处理方式的几个问题
1.对回滚段空间的管理
  当回滚段空间不够,事物会失败
  出现ora-01555错误
2.oracle处理cr的方式是基于block的,而不是基于行的.
  如果一个数据块上面任何一个行被修改,那么这个block的scn也会被修改。
  甚至回滚段里面会对相同的block保存几个版本.
  在db2里面cr的处理是基于行级别的,如果一个事物对一个table的y行锁住了,那么另一个事务仍然可以对同一个table的x行lock,那么这2个事务可以同时进行.
3.ORACLE比DB2对CR处理的方式,更浪费了BUFFER CACHE(DB2里面是BUFFER POOL),并且使用了更多的I/O负载
4.怎么让用户看到当前的信息,而不是过期的信息?
  2个例子,在串行的事务里面
  1.ORACLE:
   Transaction 1                               Transaction 2
---------------------------------------------------------------
Begin transaction
---------------------------------------------------------------
                                              Begin transaction
---------------------------------------------------------------                                     Select available seats on flight ABC111.
See seat 23F is the last seat available
Reserve this seat.
---------------------------------------------------------------
                                Select available seats on flight
                                 ABC111. Also sees 23F as Oracle
                                will go to the rollback segment to
                                get the old version of that block.
-----------------------------------------------------------------
Commit Transaction.
-----------------------------------------------------------------
                                                Reserve this seat
-----------------------------------------------------------------
                                               Commit Transaction.
                                     Successful but now the flight
                                                       is oversold.
   2.DB2
  
   Transaction 1                               Transaction 2
---------------------------------------------------------------
Begin transaction
---------------------------------------------------------------
                                              Begin transaction
---------------------------------------------------------------                                     Select available seats on flight ABC111
using FOR UPDATE clause. See seat
23F is the last seat available
---------------------------------------------------------------
Reserve this seat.
---------------------------------------------------------------
                                Select available seats on flight
                                ABC111 using FOR UPDATE clause
---------------------------------------------------------------
                                Blocks waiting on the lock from the
                                first transaction
----------------------------------------------------------------
Commit Transaction.
-----------------------------------------------------------------
                                Select Returns with no seats left so
                                you book your seat on another flight.
-----------------------------------------------------------------
                                Commit Transaction
                               
结论:
Oracle has taking an old architectural decision and is now trying to showcase
it as a differentiator, when in fact it is simply a concurrency model that
developers must code around and one that adds an extra burden of
management on the DBA.

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4096/viewspace-52463/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2001-12-26

  • 博文量
    237
  • 访问量
    153365