This script will check the Log file size. If free file space is less than 20% that mean byond threshold and qualifies for the alert. It sends E-mail by combining all these alerts (example mentioned in o/p) then it will wait For 10 Minutes. After 10 minutes it will take backup first the shrink the log file without manual intervention.
Alert serial number, Server Name, Database Name, %Free File Space - Free log file space. It will send an email, if scheduled then it is monitoring as well as log file size auto handling technique.
SQL Server SSMS - SQL Server Management Studio
Set SSMS E-Mail Profile
Alert - Serial number
Server Name - Machine Name
Database Name - Database Name of which log file belong
Free Space (%) - Free Space of the log file in Ratio (%)
Create profile and script in SSMS then schedule it as per requirement.
@profile_name = 'LogFileSizeAlert', -- Replace with your SQL Database Mail Profile
@body = @body,
@body_format ='HTML',
@recipients = '[email protected]', -- Replace with your email address
@subject = 'Log File Beyond Threshold' ;
Copyright 2020 Harsh & Sahista
[Harsh Parecha] (https://github.com/TheLastJediCoder)
[Sahista Patel] (https://github.com/Sahista-Patel)
We love contributions, please comment to contribute!
Contributors have adopted the Covenant as its Code of Conduct.. Please understand copyright and what actions will not be abided.