I have a production database instance on a production server and a test database instance on a test server. I need to restore the production databases to the test instance daily.
What I need:
LOOP through Prod DB If DB name exists in Test Drop the test database Restore DB from Prod Next in LOOP
SQLServers Copy Databsase Wizard seemed to do what I wanted but it errors on custom database roles, apparently an issue with 2008r2.
Apex Backup is also getting an error.
Backups are made of the production databases daily so I could also just drop the test databases and restore from those BAK files.
Is there an easy way to do what I need to do?
PS: I'm not a DBA, I'm a dev who has to do DBA stuff, so forgive me my ignorance.
pscode to suit your needs.