Sql-server – SQL DB After Restore Script execution

restoresql server

I have a SQL Database that is being restored every day from a Production SQL server.

The restore is being done by a third party application. Once the DB is restored I need to set some specific user permissions and also run other script and I would like to do that exactly after the restore process has been complete.

Is there a way I can execute a script after a DB has been restored?

Thanks

Best Answer

Looks like one cannot set up trigger on RESTORE DATABASE event

I can think of

  1. Set up a regular SQL job to check/add permissions if needed
  2. As this link, add a TRIGGER on [msdb].[dbo].[restorehistory]?