Search This Blog

Friday, 24 February 2012

Database files

If you're short of space on your SQL Server hard disk then it's useful to know which database are eating this space.  This SQL will show the physical filenames of the database, their filename and their physical size on the disc:

use master
select d.name, f.filename, f.size 
from sysaltfiles f 
inner join sysdatabases d
on (f.dbid = d.dbid)
where d.name not in ('master','model','msdb','tempdb')
order by 3 desc,1,2

No comments:

Post a Comment