Capture Backup and Restore operations

  • Hi,

    I want to create a trigger that fires (logs data into a table named backups inside a database named audit every time someone makes a backup to one of the user databases.

    I would like to do the same for restore (log the restore into a table named restore inside my user database named audit).

    Where can I put this triggers? Inside Master database? In which tables?

    Thank you

  • You don't really have to bother. This is already in the msdb database. Have a look at the backupset and restorehistory tables there.

  • AND the SQL Server logs unless you've instantiated the trace flag that turns off reporting of successful backups.

    --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)

Viewing 3 posts - 1 through 2 (of 2 total)

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