카테고리 없음

lock 의 이해

보미아빠 2013. 3. 4. 23:38

http://support.microsoft.com/kb/224453

 

 

begin tran a1111

이라고 적고 시작하면 나중에 로그 깔때 편함~

 


--tran의 최초 시작자 짐작
select transaction_id, *  from sys.dm_tran_active_transactions where transaction_type <> 2
--1593679

--정보확인
--select * from sys.dm_tran_locks where request_owner_id = 1593679

--로그레코드 확인
select database_transaction_begin_lsn, * from sys.dm_tran_database_transactions where transaction_id = 1593679
729000000293200001

729 0000002932 00001 =10진수
8char 8char 4char 로 변환 binary
'000002D9:00000B74:0001'

729 0000002944 00007
000002D9:00000b80:0007

729 0000002944 00011
000002D9:00000b80:000b
rowlog contents 0 = 이전값
rowlog contents 1 = 이후값

0x0101000C0000782E501500000102000402030004
0x3000140001000000E10CF400EA9D00002A000000050000020028003700446F6E2774205061

select top 10 * from fn_dblog(null, null) where [Current LSN] >= '000002D9:00000B74:0001'
description 에 transaction 이름 나옴 a1111;0x010500000000000515000000c64261d7fedf1e8e80857abae8030000

 

select * from sys.dm_tran_database_transactions where transaction_id =
1580558

database_transaction_begin_lsn

729000000293200001

2d9:00000B74:0001

729
0000002932
00001

select * from dbo.dm_tran_session_transactions_20130305_064712

 

So 0000009d:0000021e:0001 becomes '157' + '0000000542' + '00001' = '157000000054200001'.

select top 10 * from fn_dblog(null, null) where [Current LSN] >= '000002D9:00000B74:0001'
0x0101000C0000782E501500000102000402030004