I am trying to run a stored procedure at startup of the SQL instance. I created the proc in the Master database and it contains linked servers. I have setup the procedure to run at startup but when the instance restarts it does not run.
I have queried xp_readerrorlog and see the message that the procedure launched
When I run the procedure manually it runs fine and when I set it up in a SQL Agent Job to run at startup it runs fine. Why would I not be able to get it to run at startup?
I also created a simple proc that inserts the time into a table on startup and that works fine so I know my setup is correct and it has something to do with the linked servers.
asked Jan 07, 2015 at 07:17 PM in Default
The master database is recovered before the instance is made available on the network. Therefore, your startup procedure in master is running before the linked server is available. I am not sure why your procedure didn't log any error, however.
I did a little searching and found this summary of the startup process.
answered Jan 07, 2015 at 07:38 PM
Tom Staab ♦