文章分类 -  数据库

oracle for update和for update nowait的区别
摘要:1、for update 和 for update nowait 的区别:首先一点,如果只是select 的话,Oracle是不会加任何锁的,也就是Oracle对 select 读到的数据不会有任何限制,虽然这时候有可能另外一个进程正在修改表中的数据,并且修改的结果可能影响到你目前select语句的结果,但是因为没有锁,所以select结果为当前时刻表中记录的状态。如果加入了for update,则Oracle一旦发现(符合查询条件的)这批数据正在被修改,则不会发出该select语句查询,直到数据被修改结束(被commit),马上自动执行这个select语句。同样,如果该查询语句发出后,有人需 阅读全文

posted @ 2012-12-28 11:14 应无所住而生其心 阅读(116) 评论(0) 推荐(0)

select for update nowait 与 select for update 区别
摘要:nowait的含义很多人都会误解为“不用等待,立即执行”。但实际上该关键字的含义是“不用等待,立即返回”如果当前请求的资源被其他会话锁定时,会发生阻塞,nowait可以避免这一阻塞,因为If another user is in the process of modifying that row, we will get an ORA‐00054Resource Busy error. We are blocked and must wait for the other user to finish withit.可以实验下,我用pl/sql developer锁定表gameSQL> s 阅读全文

posted @ 2012-12-28 11:13 应无所住而生其心 阅读(160) 评论(0) 推荐(0)

导航