How do I know where .MDF / .LDF files are located?

  • I went to DB Properties in SQL 2005 Management Studio

    but it does'n show the location

    of .MDF / .LDF files.

    How to find out where they are located?

    Thanks,

    Robert

  • When you pull up the properties, click on the Files page. You will see where your .mdf and .ldf files are located there.

    😎

  • Additionally you can also run either query below:

    EXEC sp_helpdb @dbname --Where @dbname is sysname or varchar

    SELECT * FROM sys.sysfiles --Will return info for the current database

    - Tim Ford, SQL Server MVPhttp://www.sqlcruise.comhttp://www.thesqlagentman.com http://www.linkedin.com/in/timothyford

  • You can know the location of the database files as well as their size, which is needed for monitoring, using the following script -

    USE master

    GO

    SELECT B.[Name] AS [Database Name (Logical)],

    A.[Name] AS [Physical Name],

    A.[filename] AS [File Path],

    A. AS [File Size]

    FROM sysaltfiles A

    INNER JOIN sys.databases B

    ON A.DBID=B.Database_ID

    --WHERE B.[Name]='PRACTICE'

    GO

    Note: You can specify the specific database name to find the exact details. the above script will give you the details for all the databases available on the SQL Server instance.

    Chandrachurh Ghosh
    DBA – MS SQL Server
    Ericsson India Global Services Limited
    Quality is not an act, it is a habit.

  • sysaltfiles.filesize

    Is it in KB or MB ?

  • riga1966 (4/18/2008)


    sysaltfiles.filesize

    Is it in KB or MB ?

    From BOL: File size, in 8-kilobyte (KB) pages

    😎

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply