Fetching physical path details of all databases in an instance

Posted by Bandi under Sql Server category on | Points: 40 | Views : 679
USE SampleDatabase;
EXEC sp_helpfile;

returns physical paths of current database( SampleDatabase)...

What if the DBA needs to change/move physical data files of all databases to another location ?

In these cases and there are hundereds of databases in an instance, DBAs need to fetch physical storage paths for each database...

EXECUTE master.sys.sp_MSforeachdb  'USE [?]; EXEC sp_helpfile'  

master.sys.sp_MSforeachdb -- This undocumented SP is useful to loop through all databases...

Comments or Responses

Login to post response