Oracle dead lock deep research.
Update SQLS will lead dead lock exception. Because by default, it use optimistic lock but not pessimistic lock.
Below description is exceprted from the attachment(It exceeds my image that this blog can not upload the attachment,hehe)
Optimistic locking offers an elegant solution to the problems outlined above. Optimistic locking does
not lock records when they are read, and proceeds on the assumption that the data being updated has not
changed since the read. Since no locks are taken out during the read, it doesn’t matter if the user goes to
lunch after starting a transaction, and deadlocks are all but eliminated since users should never have to
wait on each other’s locks
There are some ways to resolve this problem.
1. Create a pessimistic lock. Change the sql like below formal.
First: select … from … for update nowait
Second: update the resultSet.
2. Execute the SQL again after a random duration when program meets this kind of exception. (It will consume lot of db server resource. I don't think it is the better way)
3. Schedule the SQL executed sequenced or split data without interfere.
相关文档:
天有不测风云,
IBM 的中端磁盘阵列这次又惹祸了。在微码升级的时候,
DS4800 发生故障。导致当时在这台库上的几套生产库报错了。
IBM工程师把阵列故障恢复后,拍拍屁股走人,阵列上的数据又得我们来想办法抢救了。。。。
还好有oracle support的支持我们最终化解了这次危机。下文详细介绍了整个恢复的过程。
oracle工 ......
Oracle中to_date()与24小时制表示法及mm分钟的显示:
在使用Oracle的to_date函数来做日期转换时,很多Java程序员也许会和我一样,直觉的采用“yyyy-MM-dd HH:mm:ss”的格式
作为格式进行转换,但是在Oracle中会引起错误:“ORA 01810 格式代码出现两次”。如:
to_date('2005-01-01 13:14:20 ......
数据库数据
ID
UserName
Date
1
User1
2010/4/27
1
User1
2010/4/11
1
User1
2010/4/1
要求:
获取最新日期的一条数据
Sql语句:
select t.* from tb t where date = (select max(date) from tb where id = t.id) order by t.id ......
在
Oracle
数
据库
中,
主要有两种
日志
操作模式,分别为非归
档模式与归档模式。默认情况下,数据库
采
用的是非归档模式
。作为一个合格的数据库管
理
员,应当深入了解这两种日志操作模式的特点,并且在数据库建立时,选
择合适的操作模式。
笔者
今天就谈谈自己对这两种操作模式的理解,并且给出 ......