I have some book keeping tasks (reset high water marks, clear some staged data) that need to be done after each restore of a QA database. I know that I can create triggers on databases in SQL but I do not seem to be able to find a way to do it on a database restore.
Since I work on a team of people with shared ownership of the database, I cannot always know when a restore occurs. Is there a way to automate this either with a trigger or some other database magic so that the cleanup procedure will always be called?
RESTORE没有DDL触发器,但是有AUDIT_BACKUP_RESTORE_EVENT
事件的事件通知 ,它将为您提供所需的位置。
http://www.eggheadcafe.com/conversation.aspx?messageid=33217985&threadid=33217985 http://msdn.microsoft.com/en-us/library/bb522542.aspx http://msdn.microsoft.com/en-us/library/ms189871.aspx
Doesn't appear possible. What about scripting the restore and including the maintenance procs at the end of the script?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.