SQL Server2005 ÊÂÎñ¸ôÀë¼¶±ð
ÈκÎÊÂÎñÎÞÂÛÆä¸ôÀë¼¶±ðÈçºÎ£¬¶¼¾ßÓÐÔ×ÓÐÔ¡£Ô×ÓÐԺ͸ôÀë¼¶±ðÊÇÁ½ÂëÊ¡£
¼Ù¶¨Ö»ÓÐÒ»ÖÖ×ÊÔ´Êý¾Ý±íÉϵēÐГ¿ÉÒÔ±»Ëø¶¨¡£ËøÖ»Óй²ÏíËøºÍÅÅËûËøÁ½ÖÖ¡£
ËøµÄ¼æÈÝÐÔ£º
SX
S 10
X 00
ÊÂÎñµÄ¸ôÀë¼¶±ð£º
Read Uncommitted
Êý¾Ý¶Áȡʱ²»ÐèÒªËø¶¨
Read Committed
Êý¾Ý¶ÁȡʱÐèÒª¹²ÏíËø¶¨
Repeatable Read
Êý¾Ý¶ÁȡʱÐèÒªÅÅËûËø
Serializable
ÊÂÎñ±ØÐëµÈͬÓÚ´®ÐÐÖ´ÐÐ
×¢ÒâÎÞÂÛÈκÎʱºò¸üÐÂÐж¼±ØÐëÒªÓÐÅÅËûËø¡£
²åÈëÐв»ÐèÒªËø¡£
ÔÚRead Committed¸ôÀë¼¶±ðÏ£¬Êý¾Ý¶ÁÈ¡Íê±ÏºóÁ¢¼´ÊͷʲÏíËø£¬¶øÔÚRepeatable Read¸ôÀë¼¶±ðÏ£¬ÊÂÎñ±£³Ö¹²Ïí
ËøÖ±µ½Õû¸öÊÂÎñ½áÊø¡£
ÔÚSQL ServerÖе÷ÕûÊÂÎñ¸ôÀë¼¶±ðÊÇÕë¶Ô»á»°µÄ£¬set tran isolation levelºó£¬»á»°ÖкóÀ´¿ªÊ¼µÄÊÂÎñ¶¼Ôڴ˸ô
Àë¼¶±ðÉÏÖ´ÐС£Ò»¸öÊÂÎñÖ»ÄܾßÓÐÒ»¸ö¸ôÀë¼¶±ð¡£Í¬Ò»»á»°ÖеÄËùÓÐÊÂÎñ±ØÐë´®ÐÐÖ´ÐС£±ØÐëͨ¹ýbegin tranÓï¾äÀ´¸²¸ÇĬÈÏÊÂÎñ·¶Î§¡£
²âÊÔ£º
/*»·¾³*/
CREATE TABLE [dbo].[TranTest](
[Id] [int] IDENTITY(1,1) NOT NULL,
[count1] [int] NULL,
[count2] [int] NULL
)
insert into TranTest values(1,2)
insert into TranTest values(3,4)
insert into TranTest values(5,6)
insert into TranTest values(7,8)
Ô¼¶¨×ÜÊÇÏÈÖ´ÐÐsession1£¬²¢ÇÒÔÚsession1½áÊøÇ°Ö´ÐÐsession2
1. ÅÅËûËø×ÜÊÇÔÚÊÂÎñ½áÊøÊ±ÊÍ·Å
--session 1
set tran isolation level any
begin tran
update TranTest set count1=count1 + 10 where id=1
waitfor delay '00:00:10'
commit tran
--session 2
select * from TranTest
ÏÖÏó£ºsession2±»×èÈûÖ±µ½session1ÖеĻỰ½áÊø¡£
½âÊÍ£ºsession1Ê×ÏÈÖ´ÐУ¬¸üÐÂid=1µÄÐÐʱ³ÖÓÐÁ˸ÃÐеÄÅÅËûËø£¬¸ÃËøÖ±µ½session1ÖеÄÊÂÎñ½áÊøÊ±ÊÍ·Å£¬Õâ×èÖ¹
ÁËsession2»ñµÃ¹²ÏíËø¡£
2. ¶ÁδÌá½»ÎÞÐèÈκÎËø
--session 1
set tran isolation level any
begin tran
update TranTest set count1=count1 + 10 where id=1
waitfor delay '00:00:10'
commit tran
--session 2
set tran isolation level read uncommitted
begin tran
select * from TranTest
commit tran
ÏÖÏó£ºsession2δ±»×èÈû£¬¶øÊǶÁÈ¡µ½ÁËsession1ÉÐδÌá½»µÄÊý¾Ý¡£
½âÊÍ£º¶ÁδÌá½»ÎÞÐèËø¶¨£¬Òò¶øÈÆ¿ªÁËËø¶¨»úÖÆ¡£
3. ËÀËø
--session 1
set tran isolation level read committed
begin tr
Ïà¹ØÎĵµ£º
Using Oracle Trace Analyzer (trcanlzr.sql)
Dave Moore: Author of Oracle Utilities
Oracle has provided another utility initially designed for performance tuning Oracle Applications. Trace Analyzer is provided in the form of a PL/SQL package (TRCA$ ). The Trace Analyzer utility i ......
select * from tableName where datediff(week,dateField,getdate())=0
ÕâÑù²é³öÀ´µÄ½á¹ûÊÇ´ÓÐÇÆÚÌìµ½ÐÇÆÚÁù(ÀÏÍâĬÈÏÐÇÆÚÌìÊÇÒ»ÖܵĵÚÒ»Ìì).
Èç¹ûÏëÒÔÐÇÆÚÒ»×÷ΪµÚÒ»ÌìµÄ»°,Á½¸öʱ¼ä¶¼ÐèÒª¼õÒ»,ÈçÏÂ:
select * from tableName where datediff(week,dateField-1,getdate()-1)=0 ......
--> Title : SQL ServerÊÓͼÖг£見ÏÞÖÆÌõ¼þ
--> Author : wufeng4552
--> Date : 2010-03-01
(1): ÊÓͼÊý¾Ý¸ü¸ÄµÄ³£見ÏÞ¶¨
µ±Óû§¸üÐÂÊÓͼÖеÄÊý¾Ýʱ,Æäʵ¸ü¸ÄµÄÊÇÆä¶ÔÓ¦µÄÊý¾Ý±íµÄÊý¾Ý.ÎÞÂÛÊǶÔÊÓͼÖеÄÊý¾Ý½øÐиü¸Ä,»¹ÊÇÔÚÊÓͼÖвåÈë»òÕßɾ³ýÊý¾Ý,¶¼ÊÇÀàËÆµÄµÀÀí.µ«ÊÇ,² ......
ÄÚÈÝת×Ô£ºhttp://blog.csdn.net/lfzwenzhu/archive/2008/03/06/2153473.aspx
SELECT CONVERT(varchar(100), GETDATE(), 0): 05 16 2006 10:57AM
SELECT CONVERT(varchar(100), GETDATE(), 1): 05/16/06
SELECT CONVERT(varchar(100), GETDATE(), 2): 06.05.16
SELECT CONVERT(varchar(100), GETDATE(), 3): 16/05/06
......
Çå¿ÕÈÕÖ¾
1£®´ò¿ª²éѯ·ÖÎöÆ÷£¬ÊäÈëÃüÁî
DUMP TRANSACTION Êý¾Ý¿âÃû WITH NO_LOG
2.ÔÙ´ò¿ªÆóÒµ¹ÜÀíÆ÷--ÓÒ¼üÄãҪѹËõµÄÊý¾Ý¿â--ËùÓÐÈÎÎñ--ÊÕËõÊý¾Ý¿â--ÊÕËõÎļþ--Ñ¡ÔñÈÕÖ¾Îļþ--ÔÚÊÕËõ·½Ê½ÀïÑ¡ÔñÊÕËõÖÁXXM,ÕâÀï»á¸ø³öÒ»¸öÔÊÐíÊÕËõµ½µÄ×îСMÊý,Ö±½ÓÊäÈëÕâ¸öÊý,È·¶¨¾Í¿ÉÒÔÁË¡£
......