楼主: macrozeng

db2 与 Oracle 的锁的区别和比较

[复制链接]
论坛徽章:
21
在线时间
日期:2007-07-25 04:01:022012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:23马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:09:23
41#
发表于 2007-7-7 15:46 | 只看该作者
In DB2 Term:

While the Repeatable Read isolation level is the most restrictive of the isolation levels available, the Uncommitted Read isolation level is the least intrusive isolation level provided. In fact, when the Uncommitted Read isolation level is used, rows that are retrieved by a single transaction are only locked if another transaction attempts to drop or alter the table from which the rows were retrieved. Because rows often remain unlocked when this isolation level is used, dirty reads, nonrepeatable reads, and phantoms can occur. Therefore, the Uncommitted Read isolation level is commonly used for transactions that access read-only tables/views or transactions that execute queries on which uncommitted data from other transactions will have no adverse affect.

In most cases, transactions using the Uncommitted Read isolation level can read changes made to rows by other transactions before those changes have been committed. However, such transactions can neither see nor access tables, views, or indexes created by other concurrent transactions until those transactions themselves have been terminated. The same applies to existing tables, views, or indexes that have been dropped—transactions using the Uncommitted Read isolation level will only learn that these objects no longer exist when the transaction that dropped them is terminated. There is one exception to this behavior: When a transaction running under the Uncommitted Read isolation level uses an updatable cursor, the transaction will behave as if it is running under the Cursor Stability isolation level, and the constraints of the Cursor Stability isolation level will apply.

So how does the Uncommitted Read isolation level affect our hotel reservation application? Now when a customer retrieves a list of rooms available for a given range of dates, you will be able to change the room rate for any room in the hotel, and other customers will be able to make or cancel reservations over any date range for any room. Furthermore, the list produced for the first customer may contain rooms that other customers have chosen to cancel reservations for, but whose cancellations have not yet been committed to the database.

使用道具 举报

回复
论坛徽章:
21
在线时间
日期:2007-07-25 04:01:022012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:23马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:09:23
42#
发表于 2007-7-7 16:04 | 只看该作者
DB2 具体的LOCK IMPLEMENTATION比这简单的四个分级复杂多了。有十三个不同的MODES。

所以感觉LOCKING是那种无能为力的事情。只能是尽可能地多加了解,编程时尽可能只要求必需的LOCKING,再加上尽可能地优化程序。

另外,记得尽可能早地COMMIT-一旦UOW完成就COMMIT。

使用道具 举报

回复
论坛徽章:
21
在线时间
日期:2007-07-25 04:01:022012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:232012新春纪念徽章
日期:2012-02-13 15:09:23马上有车
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有对象
日期:2014-02-19 11:55:142012新春纪念徽章
日期:2012-02-13 15:09:23
43#
发表于 2007-7-8 00:36 | 只看该作者

Re: db2 与 Oracle 的锁的区别和比较

最初由 macrozeng 发布
[B]原来一直在做 Oracle ,“读不阻止写,写不阻止读”的想法扎根很深,但是在用 DB2 的过程中总感觉 DB2 的锁的实现、使用以及管理都麻烦些,不知道各位有没有类似的体会,到底怎么才能正确使用 DB2 的锁呢?各位是否有什么心得,欢迎大家谈这方面感受和技术 :) [/B]



看了一下论坛的旧贴。LZ可以参考一下下面的讨论。

http://www.itpub.net/207514.html

感觉只做ORACLE的人刚来做DB2是会有很大的CULTURE SHOCK。

还是用回我那次看电影的经验。明明看好了一个座位,想定下来时就没了。我知道那BACKEND DATABASE应当是ORACLE。

LZ是从ORACLE的经验来的,可以重翻一下THOMAS KYTE关于ORACLE SERIALIZED TRANSACTION的一些讨论。

BTW,我算是在DB2和ORACLE都混的那种,没有PREFERENCE的非典型数据库爱好者。

使用道具 举报

回复
论坛徽章:
9
授权会员
日期:2006-06-15 15:15:15会员2007贡献徽章
日期:2007-09-26 18:42:10ITPUB新首页上线纪念徽章
日期:2007-10-20 08:38:44铁扇公主
日期:2007-10-26 16:08:48生肖徽章2007版:鼠
日期:2008-01-02 17:35:532008新春纪念徽章
日期:2008-02-13 12:43:03奥运会纪念徽章:田径
日期:2008-08-19 09:59:402010广州亚运会纪念徽章:高尔夫球
日期:2010-11-22 15:29:49优秀写手
日期:2014-02-28 06:00:13
44#
发表于 2007-7-8 09:14 | 只看该作者
db2 的锁比oracle的要复杂,所以相对来说对开发人员要求较高,个人感觉不是非常适合做交易系统,我说luw上的db2,as400和390上的db2除外。

