1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
|
/*Requete permettant d'avoir accès aux informations utiles sur la volumétrie d'une base de données (Log/data) en Méga-Octets et en Giga-Octet*/
set nocount on
select
[Nom_Fichiers] =
isnull(a.name,(Select DB_NAME())),
[Type_Fichier] =
case when a.groupid is null then 'Database' when a.groupid = 0 then 'Log' else 'Data' end,
[Taille_Fichiers(Mo)] =
convert(numeric(10,2),sum(round(a.size/128.,2))),
[Espace-Utilisé(Mo)] =
convert(numeric(10,2),sum(round(fileproperty( a.name,'SpaceUsed')/128.,2))) ,
[Espace_Libre(Mo)] =
convert(numeric(10,2),sum(round((a.size-fileproperty( a.name,'SpaceUsed'))/128.,2))),
[Taille_Fichiers(Go)] =
convert(numeric(10,2),convert(numeric(10,2),sum(round(a.size/128.,2)))/1024),
[Espace_Utilisé(Go)] =
convert(numeric(10,2),convert(numeric(10,2),sum(round(fileproperty( a.name,'SpaceUsed')/128.,2)))/1024),
[Espace_Libre(Go)] =
convert(numeric(10,2),convert(numeric(10,2),sum(round((a.size-fileproperty(a.name,'SpaceUsed'))/128.,2)))/1024)
from
sysfiles a
group by
groupid,
a.name
with rollup
having
a.groupid is null or
a.name is not null
order by
case when a.groupid is null then 99 when a.groupid = 0 then 0 else 1 end,
a.groupid,
case when a.name is null then 99 else 0 end,
a.name |
Partager