Oracle Stream Replication¼¼Êõ
Stream ÊÇOracle µÄÏûÏ¢¶ÓÁÐ(Ò²½ÐOracle Advanced Queue)¼¼ÊõµÄÒ»ÖÖÀ©Õ¹Ó¦ÓᣠOracle µÄÏûÏ¢¶ÓÁÐÊÇͨ¹ý·¢²¼/¶©Ôĵķ½Ê½À´½â¾öʼþ¹ÜÀí¡£Á÷¸´ÖÆ(Stream replication)Ö»ÊÇ»ùÓÚËüµÄÒ»¸öÊý¾Ý¹²Ïí¼¼Êõ£¬Ò²¿ÉÒÔ±»ÓÃ×÷Ò»¸ö¿ÉÁé»î¶¨ÖƵĸ߿ÉÓÃÐÔ·½°¸¡£ Ëü¿ÉÒÔʵÏÖÁ½¸öÊý¾Ý¿âÖ®¼äÊý¾Ý¿â¼¶£¬schema¼¶£¬Table¼¶µÄÊý¾Ýͬ²½£¬²¢ÇÒÕâÖÖͬ²½¿ÉÒÔÊÇË«ÏòµÄ¡£ Oracle StreamÒ²ÊÇͨ¹ýÊý¾ÝÈßÓàÀ´Ìá¸ß¿ÉÓÃÐÔ£¬ÕâÒ»µãºÍData Guard ÀàÐÍ¡£
Oracle ¸ß¼¶¸´ÖÆ(Oracle advanced Replication) ºÍÁ÷¸´ÖÆ(Stream Replication) ÊÇ´ÓÃû³ÆºÍ¹¦ÄÜÉ϶¼ÏàËƵÄÁ½ÖÖ¼¼Êõ¡£ µ«Ç°ÕßÊÇ»ùÓÚ´¥·¢Æ÷µÄ£¬ºóÕßÊÇ»ùÓÚÈÕÖ¾ÍÚ¾ò(Logminer)¼¼Êõ¡£
1. Stream µÄ¹¤×÷ÔÀí
Stream ÊÇOracle Advanced Queue¼¼ÊõµÄÒ»ÖÖÀ©Õ¹Ó¦Ó㬠ÕâÖÖ¼¼Êõ×î»ù±¾µÄÔÀí¾ÍÊÇÊÕ¼¯Ê¼þ£¬°Ñʱ¼ä±£´æÔÚ¶ÓÁÐÖУ¬È»ºó°ÑÕâЩʼþ·¢²¼¸ø²»Í¬µÄ¶©ÔÄÕß¡£ ´ÓDBAµÄ½Ç¶ÈÀ´Ëµ£¬ ¾ÍÊǰѲ¶»ñOracleÊý¾Ý¿â²úÉúµÄRedoÈÕÖ¾£¬È»ºó°ÑÕâЩÈÕ־ͨ¹ýÍøÂç´«²¥µ½¶à¸öÊý¾Ý¿â£¬ÆäËûÊý¾Ý¿âͨ¹ýÓ¦ÓÃÕâЩÈÕÖ¾£¬´ïµ½¸´ÖƱ仯µÄ×÷Óá£
ÔÚStream »·¾³Ï£¬ ¸´ÖƵÄÆðµãÊý¾Ý¿â½Ð×÷Source Database£¬ ¸´ÖƵÄÖÕµãÊý¾Ý¿â½Ð×÷Target Database¡£ ÔÚÕâÁ½¸öÊý¾Ý¿âÉ϶¼Òª´´½¨Ò»¸ö¶ÓÁУ¬ÆäÖеÄSource DatabaseÉϵÄÊÇ·¢ËͶÓÁУ¬¶øTarget DatabaseÉϵÄÊǽÓÊÕ¶ÓÁС£
Êý¾Ý¿âµÄËùÓвÙ×÷¶¼»á±»¼Ç¼ÔÚÈÕÖ¾ÖС£ ÅäºÃStream»·¾³ºó£¬ ÔÚSource DatabaseÉÏ»áÓÐÒ»¸ö²¶»ñ½ø³Ì(Capture Process), ¸Ã½ø³ÌÀûÓÃLogminer¼¼Êõ´ÓÈÕÖ¾ÖÐÌáÈ¡DDL,DMLÓï¾ä£¬ÕâЩÓï¾äÓÃÒ»ÖÖÌØÊâµÄ¸ñʽ±í´ï£¬½Ð×÷Âß¼±ä¸ü¼Ç¼(Logical Change Record, LCR). Ò»¸öLCR¶ÔÓ¦Ò»¸öÔ×ÓµÄÐбä¸ü£¬Òò´ËÔ´Êý¾Ý¿âÉϵÄÒ»¸öDMLÓï¾ä£¬¿ÉÄܶÔÓ¦Èô¸É¸öLCR¼Ç¼¡£ ÕâЩLCR»á±£´æµ½Sourece DatabaseµÄ±¾µØ·¢ËͶÓÁÐÖС£È»ºó´«²¥½ø³Ì(Propagation Process)°ÑÕâЩ¼Ç¼ͨ¹ýÍøÂç·¢Ë͵½Target DatabaseµÄ½ÓÊÕ¶ÓÁС£ ÔÚTarget DatabaseÉÏ»áÓÐÒ»¸öÓ¦Óýø³Ì(Apply Process)£¬ Õâ¸ö½ø³Ì´Ó±¾µØµÄ½ÓÊÕ¶ÓÁÐÖÐÈ¡³öLCR¼Ç¼£¬È»ºóÔÚ±¾µØÓ¦Óã¬ÊµÏÖÊý¾Ýͬ²½
2. Data Guard ºÍStream Çø±ð
Date GuardÓÐÁ½ÖÖÀàÐÍ£ºphysical sta
Ïà¹ØÎĵµ£º
(1) v$sql
¡¡¡¡Ò»ÌõÓï¾ä¿ÉÒÔÓ³Éä¶à¸öcursor,ÒòΪ¶ÔÏóËùÖ¸µÄcursor¿ÉÒÔÓв»Í¬Óû§(ÈçÀý1)¡£Èç¹ûÓжà¸öcursor(×ÓÓαê)´æÔÚ£¬ÔÚV$SQLAREAΪËùÓÐcursorÌṩ¼¯ºÏÐÅÏ¢¡£
Àý1£º
ÕâÀï½éÉÜÒÔÏÂchild cursor
user A: select * from tbl
user B: select * from tbl
´ó¼ÒÈÏΪÕâÁ½ÌõÓï¾äÊDz»ÊÇÒ»ÑùµÄ°¡£¬¿ÉÄÜ»áÓкܶàÈË»á˵ÊÇÒ»Ñù ......
Oracle×Ô8iÆð¾ÍÈ«ÃæÖ§³Öjava£¬µ«¸÷¸ö°æ±¾µÄoracleÖÐĬÈÏjdk°æ±¾¾ù²»Ïàͬ£¬oracle8iÖÐΪ jdk1.2,oracle9iÖÐΪjdk1.3,oracle10gÖÐΪjdk1.4~~ÖÁ±ÊÕßÐÐΪ֮¼Ê£¬µ±Ç°µÄ×îа汾Ϊjdk1.5 update 11.
Òò±ÊÕßjava¿ª·¢³öÉí£¬ÔÚ×öoracle¿ª·¢Öо³£»áÓÃjavaÀ´À©Õ¹ oracle¹¦ÄÜ£¬µ«ÊÇÓÉÓÚoracle×Ô´øjdk°æ±¾¹ýµÍ£¬¿ÉÄÜ»áÔì³ÉһЩ ......
Êý¾Ý×Öµädict×ÜÊÇÊôÓÚOracleÓû§sysµÄ¡£
1¡¢Óû§£º
¡¡select username from dba_users;
¸Ä¿ÚÁî
¡¡alter user spgroup identified by spgtest;
2¡¢±í¿Õ¼ä£º
¡¡select * from dba_data_files;
¡¡select * from dba_tablespaces;//±í¿Õ¼ä
¡¡select tablespace_name,sum(bytes), sum(blocks)
from dba_ ......
±¾ÊÓͼ³ÖÐø¸ú×ÙËùÓÐshared poolÖеĹ²Ïícursor£¬ÔÚshared poolÖеÄÿһÌõSQLÓï¾ä¶¼¶ÔÓ¦Ò»ÁС£±¾ÊÓͼÔÚ·ÖÎöSQLÓï¾ä×ÊԴʹÓ÷½Ãæ·Ç³£ÖØÒª¡£
V$SQLAREAÖеÄÐÅÏ¢ÁÐ
HASH_VALUE£ºSQLÓï¾äµÄHashÖµ¡£
ADDRESS£ºSQLÓï¾äÔÚSGAÖеĵØÖ·¡£
ÕâÁ½Áб»ÓÃÓÚ¼ø±ðSQLÓï¾ä£¬ÓÐʱ£¬Á½Ìõ²»Í¬µÄÓï¾ä¿ÉÄÜhashÖµÏàͬ¡£Õâʱºò£¬±ØÐëÁ¬Í¬ADDRESSÒ ......
°´ÕÕOracleDocumentÖеÄÃèÊö£¬v$sysstat´æ´¢×ÔÊý¾Ý¿âʵÀýÔËÐÐÄÇ¿ÌÆð¾Í¿ªÊ¼ÀÛ¼ÆȫʵÀý(instance-wide)µÄ×ÊԴʹÓÃÇé¿ö¡£
ÀàËÆÓÚv$sesstat£¬¸ÃÊÓͼ´æ´¢ÏÂÁеÄͳ¼ÆÐÅÏ¢£º
1>.ʼþ·¢Éú´ÎÊýµÄͳ¼Æ(È磺user commits)
2>.Êý¾Ý²úÉú£¬´æÈ¡»òÕß²Ù×÷µÄtotalÁÐ(È磺redo size)
3>.Èç¹ûTIMED_STATISTICSֵΪtrue,Ôòͳ¼Æ»¨·Ñ ......