使用道具 举报

回复
论坛徽章:
42
ITPUB元老
日期:2005-09-09 13:45:35马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14优秀写手
日期:2013-12-18 09:29:09ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32版主3段
日期:2012-05-15 15:24:112012新春纪念徽章
日期:2012-02-13 15:13:362012新春纪念徽章
日期:2012-02-13 15:13:36
45#
 楼主| 发表于 2007-7-8 10:07 | 只看该作者
luw上的db2,as400和390上的db2 和 db UDB 有什么区别吗?

使用道具 举报

回复
论坛徽章:
42
ITPUB元老
日期:2005-09-09 13:45:35马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14优秀写手
日期:2013-12-18 09:29:09ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32版主3段
日期:2012-05-15 15:24:112012新春纪念徽章
日期:2012-02-13 15:13:362012新春纪念徽章
日期:2012-02-13 15:13:36
46#
 楼主| 发表于 2007-10-11 09:20 | 只看该作者
whiterain  还没回答我的问题呢

使用道具 举报

回复
论坛徽章:
2
2009日食纪念
日期:2009-07-22 09:30:00ITPUB十周年纪念徽章
日期:2011-11-01 16:20:28
47#
发表于 2007-10-11 10:06 | 只看该作者

好奇 好奇

难道AS400和390上的DB2有另外不同的框架? 坚决顶起来这个帖子

使用道具 举报

回复
招聘 : c/c++研发
论坛徽章:
45
技术图书徽章
日期:2014-03-10 14:09:192012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15现任管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:50
48#
发表于 2007-10-11 10:16 | 只看该作者
两者区别很大,底层代码都是两套,可以看作两个不同的产品

使用道具 举报

回复
论坛徽章:
42
ITPUB元老
日期:2005-09-09 13:45:35马上有对象
日期:2014-02-19 11:55:14马上有钱
日期:2014-02-19 11:55:14马上有房
日期:2014-02-19 11:55:14马上有车
日期:2014-02-19 11:55:14优秀写手
日期:2013-12-18 09:29:09ITPUB 11周年纪念徽章
日期:2012-10-09 18:03:32版主3段
日期:2012-05-15 15:24:112012新春纪念徽章
日期:2012-02-13 15:13:362012新春纪念徽章
日期:2012-02-13 15:13:36
49#
 楼主| 发表于 2007-10-11 13:31 | 只看该作者
两者锁的机制有什么不同呢?相信 luw上的db2 的锁机制也是遵循SQL标准的(标准好像就是 IBM 订的),难道 as400和390上的db2  不遵循标准?
还是用特殊的硬件配合软件机制来实现的呢?

使用道具 举报

回复
招聘 : c/c++研发
论坛徽章:
45
技术图书徽章
日期:2014-03-10 14:09:192012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-02-13 15:12:092012新春纪念徽章
日期:2012-01-04 11:51:22ITPUB十周年纪念徽章
日期:2011-11-01 16:21:15现任管理团队成员
日期:2011-05-07 01:45:082011新春纪念徽章
日期:2011-01-25 15:42:562011新春纪念徽章
日期:2011-01-25 15:42:332011新春纪念徽章
日期:2011-01-25 15:42:152011新春纪念徽章
日期:2011-01-25 15:41:50
50#
发表于 2007-10-11 19:19 | 只看该作者
不知道:)去咨询db2 for z得管理员需要:)

使用道具 举报

回复

您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

TOP技术积分榜 社区积分榜 徽章 团队 统计 知识索引树 积分竞拍 文本模式 帮助
  ITPUB首页 | ITPUB论坛 | 数据库技术 | 企业信息化 | 开发技术 | 微软技术 | 软件工程与项目管理 | IBM技术园地 | 行业纵向讨论 | IT招聘 | IT文档
  ChinaUnix | ChinaUnix博客 | ChinaUnix论坛
CopyRight 1999-2011 itpub.net All Right Reserved. 北京盛拓优讯信息技术有限公司版权所有 联系我们 未成年人举报专区 
京ICP备16024965号-8  北京市公安局海淀分局网监中心备案编号:11010802021510 广播电视节目制作经营许可证:编号(京)字第1149号
  
快速回复 返回顶部 返回列表