Situatie
Mai jos este o procedura ce returneaza spatiul liber de pe disk-urile serverului Microsoft SQL pe care este rulata.
Solutie
alter procedure DatabaseServerFreeSpace
as
SELECT
DISTINCT
vs.volume_mount_point AS DriveName,
vs.total_bytes/1024/1024/1024 AS DriveTotalSpace,
vs.available_bytes/1024/1024/1024 AS DriveFreeSpace
into #temp_disc_space
FROM sys.master_files AS f
CROSS APPLY sys.dm_os_volume_stats(f.database_id, f.file_id) AS vs
select DriveName,(DriveFreeSpace * 100)/DriveTotalSpace as ProcFreeSpace
into #temp_space_monitor
from #temp_disc_space
select * from #temp_space_monitor
order by DriveName
drop table #temp_disc_space, #temp_space_monitor
Leave A Comment?