Situatie
Mai jos este o procedura ce listeaza bazele de date de pe un server de sql si pentru fiecare fisier al diferitelor baze de date, afiseaza setarile de crestere acesteia, precum si locatia acestor fisiere.
Solutie
CREATE PROCEDURE DatabasesSizeAndGrowthSettings_prc
as
select
b.name DBName,
a.name LogicalName,
a.filename File_Name,
cast((a.size * 8.00) / 1024 as numeric(12,2)) as SizeInMB,
case when a.growth > 100 then ‘In MB’ else ‘In Percentage’ end FileGrowth,
case when ( maxsize = -1 or maxsize=268435456 ) then ‘AutoGrowth Not Restricted’ else ‘AutoGrowth Restricted’ end AutoGrowthStatus
from sysaltfiles a
join sysdatabases b on a.dbid = b.dbid
where DATABASEPROPERTYEX(b.name, ‘status’) = ‘ONLINE’
order by 1
Leave A Comment?