Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

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.


Ïà¹ØÎĵµ£º

oracle PL SQLѧϰ°¸Àý£¨¶þ£©

¡¾ÑµÁ·6.1¡¿¡¡Ê¹ÓÃÒþʽÓαêµÄÊôÐÔ£¬Åж϶ԹÍÔ±¹¤×ʵÄÐÞ¸ÄÊÇ·ñ³É¹¦¡£
²½Öè1£ºÊäÈëºÍÔËÐÐÒÔϳÌÐò£º
BEGIN
  UPDATE emp SET sal=sal+100 WHERE empno=1234;
  IF SQL%FOUND THEN
       DBMS_OUTPUT.PUT_LINE('³É¹¦Ð޸ĹÍÔ±¹¤×Ê£¡');
       ......

Oracle ÈÕÆÚ²éѯÓï¾äС½á

²éѯÐÇÆÚ¼¸:
select to_char(sysdate,'day') from dual;
²éѯ¼¸ºÅ:
select to_char(sysdate,'dd') from dual;
²éѯСʱÊý:
select to_char(sysdate,'hh24') from dual;
²éѯʱ¼ä:
select to_char(sysdate,'hh24:mi:ss') from dual;
²éѯÈÕÆÚʱ¼ä:
select to_char(sysdate,'yyyy-mm-dd hh24:mi:ss') from dual;
²é ......

solaris 10 oracleµÄ°²×°

ÇëÑéÖ¤Ò»ÏÂsolarisºÍoracleµÄ°æ±¾ÐÅÏ¢£¬Èç¹û°æ±¾ºÅ²»¶Ô£¬¿ÉÄܻᰲװʧ°Ü
solaris°æ±¾£ºSunOs 5.10
oracle°æ±¾£º Oracle Database 10g Release 2 (10.2.0.2) for Solaris Operating System (x86)
**Èç¹û²»ÖªµÀsolarisµÄ°æ±¾£¬¿ÉÒÔÔÚÃüÁî´°¿ÚÊäÈë:uname -a
µÚÒ»²½:ÒÔROOTÉí·ÝµÇ½ϵͳ
µÚ¶þ²½:´´½¨Óû§ºÍ×é:
#groupadd ......

¹ØÓÚÔÚoracle ½âËø³öÏÖµÄһЩÎÊÌâ¡£

    ÔÚѧϰoracleµÄʱºòÓöµ½ÁËÒ»¸öÎÊÌ⣬µ±ÎҵǼscottÓû§µÄʱºòÔõô¾ÍÊÇÁ´½Ó²»ÉÏ£¬³öÏÖÁËÒÔÏ´íÎóÌáʾ£¬the account is locked,˵Ã÷scottÓû§±»Ëø×¡ÁË£¬ÎҾͽøÐÐÁ˽âËø£¬Óï¾äÈçÏ£ºalter user soctt account unlock;Ö´ÐÐÍêÒÔºó·¢ÏÖÓÖÌáʾÁËÒ»¸ö´íÎóÐÅÏ¢£¬No Connect
ÎÞ·¨Á´½Ó£¬ºóÀ´ÔÚÍøÉϲéÁ˲飬ÖÕÓÚÕÒµ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