Is it possible to do an automatic/daily restore of a
database to a test box that is being backed up as part of
a maintenence plan? Since the backup file contains a
timestamp, I'm wondering if the file name is stored in one
of the msdb system tables where I can select it into the
restore script. thanks.Yes it is. Here is a bit of code to identify the last backup for a
database. You can then build a process around this to automate the restore.
Keep in mind if you do multiple types of backups (tran, diff, and full) then
you might have to restore from multiple files. Also if the file is on your
prod box, you might need to create a network share or something to get
access to the backup from test.
select physical_device_name
from msdb..backupset a join msdb..backupmediaset b on a.media_set_id =b.media_set_id
join msdb..backupmediafamily c on a.media_set_id = c.media_set_id
where backup_start_date = (select top 1 backup_start_date from msdb..backupset
where database_name = 'YourBaseNameHere'
order by backup_start_date desc)
Here is an article that will show you how to even build the restore script:
http://www.databasejournal.com/features/mssql/article.php/2174411
----
----
--
Need SQL Server Examples check out my website at
http://www.geocities.com/sqlserverexamples
"rob" <anonymous@.discussions.microsoft.com> wrote in message
news:2367001c45ed3$30411ae0$a601280a@.phx.gbl...
> Is it possible to do an automatic/daily restore of a
> database to a test box that is being backed up as part of
> a maintenence plan? Since the backup file contains a
> timestamp, I'm wondering if the file name is stored in one
> of the msdb system tables where I can select it into the
> restore script. thanks.
No comments:
Post a Comment