History of the size of the database files

  • Comments posted to this topic are about the item History of the size of the database files

  • Thanks for the script.

  • Msg 195, Level 15, State 10, Procedure SaveHistoryDBfileSize, Line 83 [Batch Start Line 2]

    'CAHAR' is not a recognized built-in function name.

  • When I run the script under SQL Server 2012 Standard Edition, I get the following errors:

    Error message: Incorrect syntax near '/'.

    Error number = 102

    Error Procedure: '---

    Error Line = 12

    Please advise. (Note that I changed the TEST database to the MASTER database and I am running with SA privileges).

  • martindnovak - Friday, April 21, 2017 6:14 AM

    When I run the script under SQL Server 2012 Standard Edition, I get the following errors:

    Error message: Incorrect syntax near '/'.

    Error number = 102

    Error Procedure: '---

    Error Line = 12

    Please advise. (Note that I changed the TEST database to the MASTER database and I am running with SA privileges).

    Hi!
    I think that the reason is not in SQL2012, but in that my procedure uses CLR function drive_info.
    This CLR needs to be pre-installed for your database.
    In the description of my procedure (SaveHistoryDBfileSize), I did not explain the process of creating the CLR function.
    I just noted the link (https://www.mssqltips.com/sqlservertip/1986/sqlclr-function-to-return-free-space-for-all-drives-on-a-server/) on a good article that I used himself.
    Do not use the master database for the experiments. It is better to create your own base.

  • There is also a missing bracket in this line;

    CAST(mf. AS DECIMAL(38, 0)/128. AS [FileSizeMB]

    It should be;

    CAST(mf. AS DECIMAL(38, 0))/128. AS [FileSizeMB]

    And yes you need to create the CLR procedure as well.

    Rodders...

  • I now have a new error:

    Msg 102, Level 15, State 1, Procedure SaveHistoryDBfileSize, Line 1
    Incorrect syntax near 'SaveHistoryDBfileSize'.

  • rodjkidd - Friday, April 21, 2017 7:13 AM

    There is also a missing bracket in this line;

    CAST(mf. AS DECIMAL(38, 0)/128. AS [FileSizeMB]

    It should be;

    CAST(mf. AS DECIMAL(38, 0))/128. AS [FileSizeMB]

    And yes you need to create the CLR procedure as well.

    Rodders...

    Tanks, Rodders!

  • oops, missed the part about the CLR procedure. I will look into that.

    Thanks.

Viewing 9 posts - 1 through 8 (of 8 total)

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