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.
相关文档:
存储过程
==========================================================================
==========================================================================
【训练15.1】 创建一个显示雇员总人数的存储过程。
步骤1:登录SCOTT账户(或学生个人账户)。
步骤2: ......
oracle grant
授权语句--select * from dba_users; 查询数据库中的所有用户
--alter user TEST_SELECT account lock; 锁住用户
--alter user TEST_SELECT account unlock; 给用户解锁
--create user xujin identified by xujin; 建立用户
--grant create tablespace to xujin; 授权
--grant select ......
•表分区技术是在超大型数据库(VLDB)中将大表及其索引通过分区(patition)的形式分割为若干较小、可管理的小块,并且每一分区可进一步划分为更小的子分区(sub partition)
•通过对表进行分区,可以获得以下的好处
–减少数据损坏的可能性
–各分区可以独立备份和恢复,增强了数据库的可管理性
......
在
Oracle
数
据库
中,
主要有两种
日志
操作模式,分别为非归
档模式与归档模式。默认情况下,数据库
采
用的是非归档模式
。作为一个合格的数据库管
理
员,应当深入了解这两种日志操作模式的特点,并且在数据库建立时,选
择合适的操作模式。
笔者
今天就谈谈自己对这两种操作模式的理解,并且给出 ......