We've had an issue crop up a few times — maybe we're not using 'best practices' to restore, but appreciate any advice. We run an IIS app with a SQL Server database, and sometimes we run two+ instances (multi-site) on the same server / SQL Server instance.
Let's say we have a database 'site1', and we create a site1.bak
of that site. Then we need to set up another, so we restore site1.bak
to a new database site2
.
However, on restoring that database (and ensuring the file names are different), the ORIGINAL site says it's IN RECOVERY
. The 'fix' is easy — we run:
RESTORE DATABASE NameofDatabase
WITH RECOVERY
…but the fear is something else is going on that could be detrimental. Why would the original database go into restore when the .bak
is being restored to a new database with different file names?
Best Answer
You are restoring on the same database and using
norecovery
in your script. You should use (pseudo code) ..