We have a production system on Server1 running a SQL Server 2008 R2 database. Currently we have a maintenance plan to do full backups of selected databases nightly. We have a test server, Server2, which is also running SQL Server 2008 R2. We'd like some sort of script or way to copy the fresh backup from Server1 to Server2 then do a full overwrite of the database on Server2. This way each day Server2 has a restoration of Server1.
Any changes to Server2 DB would be overwritten that night with the new Server1 database.
I'm having challenges in being able to figure out how to pick the correct backup file name, copy it to Server2 and then restore it. I can do all of this manually, however that's a hassle.
Anyone have a script or a method to assist this? Would be greatly appreciated as I've beat my head against a wall for the past two days trying to figure it out without much results.