Orphaned Datafiles ?

Occasionally, in my hunt for space I find a datafile with a name unrelated to the current installed databases. This query lists datafiles and the database’s they belong to …

select db_name(database_id) dbname, physical_name
from master.sys.master_files
where physical_name like 'N%' -- on the n-drive
order by physical_name;

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 )

Connecting to %s