¹ØÓÚOracleÊÂÎñµÄ×ܽá
¹ØÓÚOracleÊÂÎñµÄ×ܽá
1.ʲôÊÇÊÂÎñ£¬ÊÂÎñµÄÌØÐÔÊÇʲô£¿
ÊÂÎñµÄÈÎÎñ±ãÊÇʹÊý¾Ý¿â´ÓÒ»ÖÖ״̬±ä»»³ÉΪÁíÒ»ÖÖ״̬£¬ÕⲻͬÓÚÎļþϵͳ£¬ËüÊÇÊý¾Ý¿âËùÌØÓõġ£ËüµÄÌØÐÔÓÐËĸö£ºTOM×ܽáΪACID¼´
Ô×ÓÐÔatomicity:Óï¾ä¼¶Ô×ÓÐÔ£¬¹ý³Ì¼¶Ô×ÓÐÔ£¬ÊÂÎñ¼¶Ô×ÓÐÔ
Ò»ÖÂÐÔconsistency:״̬һÖ£¬Í¬Ò»ÊÂÎñÖв»»áÓÐÁ½ÖÖ״̬
¸ôÀëÐÔisolation:ÊÂÎñ¼äÊÇ»¥Ïà·ÖÀëµÄ»¥²»Ó°Ïì(ÕâÀï¿ÉÄÜÒ²ÓÐ×ÔÖÎÊÂÎñ)
³Ö¾ÃÐÔdurability:ÊÂÎñÌá½»ÁË£¬ÄÇô״̬¾ÍÊÇÓÀ¾ÃµÄ
¶ÔÓÚÓï¾ä¼¶Ô×ÓÐÔ£¬¹ý³Ì¼¶Ô×ÓÐÔºÍÊÂÎñ¼¶Ô×ÓÐÔ¿ÉÒÔ²éÔÄÒ»ÏÂÏà¹ØµÄÐÅÏ¢
2.OracleÖеÄÊÂÎñÓï¾ä
commit=commit work Ìá½»
rollback=rollback work »Ø¹ö
savepoint ÊÂÎñµÄ±ê¼Çµã£¬¿ÉÒÔʹһ¸öÊÂÎñÔڻعöµ½²»Í¬µÄ½×¶Î
set transaction ¿ªÊ¼Ò»¸öÊÂÎñ
rollback to savepoint Óësavepoint¶ÔÓ¦
ÁíÍâ¶ÔÓÚ×ÔÖÎÊÂÎñ»¹ÓÐÒ»¸ö,ÏÂÃæ»á×ÅÖØ˵һϹØÓÚ×ÔÖÎÊÂÎñ
pragma autonomous_transaction
3.¹ØÓÚÍêÕûÐÔÔ¼ÊøÓëÊÂÎñµÄ¹Øϵ
ÍêÕûÐÔÔ¼ÊøµÄģʽÓÐimmediate,deferredµÈ
Óï·¨£ºset constraint c_fk defereed
Õâ¶ÔÓÚ¼¶Áª¸üкÜÓаïÖú£¬ÈçÏÂÃæµÄtomÔÚÊéÖоٵÄÀý×Ó£º
SQL> create table p(pk int primary key);
±íÒÑ´´½¨¡£
SQL> create table c
2 (fk constraint c_fk
3 references p(pk)
4 deferrable
5 initially immediate
6 )
7 /
±íÒÑ´´½¨¡£
Óï¾ä: set constraint c_fk immediate;
set constraint c_fk deferred;
SQL> set constraint c_fk immediate;
Ô¼ÊøÌõ¼þÒÑÉèÖá£
SQL> update p set pk=3;
update p set pk=3
*
ERROR λÓÚµÚ 1 ÐÐ:
ORA-02292: integrity constraint (FTITEM.C_FK) violated - child record found
SQL> set constraint c_fk deferred;
Ô¼ÊøÌõ¼þÒÑÉèÖá£
SQL> update p set pk=3;
ÒѸüР1 ÐС£
SQL> update c set fk=3;
ÒѸüР1 ÐС£
SQL> commit;
Ìá½»Íê³É¡£
SQL> set constraint c_fk immediate;
Ô¼ÊøÌõ¼þÒÑÉèÖá£
4.ÔÚÊÂÎñÖÐÁ½¸ö²»ºÃµÄ·½·¨
tomÔÚÊéÉÏÌáµ½ÁËÁ½ÖÖ²»ºÃµÄÊÂÎñʹÓÃÏ°¹ß£¬ÎÒÔÚ¹¤×÷ÖÐÒ²ÊǾ³£·¸µÄ£¬Ö÷ÒªÊÇÒòΪ¶ÔÓÚÿÖÖÊý¾Ý¿âµÄÈÏʶ²»µ½Î»£¬ÌýºÃ¶àÅóÓÑ˵Êý¾Ý¿âÄãÖ»Òª»áÓÃÁËÒ»¸öÆäËüµÄ¾Í¿ÉÒÔÁË£¬¾¹ýÕâ¶Îʱ¼äµÄѧϰ£¬ÆäʵÎÒÃÇËù˵µÄ»áÖ»ÊÇ˵¶ÔÒ»SQLÓï¾äµÈ£¬¶ø²¢²»ÊÇÀí½â£¬±È
Ïà¹ØÎĵµ£º
²Ù×÷ϵͳµÄÖ§³Ö °æ±¾ºÍ·¢Ðаæ ʵÀý¡¢Êý¾Ý¿âºÍ±í¿Õ¼ä ʵÀýÃûºÍSID ϵͳÊý¾Ý¿âºÍϵͳ±í¿Õ¼ä
Ò»°ãµÄ¹«Ë¾Í¨³£»áÔÚËûÃǵÄÐÅϢϵͳ¼Ü¹¹ÖÐÒýÈë¶àÖÖÊý¾Ý¿âƽ̨£¬Í¬Ê±ÒýÈëÈýµ½ËÄÖÖ²»Í¬µÄRDBMS½â¾ö·½°¸µÄÖдóÐ͹«Ë¾Ò²²¢²»ÉÙ¼û£¬µ±È»ÕâЩ¹«Ë¾ÀïÃæµÄDBAÃÇͨ³£Ò²ÐèҪͬʱӵÓйÜÀí¶àÖÖ²»Í¬Æ½Ì¨µÄ¼¼ÄÜÁË¡£
Ö»ÔÚÒ»ÖÖƽ̨ÉÏÕ¹¿ª¹¤×÷µÄÊý¾Ý ......
Êý¾Ý¿âʵÀý½á¹¹ ÊÂÎñÒ»ÖÂÐÔ(Transactional Consistency)ºÍ»ùÓÚʱ¼äµãµÄ»Ö¸´(Point-in-time Recovery) ϵͳԪÊý¾Ý
topÊý¾Ý¿âʵÀý½á¹¹
µ±OracleʵÀýÆô¶¯Ö®ºó£¬Ëù¿´µ½µÄ¾ÍÊÇÔÚ·þÎñÆ÷ÄÚ´æÉϵÄÒ»¸ö¸ö²»Í¬ÄÚ´æ¿é¼ÓÉϲúÉúµÄÓëÕâЩÄÚ´æ½»»¥µÄºǫ́½ø³Ì¡£OracleÎĵµ½«ÕâЩÄÚ´æ½á¹¹ºÍ½ø³ÌÊյĺÜÏêϸ¡£
ÓÉOracleʵÀýËùÕ¼ÓõÄÄÚ´æ¿é³ ......
ͨ¹ýJDBC£¬ÎÒÃÇ¿ÉÒÔÏòoracle²åÈë´ó¶ÔÏó£¬ÈçͼƬ£¬ÒôƵ£¬³¤Îı¾µÈ£¬Æä²åÈë·½·¨Óкܶ࣬ÕâÀïÑÝʾһÏÂͨ¹ýÁ÷¸üиüеÄÐÎʽ²åÈëCLOB´ó¶ÔÏó¡£
ÕâÊÇÒ»¸ö´æ´¢Îı¾µÄÀý×Ó£¬½âÊÍÎÒ»áÔÚ³ÌÐòÖÐÒÔ×¢Ê͵ÄÐÎʽд³ö
/**
* ½«Éú³ÉµÄ±íÑù´æ´¢µ½Êý¾Ý¿â
*
* @param htmlParam
* @return
*/
  ......
