SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
SQL SERVER 2008 ¸ü¸Ä¸ú×Ù
/*
¿´Ê飬¿´Áª»úÆڼ䡣¡£¡£Ë³´ø°Ñ¿´µ½µÄдÏÂ
ÓëSQL SERVER 2008 CDC Òì²½²¶»ñÊý¾Ý±ä¸üµÄ²»Í¬,¸ü¸Ä¸ú×ÙÊÇͬ²½½ø³Ì,
ÊÇDML(INSERT/UPDATE/DELETE)ÊÂÎñµÄÒ»²¿·Ö,Ëü¿ÉÒÔʹÓÃ×îСµÄCÅÌ´æ´¢
¿ªÏúÀ´Õì²âÊý¾ÝÐеľ»±ä¸ü.ÄÇôËüÒ²¾Í²»ÄÜÏñCDCÄÇÑù¿ÉÒÔÌṩÓû§±íµÄ
ÀúÊ·¸ü¸ÄÐÅÏ¢. ¸ü¸ÄÊÇʹÓÃÒì²½½ø³Ì²¶»ñµÄ,´Ë½ø³Ì¶ÁÈ¡ÊÂÎñÈÕÖ¾,²¢
ÇÒ¶ÔϵͳÔì³ÉµÄÓ°ÏìºÜС.
¸ü¸Ä¸ú×Ù²¶»ñ¸ü¸ÄÁ˱íÐÐÕâÒ»ÊÂʵ,µ«²»»á²¶»ñ¸ü¸ÄµÄÊý¾Ý.ÕâÑù,Ó¦ÓóÌ
Ðò¾Í¿ÉÒÔÈ·¶¨Ê¹ÓôÓÓû§±íÖÐÖ±½Ó»ñÈ¡µÄ×îÐÂÐÐÊý¾Ý¸ü¸ÄµÄÐÐ.Òò´Ë,Óë±ä
¸üÊý¾Ý²¶»ñÏà±È,¸ü¸Ä¸ú×Ù¿ÉÒÔ½â´ðµÄÀúÊ·ÎÊÌâ±È½ÏÓÐÏÞ.µ«ÊÇ,¶ÔÓÚ²»Ðè
ÒªÀúÊ·ÐÅÏ¢µÄÄÇЩӦÓóÌÐò,¸ü¸Ä¸ú×Ù²úÉúµÄ´æ´¢¿ªÏúҪСµÃ¶à,ÒòΪËü²»
ÐèÒª²¶»ñ¸ü¸ÄµÄÊý¾Ý(²»ÐèÒª´¥·¢Æ÷ºÍ±íʱ¼ä´Á).ËüʹÓÃͬ²½¸ú×Ù»úÖÆÀ´
¸ú×Ù¸ü¸Ä.´Ë¹¦ÄÜÖ¼ÔÚ×î´óÏ޶ȵؼõÉÙDML ²Ù×÷¿ªÏú.
×ܵÄÀ´ËµÓÐÒÔϼ¸µã:
1 ¼õÉÙÁË¿ª·¢Ê±¼ä: ÓÉÓÚSQL Server 2008 ÖÐÌṩÁ˸ü¸Ä¸ú×Ù¹¦ÄÜ,Òò´ËÎÞÐ迪·¢×Ô¶¨Òå½â¾ö·½°¸.
2 ²»ÐèÒª¼Ü¹¹¸ü¸Ä: ʹÓøü¸Ä¸ú×Ù²»ÐèÒªÖ´ÐÐÒÔÏÂÈÎÎñ£ºÌí¼ÓÁÐ;Ìí¼Ó´¥·¢Æ÷;Èç¹ûÎÞ·¨½«ÁÐÌí¼Óµ½ÓÃ
»§±í,ÔòÐèÒª´´½¨ÒªÔÚÆäÖиú×ÙÒÑɾ³ýµÄÐлò´æ´¢¸ü¸Ä¸ú×ÙÐÅÏ¢µÄ¶Ë±í.
3 ÄÚÖÃÇå³ý»úÖÆ: ¸ü¸Ä¸ú×ÙµÄÇå³ý²Ù×÷ÔÚºǫ́×Ô¶¯Ö´ÐÐ.²»ÐèÒª¶Ë±íÖд洢µÄÊý¾ÝµÄ×Ô¶¨ÒåÇå³ý.
4 Ìṩ¸ü¸Ä¸ú×Ù¹¦ÄܵÄÄ¿µÄÊÇ»ñÈ¡¸ü¸ÄÐÅÏ¢: ʹÓøü¸Ä¸ú×Ù¹¦ÄÜ¿ÉʹÐÅÏ¢²éѯºÍʹÓøü·½±ã.Áиú×Ù
¼Ç¼ÌṩÓë¸ü¸ÄµÄÊý¾ÝÏà¹ØµÄÏêϸÐÅÏ¢.
5 ½µµÍÁËDML ²Ù×÷µÄ¿ªÏú: ͬ²½¸ü¸Ä¸ú×ÙʼÖÕ»áÓÐһЩ¿ªÏú.µ«ÊÇ,ʹÓøü¸Ä¸ú×ÙÓÐÖúÓÚʹ¿ªÏú×îС
 
Ïà¹ØÎĵµ£º
1.ɾ³ý±í
select 'drop table ' || table_name || ' purge;'
from user_tables
where length(table_name) <= 4;
ɾ³ý´øÔ¼ÊøµÄ±í
Drop table ±íÃû cascade constraints;
2.²éѯview&ͬÒå´Ê
--˵Ã÷£º¿ÉÒÔ¸ù¾ÝÊÓͼµÄtext_length ......
1.Çó1..10żÊýÖ®ºÍ
select sum(level) from dual
where mod(level,2)=0
connect by level
2.½«update¸Ä»»³ÉÓÃrowidÀ´ÊµÏÖ¡£
£¨1£©ÐµÄд·¨£º
merge into SNAPSHOT120_2010_572 t1
using (select a.rowid rid, b.vip_level, b.manager_name
from xyf_vip_info_new b, snapsho ......
1. ³ÌÐòÈçÏ£º
string str = "Create Database " + "DBname";
string con = "Data Source=10.0.0.249\\sql2005;Initial Catalog=master;Persist Security Info=True;User ID=sa;Password=sa";
&n ......
º¯ÊýÒÀÀµ
==========================================
Ò»¡¢º¯ÊýÒÀÀµ¸ÅÄî
¡¡¡¡º¯ÊýÒÀÀµÊÇ´ÓÊýѧ½Ç¶ÈÀ´¶¨ÒåµÄ£¬ÔÚ¹ØϵÖÐÓÃÀ´¿Ì»¹Øϵ¸÷ÊôÐÔÖ®¼äÏ໥ÖÆÔ¼¶øÓÖÏ໥ÒÀÀµµÄÇé¿ö¡£º¯ÊýÒÀÀµÆÕ±é´æÔÚÓÚÏÖʵÉú»îÖУ¬±ÈÈ磬ÃèÊöÒ»¸öѧÉúµÄ¹Øϵ£¬¿ÉÒÔÓÐѧºÅ¡¢ÐÕÃû¡¢ËùÔÚϵµÈ¶à¸öÊôÐÔ£ ......