A different kind of problem popped up when I was working in SQL Server. Suddenly all processes were slow. The reason was there was not enough space in C drive where SQL server is installed. So I needed to know which databases are saved in C Drive and need to move them in to different drive. So I needed a query to check all databases and their saved locations. I found below script
SELECT
'DB_NAME' = db.name,
'FILE_NAME' = mf.name,
'FILE_TYPE' = mf.type_desc,
'FILE_PATH' = mf.physical_name
FROM
sys.databases db
INNER JOIN sys.master_files mf
ON db.database_id = mf.database_id
'DB_NAME' = db.name,
'FILE_NAME' = mf.name,
'FILE_TYPE' = mf.type_desc,
'FILE_PATH' = mf.physical_name
FROM
sys.databases db
INNER JOIN sys.master_files mf
ON db.database_id = mf.database_id
No comments:
Post a Comment