Automations

Search All Database Files And Paths

Search through all the Data files to find a specific data file path.

Here’s a quick script to search through ALL the database files, and paths to find a specific file.

use master;
select
'database' = db_name(database_id)
, [file_id]
, 'name' = name
, 'path' = physical_name
from
sys.master_files
where
db_name(database_id) not in ('master', 'msdb', 'model', 'tempdb') 
and physical_name like '%MyWildCard%'
order by
db_name(database_id), [file_id], name, physical_name
Advertisements

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