|
I need a script for sending mails to all DBA's if any db reaches to 90%... Could you please suggest any script for it...
(comments are locked)
|
|
You need to investigate Alerts and Operators. For example you could alert on a given data size, if your databases are fixed size and not set to auto-grow. If there is no alert suitable for your scenario, then maybe have a scheduled job that runs periodically and fires an email to your defined Operators, using
(comments are locked)
|
|
Not sure you relate the DB Size to Data Files Size With/Without including Log files? Anyways, how about the following script to know the Data/Log files sizes and the space remining. You can use a CURSOR / LOOP to get all the databases information Moreover, you can filter out some output using type column as used in the WHERE clause to return information about the DATA and Log files. Hope it helps. If you are willing to use an undocumented procedure, sp_msforeachdb tends to be faster and use shorter code than a cursor for something like this.
Jul 19 '12 at 03:27 PM
TimothyAWiseman
I'd just add that sp_msforeachdb has been shown to be unreliable http://sqlblog.com/blogs/aaron_bertrand/archive/2010/12/29/a-more-reliable-and-more-flexible-sp-msforeachdb.aspx, and as it's undocumented, well its tough!
Jul 19 '12 at 03:32 PM
Kev Riley ♦♦
Nice. As an aside, this is what I was hoping the SQL Server Utility Control Point would show on the database storage bar graphs. Instead they show the percentage of total available space on the drive. So my 1TB database shows 90% and all the rest show 0%--worthless
Jul 21 '12 at 12:47 AM
Scot Hauder
(comments are locked)
|
|
Kev probably has the best answer with the alerts and operators, but I would add that specialized Monitoring tools like SQL Monitor will handle this very simply s well as many other monitoring tasks. +1: definitely - Monitoring tools make this stuff so easy
Jul 19 '12 at 03:32 PM
Kev Riley ♦♦
(comments are locked)
|


Great kev need two columns table with databse name and status how much % it would be filled?
Any script do we have will schedule it by job...
Thanks Usman