4

I am doing the below :

RESTORE DATABASE UAT
FROM DISK = 'E:\Databases\backup\MY_LIVE_20120720_070001.bak'
WITH REPLACE

But I want to be able to use a file location that ignores the numbers in the file name (which represent the date) in my back up file. There will only ever be one 'MY_LIVE_****.bak' but its number string will change each day.

The goal is to restore my UAT instance from live each week, using the latest backup - of which there will be only file matching that string prefix, but the numbers/date will change each week.

John Gardeniers
  • 27,262
  • 12
  • 53
  • 108
NimChimpsky
  • 460
  • 2
  • 5
  • 17

1 Answers1

5

Not quite the answer that you're looking for, but the name of the backup file can be found in a combination the backup* tables in msdb. Your restore process could query the production msdb, figure out the backup file name, and go from there. Aside from that, there's always powershell which gives you the perfect blend of file system and database access.

Ben Thul
  • 2,969
  • 16
  • 23