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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VijayAuthor Commented:
Good information.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SSMS

From novice to tech pro — start learning today.