Ò»¡¢Enterprise Manager 10g
ĬÈÏÇé¿öÏ£¬°²×°Oracleʱ£¬»á°²×°EM¡£ËüÊÇλÓÚÊý¾Ý¿â·þÎñÆ÷ÉϵÄHTTP·þÎñÆ÷¡£
£¨1£©Æô¶¯EM
Ҫȷ±£OracleDBConsole<SID>·þÎñÒѾÆô¶¯¡£
Æô¶¯·þÎñ£ºemctl start dbconsole
¹Ø±Õ·þÎñ£ºemctl stop dbconsole
·ÃÎÊEM£ºhttp://·þÎñÆ÷Ãû³Æ£º¶Ë¿ÚºÅ/em
¶Ë¿ÚºÅ¿ÉÔÚ$ORACLE_HOME\product\10. ......
1¡¢Ä¬ÈÏÊÂÀý£º
Óû§Ãû£ºscottÃÜÂ룺tiger Ö÷»ú×Ö·û´®£º±¾»ú¿ÉÒÔΪ¿Õ
2¡¢Æô¶¯·½·¨£º
ÔËÐУºsqlplus scott/tiger@lhd
3¡¢SQLPLUS»ù±¾ÃüÁ
Desc£ºÏÔʾ±í¡¢ÊÓͼ½á¹¹ desc ±íÃû£¬ÊÓͼ
List£ºÁгöSQL»º³åÇøÇøÖеÄÒ»Ðлò¶àÐÐÃüÁîÓï¾ä
Exit£ºÍ˳ö
4¡¢³£ÓõÄÊý¾Ý×Öµä(ÈýÖÖǰ׺£ºUSER£¬ALL£¬DBA)
USER_TABL ......