Problem: All of a sudden, one of my databases is not accessible. Luckily, it is on QA.
Solution:
- My first stop was right click on the database and look at the property. Bad luck, nothing is in there.
- My second stop is on the sys.databases table. Ahh, my database is in RECOVERY_PENDING mode when everyone else is on ONLINE. (select * from sys.databases)
- My thrid stop is on the sys.master_files. I want to make sure that data file and log files are there. (select * from sys.master_files). They are there.
- So I need to do soething about it. What if I take the databse offline and bring back on line immidiate.
ALTER DATABASE ABC SET OFFLINE WITH ROLLBACK IMMEDIATE
go
ALTER DATABASE ABC SET ONLINE WITH ROLLBACK IMMEDIATE
It Works!
Conclusion: Now you should look at the log to see why this failed.