How do I find the data directory for a SQL Server instance?

后端 未结 15 2584
挽巷
挽巷 2020-11-30 23:16

We have a few huge databases (20GB+) which mostly contain static lookup data. Because our application executes joins against tables in these databases, they have t

15条回答
  •  挽巷
    挽巷 (楼主)
    2020-11-30 23:59

    SELECT DISTINCT dbo.GetDirectoryPath(filename) AS InstanceDataPaths
    FROM sys.sysaltfiles WHERE filename like '%.mdf' and filename not like '%\MSSQL\Binn\%'
    
    SELECT DISTINCT dbo.GetDirectoryPath(filename) AS InstanceLogPaths
    FROM sys.sysaltfiles WHERE filename like '%.ldf' and filename not like '%\MSSQL\Binn\%'
    

    You can download detail SQL script from how to find the data directory for a SQL Server instance

提交回复
热议问题