Êý¾Ý¿âoracle for update of ºÍfor updateµÄÇø±ð
select * from TTable1 for update Ëø¶¨±íµÄËùÓÐÐУ¬Ö»ÄܶÁ²»ÄÜд
2 select * from TTable1 where pkid = 1 for update Ö»Ëø¶¨pkid=1µÄÐÐ
3 select * from Table1 a join Table2 b on a.pkid=b.pkid for update Ëø¶¨Á½¸ö±íµÄËùÓмǼ
4 select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update Ëø¶¨Á½¸ö±íµÄÖÐÂú×ãÌõ¼þµÄÐÐ
5. select * from Table1 a join Table2 b on a.pkid=b.pkid where a.pkid = 10 for update of a.pkid Ö»Ëø¶¨Table1ÖÐÂú×ãÌõ¼þµÄÐÐ
for update ÊÇ°ÑËùÓÐµÄ±í¶¼Ëøµã for update of ¸ù¾Ýof ºó±íµÄÌõ¼þËø¶¨Ïà¶ÔÓ¦µÄ±í
-----------
¹ØÓÚNOWAIT(Èç¹ûÒ»¶¨ÒªÓÃFOR UPDATE£¬ÎÒ¸ü½¨Òé¼ÓÉÏNOWAIT)
µ±ÓÐLOCK³åͻʱ»áÌáʾ´íÎó²¢½áÊøSTATEMENT¶ø²»ÊÇÔÚÄÇÀïµÈ´ý(±ÈÈç:Òª²éµÄÐÐÒѾ±»ÆäËüÊÂÎñËøÁË,µ±Ç°µÄËøÊÂÎñÓëÖ®³åÍ»,¼ÓÉÏnowait,µ±Ç°µÄÊÂÎñ»á½áÊø»áÌáʾ´íÎó²¢Á¢¼´½áÊø STATEMENT¶ø²»Ôٵȴý).
Èç¹û¼ÓÁËfor updateºó ¸ÃÓï¾äÓÃÀ´Ëø¶¨Ìض¨µÄÐУ¨Èç¹ûÓÐwhere×Ӿ䣬¾ÍÊÇÂú×ãwhereÌõ¼þµÄÄÇЩÐУ©¡£µ±ÕâЩÐб»Ëø¶¨ºó£¬ÆäËû»á»°¿ÉÒÔÑ¡ÔñÕâЩÐУ¬µ«²»Äܸü¸Ä»òɾ³ýÕâЩÐУ¬Ö±µ½¸ÃÓï¾äµÄÊÂÎñ±»commitÓï¾ä»òrollbackÓï¾ä½áÊøΪֹ¡£
ÒòΪFOR UPDATE×Ó¾ä»ñµÃÁËËø£¬ËùÒÔCOMMIT½«ÊÍ·ÅÕâЩËø¡£µ±ËøÊÍ·ÅÁË£¬¸ÃÓαê¾ÍÎÞЧÁË¡£
¾ÍÊÇÕâЩÇø±ðÁË
Ïà¹ØÎĵµ£º
Oracle ±íɾ³ý´óÁ¿Êý¾Ýºó£¬¼´Ê¹±íÖÐÖ»Óм¸ÐмǼ£¬µ«ÓÃselect count(*) from table À´²éѯ·¢¾õ¶¼²»»áÂíÉϳöÀ´£¬ÔÒòÊǸñíµÄ¿Õ¼ä´óÁË£¬²éѯÆðÀ´ºÜÂý¡£½â¾öµÄ·½·¨ÊǰѸñíËùÕ¼Óõıí¿Õ¼äËõС£¬»òÕß˵Êͷűí¿Õ¼ä¡£
alter table XXXX move; ÕâÑù´¦Àíºó¾ÍÊÍ·ÅÁ˱í¿Õ¼äÁË¡£µ«ÊÇÊͷűí¿Õ¼äºó£¬±íµÄÐкÅrowid»á·¢Éú±ä»¯£¬¶ø»ùÓÚ ......
oracleÆô¶¯ÎÊÌâ
Ò»£ºÊý¾Ý¿âûÓÐÆô¶¯
#sqlplus /nolog
sql>connect /as sysdba
sql>startup
¶þ£º¼àÌý³öÎÊÌâ
µÇ¼DB·þÎñÆ÷
ʹÓÃlsnrctl start/stop¿ªÆô/¹Ø±Õ¼àÌý
ʹÓÃlsnrctl status²é¿´×´Ì¬
ÀíӦΪ£º
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ERPAP)(PORT=1521)))
STATUS of the ......
²»Óð²×°Oracle ClientÈçºÎʹÓÃPLSQL Developer
1. ÏÂÔØoracleµÄ¿Í»§¶Ë³ÌÐò°ü£¨30M£©
Ö»ÐèÒªÔÚOracleÏÂÔØÒ»¸ö½ÐInstant Client PackageµÄÈí¼þ¾Í¿ÉÒÔÁË£¬Õâ¸öÈí¼þ²»ÐèÒª°²×°£¬Ö»Òª½âѹ¾Í¿ÉÒÔÓÃÁË£¬ºÜ·½±ã£¬¾ÍËãÖØ×°ÁËϵͳ»¹ÊÇ¿ÉÒÔÓõġ£
ÏÂÔص ......
Á¬½ÓOracleÊý¾Ý¿âµÄHibernateÅäÖÃÎļþ
Á¬½ÓOracleµÄHibernateÅäÖÃÎļþÓÐÁ½ÖÖ¸ñʽ£¬Ò»ÖÖÊÇxml¸ñʽµÄ£¬ÁíÒ»ÖÖÊÇJavaÊôÐÔÎļþ¸ñʽµÄ¡£ÏÂÃæ·Ö±ð¸ø³öÕâÁ½ÖÖ¸ñʽÅäÖÃÎļþµÄ´úÂë¡£
1£®xml¸ñʽµÄÅäÖÃÎļþ
ÏÂÃ潫¸ø³öÁ¬½Ó±¾µØOracle·þÎñÆ÷ÉϵÄdb_database02Êý¾Ý¿âʱHibernateÅäÖÃÎļþhibernate.cfg.xmlµÄ´úÂë¡£
Àý³Ì2-5£º¹âÅÌ\mr ......