Amount of file space actually used

  • When I select a database then Reports, Disk Useage I can see the size of the database and the transaction log. When I select Disk space used by data files, I can see how much of the size is actually being used by the database. Where can I find this information for the transaction log?

    I will need to do this on several servers so if it means a script I need to apply it to more than one server. Can anyone point me in the right direction? Thanks

    Madame Artois

  • check out sys.database_files.

    "Keep Trying"

  • I'm probably being a bit thick here but sys.database_files seems to only tell me about master.db and not my databases. I've looked in BOL but can't seem to find the key element; I'm one of those people that struggle with BOL.

    What am I doing wrong?

    Madame Artois

  • Here is the query that I'm using. I found it once on one of the SQL Server forums, but I don't remember where.

    SELECT name AS 'File Name' , physical_name AS 'Physical Name', size/128 AS 'Total Size in MB',

    size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Available Space In MB', *

    FROM sys.database_files

    Adi

    --------------------------------------------------------------
    To know how to ask questions and increase the chances of getting asnwers:
    http://www.sqlservercentral.com/articles/Best+Practices/61537/

    For better answers on performance questions, click on the following...
    http://www.sqlservercentral.com/articles/SQLServerCentral/66909/

  • Hi

    Try this:

    DBCC SQLPERF ( LOGSPACE )

    Greets

    Flo

  • Fabulous!! I'm on a bit of a learning curve here so thanks for your help

    Madame Artois

  • You're welcome!

    🙂

Viewing 7 posts - 1 through 7 (of 7 total)

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