Database growth report by full back file and send by email in graph and or html

  • 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.

  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • Hi,

    is your database e-mail activated?

    If yes, you only need 2 steps.

    1. select your autogrowth events
    2. mail the result of the query

      (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

  • Tac11 wrote:

    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


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • Thank you!

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply