Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Capture Backup and Restore operations Expand / Collapse
Author
Message
Posted Tuesday, January 21, 2014 7:34 AM
Right there with Babe

Right there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with BabeRight there with Babe

Group: General Forum Members
Last Login: Monday, April 07, 2014 10:25 AM
Points: 715, Visits: 1,018
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
Post #1533063
Posted Thursday, January 23, 2014 1:31 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Yesterday @ 12:44 PM
Points: 133, Visits: 250
You don't really have to bother. This is already in the msdb database. Have a look at the backupset and restorehistory tables there.
Post #1534247
Posted Thursday, January 23, 2014 2:15 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: Today @ 7:25 AM
Points: 35,959, Visits: 30,253
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." -- 04 August 2013
(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1534264
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse