HiveBrain v1.2.0
Get Started
← Back to all entries
snippetsqlMinor

How to monitor SQL Server data and log file growth?

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
filehowlogsqlandgrowthmonitorserverdata

Problem

I'm trying to find a way to monitor data and log file size from SQL Server databases (within an SQL Server instance). I would not want to use third party tools, but simply pure SQL or PowerShell. I know that one can query this data from sys.database_files or use DBCC SQLPERF(logspace) to get data from log file usage. Is there any way to automate this monitoring and get reports from this data? Any ideas and code samples are helpful!

Solution

If you want to use PowerShell you can easily create task scheduler jobs in Windows to run the PowerShell scripts which would dump the output into a table or log file.

If you want to use SQL you can easily create SQL Server Agent jobs to pull the data from the DMVs or DBCC and dump them in a table.

It is difficult to understand exactly what you would want any reports against the stored data to look like, or which part is challenging.

Context

StackExchange Database Administrators Q#13252, answer score: 3

Revisions (0)

No revisions yet.