July 4, 2024 at 11:05 pm
Hello Gurus,
How I am in need of all databases growth in 10 instance and send the report by an email. What's the best way to accomplish such task. If anyone has scripts or point me to a website that would be very helpful.
thanks in advance.
July 5, 2024 at 11:10 pm
Thanks for posting your issue and hopefully someone will answer soon.
This is an automated bump to increase visibility of your question.
July 9, 2024 at 9:10 am
Hi,
is your database e-mail activated?
If yes, you only need 2 steps.
(I found this code in the internet, it's not build on my own)
DECLARE @current_tracefilename VARCHAR(500);
DECLARE @0_tracefilename VARCHAR(500);
DECLARE @indx INT;
SELECT @current_tracefilename = path
FROM sys.traces
WHERE is_default = 1;
SET @current_tracefilename = REVERSE(@current_tracefilename);
SELECT @indx = PATINDEX('%\%', @current_tracefilename);
SET @current_tracefilename = REVERSE(@current_tracefilename);
SET @0_tracefilename = LEFT(@current_tracefilename, LEN(@current_tracefilename) - @indx) + '\log.trc';
SELECT DatabaseName,
te.name,
Filename,
CONVERT(DECIMAL(10, 3), Duration / 1000000e0) AS TimeTakenSeconds,
StartTime,
EndTime,
(IntegerData * 8.0 / 1024) AS 'ChangeInSize MB',
ApplicationName,
HostName,
LoginName
FROM ::fn_trace_gettable(@0_tracefilename, DEFAULT) t
INNER JOIN sys.trace_events AS te ON t.EventClass = te.trace_event_id
WHERE(trace_event_id >= 92
AND trace_event_id <= 95)
ORDER BY t.StartTime;
2)
USE msdb
GO
EXEC sp_send_dbmail @profile_name='yourprofilename',
@recipients='test@Example.com',
@subject='Test message',
@body='This is the body of the test message.
Congrates Database Mail Received By you Successfully.'
Just take a look at the e-mail function, it is quite simple to send the result of a query.
Good luck,
Andreas
July 10, 2024 at 6:03 am
Hello Gurus,
How I am in need of all databases growth in 10 instance and send the report by an email. What's the best way to accomplish such task. If anyone has scripts or point me to a website that would be very helpful.
thanks in advance.
You said it in the title... lookup the backup related tables in MSDB and write a report from that. It'll also help you in your career because you'll then know more about MSDB and the tables that are in it not to mention a whole lot more about backups and backup history.
If you mean that you want an "ALERT" when the MDF or LDF or NDF files grow, that's a different story.
--Jeff Moden
Change is inevitable... Change for the better is not.
July 20, 2024 at 2:54 pm
Thank you!
Viewing 5 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply