RE: automate restore process for developer environment

RE: automate restore process for developer environment

 

  

Control the backup set name yourself.

Instead of scheduling the job through Maintenance, create a TSQL backup
script and schedule it as a job. The example below will create a backup
with the yyyymmdd value appended to the name.

- - - - - - - - - - - - -

DECLARE @BUFile VARCHAR(128)

SET @BUFile = 'E:\Backups\DBAData_' + CONVERT(VARCHAR(8), GETDATE(),
112) + '.bak'

BACKUP DATABASE DBAData
TO DISK=@BUFile
WITH init, skip


==+==+==+==+==+==+==+==+==+==+==+==+
Brendt W. Hess
Database Administrator, Motosport, Inc.
brendt.[Email address protected]
==+==+==+==+==+==+==+==+==+==+==+==+

-----Original Message-----
From: Ligda John
[mailto:mssqldba-ezmlmshield-x65706059.[Email address protected]
Sent: Thursday, May 31, 2007 4:55 PM
To: LazyDBA Discussion
Subject: automate restore process for developer environment

Hi,



I want to issue a restore statement as part of a job so I can restore a
developer server from the production backup. Problem is I wont know the
exact minute the backup set file will have... sometimes its 03 sometimes
04. How can I generate such a statement dynamically without using
xpcmdshell to read the file names?



RESTORE DATABASE [somedb] FROM DISK =
N'\\networkresource\somedir\somedb_db_200705310404.BAK' WITH FILE = 1,
NOUNLOAD , STATS = 10, RECOVERY , REPLACE





---------------------------------------------------------------------
TO REPLY TO EVERYBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY To post a
dba job: http://jobs.lazydba.com To subscribe : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html


MS Sql Server LazyDBA home page