I have 2 databases, DB1 and DB2. DB1 has production/live data. A script runs daily (takes about 3 hours) to fill DB2. The goal is to restore DB1 with DB2 so that DB1 is down for as little time as possible. I've restored databases before but never from a differently named one. How can I do this?
Sql-server – Restore Database from Database with Different Name
restoresql server
Related Question
- Sql-server – SQL Server 2016 slow restore
- Sql-server – Database Full Backup Maintenance Task has large delay between databases
- Sql-server – Database with replication and mirroring stuck in LOG_BACKUP after log file shrink
- Sql-server – Sql Server Restoring Process Time Takes Too Long Time
- Sql-server – how to remove all permissions in a database
- Sql-server – SQL Fast database restore with Azure Virtual Machine instant recovery snapshot and SQL in Azure VM
- Sql-server – Can you update a database with transaction logs only, without having to do a full restore
Best Answer
Are you looking to do something like a re-name swap? Something like this:
Then you re-load DB2 again the next time?
If so you can simply alter the name of the DB rather than deal with the time a restore takes (the file names will remain the same but that really doesn't matter in this case.)
Now on the other hand if you actually want to keep DB2 in place and just restore over DB1 it would look something like this:
There are several methods you can use to improve your speed. Probably the easiest is to stripe your backup.
Warning, you will need to have all of the files you stripe to in order to do your restore. If you lose one the whole backup is useless.