Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 EXECUTE TRIGGER ON DATABASE RESTORE SUCCEESSFULL

Author  Topic 

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 10:42:01
Can i execute a trigger which fires a procedure when data base restoration is successful . I am using SQL SERVER 2005 .Please give me knowledge on account of this .Thanks .

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-08-12 : 11:20:27
cant you do this as a maintenance task?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 14:29:56
I created a procedure which needs to be executed once Database restore is successful
Then i created a job which takes the proc and execute it ,
created a maintenance plan ,their i selected "Execute Sql Server Agent job " and selects my job item and finished .
It wont trigger when i restore that database ?is it ?
I needs to trigger this maintenance task when a database restoring is successful .



Software Engineer
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-08-12 : 14:31:51
Put the task in the same job/plan where the restore is being done.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 14:56:09
Restoring is done manually ..

Software Engineer
Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 14:56:59
I will explan what excatly is the issue .


Software Engineer
Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 14:58:12
We have testing database .We used to restore it from live for testing issues that happening in live DB .

Software Engineer
Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 15:07:41
Their are some tables contains mail id . Mails might automatically send when testing site .So we usually update the tables that holds client email id with our company email id .So that test mail reach us . After restoring the DB will again containt actual client mail ids . Database is restoring manually .Its not a scheduled job . we created a procedure which holds the update query of all tables that holds client id .If its run our issue is resolved . The only purpose to execute that proc is when a DB restore is done manually . My plan is to make the proc trigger when a DB is restored successfully .Is their any option to do that .

Software Engineer
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-08-12 : 15:07:54
If it's being done manually, then run the stored procedure manually too.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

vineethraj
Starting Member

7 Posts

Posted - 2010-08-12 : 15:23:04
Their is no other option ?

Software Engineer
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-08-12 : 15:35:27
You could write custom code to do it, but that'll take a bit of effort on your part. The msdb system tables contain information for when a database is restored, so they can be queried to do what you want.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -