usp_MonitorDataSize for datafiles but to Monitor LOG size?

  • Hi everyone

     

    I found a very good script in order to monito the data sizes for my databases but do you know if there is something to monitor LOG sizes? I am not talking about the SQL SERVER LOG, I am talking about the LDF file. I need to monitor them and in case it reachs 90% of its capacity then send an email or alert.

    I use usp_monitordatasize and it works great for datafiles but I need something for logs files.

    We had a big production problem 3 weeks ago because the log file reach it maximum and we didn't notice in advance. This cause a lot of users probelms.

    Any advice is welcome

    Thanks

     

    Carolina

     

  • You can always send the contents of DBCC SQLPERF(LOGSPACE) to a temp table and check that the Log Space Used % isn't above a threshold value.

    Create Table #TempTable ([Database Name] varchar(100), [Log Size (MB)] float, [Log Space Used (%)] float, Status int)
    Insert #TempTable exec ('DBCC SQLPERF(LOGSPACE)')
    select * from #TempTable where [Database Name] like '<your DB Name>' and [Log Space Used (%)] > 90
    <send an email or do something else>
    drop table #TempTable

    Obviously that's not the full thing but it does give an example of how to get the info that you want

  • Thanks. I will that rigth now.

Viewing 3 posts - 1 through 2 (of 2 total)

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