-- 글제목 : 트랜잭션 백업직후 로그클리어 실패 확인하기
-- 작성자 : 차주언(narsas@naver.com)
-- 작성일 : 2009.12.03

-- 참고자료1 : 추가로 보면 좋은! 만철의 로그축소 테스트 <= 정리 넘 이쁘게 되있는거 아냐?

-- 참고자료2 : 아랫글(트랜잭션 열린넘 있으면 로그백업할때 사이즈가 커진다!!)

-- 참고자료3 : dbcc loginfo 보기힘들땐 이걸로

 

 

-- 트랜잭션 백업하면 DBCC LOGINFO의 status값이 2인게 Active인것 한개만 떠야합니다~(이상론)

 

                  declare @cnt int

                                  

                  set nocount on

                 

                  create table #loginfo (

                                                     fileid int , filesize decimal( 28 , 0 ) ,

                                                     startoffset decimal( 28 , 0 ) , fseqno decimal( 28 , 0 ) ,

                                                     status tinyint , parity tinyint , starttime datetime , createlsn varchar( 20 )

                  )

                  insert into #loginfo (

                                                     fileid , filesize , startoffset , fseqno ,

                                                     status , parity , starttime

                  )

                  exec( 'dbcc loginfo with tableresults' )

 

                  select @cnt = count(*)

                  from #loginfo as l

                  where status > 0

                  -- 요값이count 2보다크면...문제!! 터지기시작하는거!!

 

                  if @cnt > 2 -- 1로하고싶은데좀긴넘이우연히걸릴수도있다고보고..하나정도는

                  begin

                                   -- sms 보내기

                                   -- vlf 가잘리지않았습니다.

                                   print 'sms 보내기'

                  end

 





profile

차주언
MSSQL DBA ,  MCT/ MCDBA
SQL프런티어 /