I have the scenario where I have to generate a backup of the database (SQL Server 2008) and restore into the new server (SQL Server 2016). While taking backup data should not be changed in any case. So I have two options to do that, but I am not sure how it will work. (Everything is using SQL Job only.)
-
Set a read-only database and restore into the new DB server.
→ Is it possible to restore a read-only DB on the new server? The destination server is already having a read-write (online) database by the same name.
-
Set an offline database and restore onto the new DB server.
→ Is it possible to restore an offline DB in the new server? The destination server already has an online (read-write) database by the same name.
Best Answer
Yes
An example:
Not entirely sure what you mean by this, but you could restore the database with a different name if you would like to, remember to remove the read only property afterwards.
You could also replace the existing database with the REPLACE keyword.
No, this is not possible as sql server removes all handles from the database files and will not be able to access it while it is offline.
You could look into detach / attach but backup restore is preferable.