Contents

[-]


디스크의 분산에서 이미 로그파일을 물리적인 다른 디스크에 위치시키라는 말을 언급했다. 로그는 데이터베이스가 읽기전용이 아닌 이상은 계속적으로 쓰이게 되는데 로그가 많이 발생하면 심한경우 로그가 깨져 데이터베이스가 ‘주의대상’으로 데이터베이스의 모드가 바뀌면서 접근하지 못하는 경우도 있다. 로그 병목이 일어나는지 확인하기 위해서 다음의 스크립트를 일정시간 돌리고 확인해야 한다.

DBCC sqlperf(waitstats,clear) -- wait statistics 클리어
drop table waitstats
create table waitstats (Wait_Type varchar(80), 
                           Requests numeric(18,1),
                           Wait_Time numeric (18,1),
                           Signal_Wait_Time numeric(18,1),
                           timenow datetime default getdate())
declare @start int, @finish int
select @start = 1, @finish = 10
while (@start < @finish)
begin
             Begin transaction
                     insert into waitstats (Wait_Type, Requests, 
                           Wait_Time,Signal_Wait_Time)
                           exec ('DBCC sqlperf(waitstats)')
             commit
 
             select @start = @start + 1
             waitfor delay '00:00:10'        -- 10초 간격으로 수행
End
 
--일정시간이 지난 후 확인
Select * FROM WAITSTATS order by wait_time desc