I have an application that uses a sql server db (SQL Express 2008 R2) and starts when Windows OS starts. When the pc shutdown unexpectedly and then restart the pc the application run automatically but it' can't query the DB I looked for the error log and it shows no record for starting the DB and I have to open the SSMS and query the DB. Only after that the db will start (even after seconds from starting the OS)
2018-02-28 13:12:51.05 Server Server process ID is 2420. 2018-02-28 13:12:51.50 spid7s Starting up database 'master'. 2018-02-28 13:12:55.60 spid7s Recovery is complete. This is an informational message only. No user action is required. 2018-02-28 13:12:58.87 spid52 Starting up database 'ReportServer$SQLEXPRESS2008R2TempDB'. 2018-02-28 13:35:27.38 spid57 Starting up database 'DBName'.
as you can see there are about 23 minutes between starting master and my db. I also checked the service and it's running fine in the OS start.
I have 2 questions:1- What SQL Server make to start the db and can I do that programmatically? 2- I noticed that starting 'ReportServer$SQLEXPRESS2008R2TempDB' is the beginning of the delay and it may be the cause of the delay, so can I change the order of starting the databases on the server?
Thanks in advance