Question

We are a team of mathematicians (i.e., no DBA experience).

We are migrating from an old server box (SQL Server 2012) to a new server box (SQL Server 2017). For each database on the old server, we made a backup copy, ported it over to the new server, and restored it to its full database glory from the backup file.

So far, so good.

However, there was a delay in our move-in date and we are still using the old server. As we continue to work on the old server, changes continue to accrue in those databases. So it means that the copied databases sitting on the new server are now obsolete and out-of-date. (Ironic, isn't it?)

For those databases that have changed, we know we will eventually have to make new backup copies and port those over to the new server.

When it comes time, what is the smartest way to get rid of those now-obsolete databases on the new server before restoring the latest backup copies?

We worry that with the same names, some occluding or eclipsing might occur if we are not careful. We want to make sure that the out-of-date copies on the new server are well and truly gone before restoring the latest versions.

Was it helpful?

Solution

Just use WITH REPLACE in your restore command and it will overwrite the existing databases on the destination. Simple, and done. You can DROP first, but its not necessary.

WITH REPLACE is the T-SQL keyword that corresponds to "overwrite the existing database" in the restore database GUI (added for future readers of this thread)

Oh...and are you running an RC version of 2017? RTM isn't until next Monday 10/2...just an afterthought.

OTHER TIPS

Restoring a database over an existing database completely replaces the old database - just make sure you check off "overwrite existing database".

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top