How to bring a MSSQL database online out of standby/read-only

I run into this a lot – we have a standby/log-shipping database that’s used for reporting, but eventually we may need to bring it online and don’t have a transaction log to restore then bring it online with. Instead, just run:

…and you should be set. In some instances, depending on where your standby database originated from, you may run into errors like this one:

During startup of warm standby database DBNAME (database ID 6), its standby file (‘s:\MSSQL\DBNAME_Standby.bak’) was inaccessible to the RESTORE statement. The operating system error was ‘2(The system cannot find the file specified.)’. Diagnose the operating system error, correct the problem, and retry startup.

To get around that, run this:

And boom, your database is writable.

 

Share on Facebook