oracle Ô¼Êø(constraint)µÄ¼¸¸ö²ÎÊýµÄСÑо¿
Ê×ÏȸãÇåϼ¸¸ö¸ÅÄ
ORACLEÖУ¬Ô¼Êø·Ödeferred ¸ú immediate 2ÖÖ£º
deferred:Èç¹û Oracle ÔÚÊÂÎñÌá½»£¨commit£©Ê±²Å¶ÔÔ¼ÊøÖ´Ðмì²é£¬Ôò³Æ´ËÔ¼ÊøÊÇÑӳٵģ¨deferred£©¡£Èç¹ûÊý¾ÝÎ¥·´ÁËÑÓ³ÙÔ¼Êø£¬Ìá½»²Ù×÷½«µ¼ÖÂÊÂÎñ±»»Ø¹ö£¨undo£©¡£
immediate:Èç¹ûÔ¼ÊøÊǼ´Ê±µÄ£¨immediate£©£¨·ÇÑӳٵģ©£¬Ôò´ËÔ¼Êø½«ÔÚÓï¾äÖ´ÐнáÊøºó½øÐмì²é¡£Èç¹ûÊý¾ÝÎ¥·´ÁËÑÓ³ÙÔ¼Êø£¬Óï¾ä½«±»Á¢¼´»Ø¹ö¡£
Ò»°ãÇé¿öÏ£¬ÎÒÃÇÓõÄÔ¼Êø³õʼ¶¼ÊÇimmediateÐ͵Ä(ĬÈÏ)£¬¶øÇÒ²»ºÃתΪdeferredÐÍ¡£µ«ÊÇÈç¹û³õʼÊÇdeferrable(ÐèÒªÊÖ¶¯Ö¸¶¨),ÄÇdeferred¸úimmediate 2ÖÖ״̬¿ÉÒÔËæÒâת»»¡£
´ËÍ⣬ԼÊøÓÐÒÔÏÂ4ÖÖ״̬£º
ENABLE£¨ÆôÓã©È·±£ËùÓÐÊäÈëµÄÊý¾Ý¶¼×ñ´ÓÔ¼Êø£¨constraint£©
DISABLE£¨½ûÓã©×ÜÊÇÔÊÐíÊäÈëÊý¾Ý£¬ÎÞÂÛÊý¾ÝÊÇ·ñ×ñ´ÓÔ¼Êø
VALIDATE£¨ÑéÖ¤£©È·±£ÒÑ´æÔÚµÄÊý¾Ý×ñ´ÓÔ¼Êø
NOVALIDATE£¨ÎÞÑéÖ¤£©ÔÊÐíÒÑ´æÔÚµÄÊý¾Ý²»×ñ´ÓÔ¼Êø
ENABLE VALIDATE Óë ENABLE Ïàͬ¡£Oracle ½«¼ì²éÔ¼Êø£¬²¢±£Ö¤ËùÓÐÊý¾Ý¾ù×ñ´ÓÔ¼Êø¡£
ENABLE NOVALIDATE ±íʾËùÓÐвåÈë»ò±»Ð޸ĵÄÊý¾Ý¶¼±ØÐë×ñ´ÓÔ¼Êø£¬µ«ÔÊÐíÒÑ´æÔÚµÄÊý¾Ý²»×ñ´ÓÔ¼Êø¡£
DISABLE NOVALIDATE Óë DISABLE Ïàͬ¡£Oracle ²»»á¼ì²éÔ¼Êø.
DISABLE VALIDATE ½«½ûÓÃÔ¼Êø£¬ÒƳýÔ¼ÊøʹÓõÄË÷Òý£¬²¢½ûÖ¹ÐÞ¸ÄÔ¼Êø¼üµÄÊý¾Ý¡£
Ô¼Êø²»ÂÛÄÄÖÖÀàÐÍ£¬ÒªÄܹ»ÉúЧ£¬±ØÐë״̬ÊÇenable²ÅÐС£
SQLPLUS(oracle 10.2.0.1):
--deferred ¸ú immediateµÄ¶Ô±ÈÊÔÑé-----------------------------
SQL> drop table aa purge;
Table dropped.
SQL> create table aa ( id number,name varchar2(20),constraint pk primary key(id));
Table created.
SQL> col constraint_name for a11
SQL> select CONSTRAINT_NAME ,CONSTRAINT_TYPE,TABLE_NAME ,STATUS,DEFERRABLE,DEFERRED,validated from u
ser_constraints where table_name='AA';
CONSTRAINT_ C TABLE STATUS DEFERRABLE DEFERRED VALIDATED
----------- - ----- -------- -------------- --------- -------------
PK P AA ENABLED NOT DEFERRABLE IMMEDIATE VALIDATED
--¿ÉÒÔ¿´µ½£¬Ä¬ÈϵÄÊÇNOT DEFERRABLE£¬ÏÂÃæÎÒÃǽ«ËüתΪimmediateÊÔÊÔ
SQL> set constraint pk immediate;
set constraint pk imme
Ïà¹ØÎĵµ£º
ÏîÄ¿ÖÐÓÐһЩ±¨±í£¬±¾ÉíËٶȾͲ»Ì«¿ì£¬Óöµ½Êý¾ÝÁ¿´óµÄÇé¿ö£¬¸üÊÇÈÃÈË×¥¿ñ£¬Óû§Ò²Ìá³öÁ˱¨±íËÙ¶ÈÂýµÄÎÊÌ⣬ÓÚÊÇÏë×ÅÈçºÎʵÏÖ±¨±íµÄÊý¾ÝÒÀÀµ»º´æ£¬¼´½«±¨±íÊý¾Ý»º´æ£¬µ±Êý¾Ý·¢Éú¸Ä±äʱ£¬ÔÙÖØлñÈ¡Êý¾Ý¡£
×î¼òµ¥µÄ·½·¨£¬ÊÇÔÚÏÔʾ±¨±íµÄaspxÒ³ÃæµÚÒ»ÐмÓÉÏÐÎÈç<%@ OutputCache Duration="600" VaryByParam="some_par ......
-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓбí
SELECT table_name from user_tables;
-- ²é¿´ORACLE Êý¾Ý¿âÖÐËùÓÐÓû§ÏµÄËùÓбí
select user,table_name from all_tables;
-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓÐÁÐ
select table_name,column_name from user_tab_columns;
-- ²é¿´ORACLE Êý¾Ý¿âÖб¾Óû§ÏµÄËùÓÐÁÐ
se ......
ת×Ô£ºhttp://www.cnblogs.com/houxm/archive/2009/08/26/1554481.html
Ïê½â£ºhttp://sunwayle.blog.51cto.com/114995/102516
Oracle »ØÊÕÕ¾¹¦ÄÜ,³¹µ×ɾ³ý±í
Oracle 10g
ÖгöÏÖ±íÃû£ºBIN$2cMp4FjwQ2Cw3Lj+BxLYTw==$0
×î½ü·¢ÏÖOracleÖгöÏÖÁËÕâЩÆæ¹ÖµÄ±íÃû£¬ÉÏÍø²éÕÒºó·¢ÏÖÊÇoracle10gµÄ»ØÊÕÕ¾¹¦ÄÜ£¬²¢Ã»Óг¹µ×µÄɾ³ ......
Checkpoint
ºÜ¶àÈ˶¼°ÑcheckpointµÄ¸ÅÄî¸ø¸´ÔÓ»¯ÁË£¬ÆäʵcheckpointÕâ¸öÊý¾Ý¿â¸ÅÄîÒýÈëµÄÕæÕýÒâÒå¾ÍÊÇÓÃÀ´¼õÉÙÔÚÊý¾Ý¿â
»Ö¸´¹ý³ÌÖÐËù»¨µÄʱ¼ä(instance recovery),ÄÇôcheckpointÊÇÓÉËÀ´×öµÄÄØ?ÎÒÃǶ¼ÖªµÀÊý¾Ý¿âÖÐÓиöCKPT½ø³Ì£¬ÕâÊǸö
¿ÉÑ¡½ø³Ì£¬µ«ÊÇÕæÕýÖ´Ðмì²éµãµÄÈÎÎ ......