물리적 스토리지 용량 체크하기 (exec master.dbo.xp_fixeddrives)

by kay posted May 23, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

EXEC master.dbo.xp_fixeddrives 프로시저를 실행해보면

물리 디스크의 잔여 용량을 확인할수 있습니다..


응용하여 메일링 및 SMS 발송을 통해 모니터링 , 통계가 가능합니다.


create table #driveInfo(drive varchar(1), [freesize(MB)] int, insertTime datetime default(getdate()))

BEGIN
	insert #driveInfo (drive, [freesize(MB)]) EXEC master.dbo.xp_fixeddrives
END

declare @size as float
declare @sizeGB as float
declare @sendSize as varchar(50)
 
select top 1 @size = [freesize(MB)] from #driveinfo where drive = 'D' order by insertTime desc

set @sizeGB = @size / 1024
set @sendSize = str(round(@sizeGB,2),5,2)

select @sendSize

if @size < 5120
	begin
		print '약 5기가미만으로 남았습니다.'
	end

drop table #driveInfo