Which files are the biggest on your SQL instance

Following script will list all files under all your databases on the current instance with biggest on the top. Lists both data and log files and also relevant db info to allow to make a informed decision about any issues.

 

select db.name DBName, db.recovery_model_desc recov_mod, mf.is_percent_growth [%grow], mf.growth ,
mf.name [File],(mf.size/1024)/1024 Size_in_GB, mf.type_desc Type,mf.physical_name Path
from sys.master_files mf , sys.databases db
where mf.database_id = db.database_id
order by size desc

 

Advertisements
About

IT professional with wider interest in technology

Tagged with: ,
Posted in sql, tsql

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: