File Group Alert in Microsoft SQL Server

Hi,

We ahave created multiple file groups in SQL Server 2008 R2 with initial size 10 GB.
Now i want to create an alert on file groups like, if available space less than 20% it should trigger an alert (some sql job kind of alert)
so that immidiately i will allocate more free space to that file group.
VijayAsked:
Who is Participating?
 
Pawan KumarDatabase ExpertCommented:
>>We ahave created multiple file groups in SQL Server 2008 R2 with initial size 10 GB.
Not sure about file groups but for files we can set an alert.

Please read this from Microsoft. Please let us know if you need any modifications.
IF EXISTS
(
SELECT instance_name AS DatabaseName, 
       [Data File(s) Size (KB)], 
       [LOG File(s) Size (KB)], 
       [Log File(s) Used Size (KB)], 
       [Percent Log Used] 
FROM 
( 
   SELECT * 
   FROM sys.dm_os_performance_counters 
   WHERE counter_name IN 
   ( 
       'Data File(s) Size (KB)', 
       'Log File(s) Size (KB)', 
       'Log File(s) Used Size (KB)', 
       'Percent Log Used' 
   ) 
     AND instance_name not in ('_Total','mssqlsystemresource')
) AS Src 
PIVOT 
( 
   MAX(cntr_value) 
   FOR counter_name IN 
   ( 
       [Data File(s) Size (KB)], 
       [LOG File(s) Size (KB)], 
       [Log File(s) Used Size (KB)], 
       [Percent Log Used] 
   ) 
) AS pvt WHERE [LOG File(s) Size (KB)] >1000
)
BEGIN 

EXEC msdb.dbo.sp_send_dbmail 
     @profile_name = 'Administrator', 
     @recipients = 'mmmm@mail.com',
     @subject = @Subject,
     @body=@body

END

Open in new window


From - https://social.msdn.microsoft.com/Forums/sqlserver/en-US/706359ab-d7e7-4ad0-a125-2691472986e4/how-to-create-an-alert-which-notifies-me-if-my-logspace-reaches-a-threshold-percentage?forum=sqlsetupandupgrade
0
 
VijayAuthor Commented:
Good information.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.