﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / Article Discussions / Discuss content posted by Lester Policarpio / Article Discussions by Author  / Automatically Restore Backup Files for SQL 2005 / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Sat, 18 May 2013 18:32:29 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>I have a problem with running this script, it returns this error message:--------------------------------------------------------Msg 3201, Level 16, State 2, Line 1Cannot open backup device 'C:\folder\abase1.bak'. Operating system error 2(The system cannot find the file specified.).Msg 3013, Level 16, State 1, Line 1RESTORE HEADERONLY is terminating abnormally.---------------------------------------------------------I know it can't find abase1.bak because the real physical filename is database1.bak. Please, I'm not very good with SQL but I do have 150+ databases i want to import into MS SQL. Can anyone tell me where i need to look in the script to fix this up?Thanks in advance for all helpful hints / solutions.</description><pubDate>Tue, 10 Nov 2009 03:56:20 GMT</pubDate><dc:creator>rs 77322</dc:creator></item><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>Glad it works :-)</description><pubDate>Mon, 28 Sep 2009 20:32:20 GMT</pubDate><dc:creator>Lester Policarpio</dc:creator></item><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>Edited the listing of the path for the location of the .bak files to use SET @pathension = 'dir /OD /s /b '+@Path+'*.'+@ExtensionAllowing for all .bak files in subdirectories and a shorter directory listing format. Just easier when all my .bak files were sitting in their own folders :)Also had to remove the +@path in front of +@migrate in the 'Restoreheaderonly' statement as I was getting multiple '///'  when the .bak file location was on the network.Currently using it to restore 37 databases though, so it works like a charm!Good job...</description><pubDate>Thu, 28 May 2009 07:38:48 GMT</pubDate><dc:creator>dryan-735480</dc:creator></item><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>We braught in the following on a few parts to ensure that we limit the possiblilty duplicates of the .mdf, .ndf and .ldf physical names and database names are not used.Have you considered something like that?We have quite a few environments and this helped to set them apart.DECLARE @RestoreFrom varchar(20)SET @RestoreFrom = '_ServerName'SET @restoredb = 'RESTORE DATABASE '+(select top 1 DatabaseName+@RestoreFrom from header_lester)UPDATE migration_lester SET physicalname = left(Physicalname,charindex('.',Physicalname)-1)+ @RestoreFrom + Right(Physicalname,4)</description><pubDate>Tue, 03 Feb 2009 03:30:38 GMT</pubDate><dc:creator>mario.lottering@webberwentzel.com</dc:creator></item><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>I'm glad it worked for sql version 2008. The only difference is the schema of the tables in sql 2000, 2005 and 2008 :)</description><pubDate>Mon, 02 Feb 2009 18:59:08 GMT</pubDate><dc:creator>Lester Policarpio</dc:creator></item><item><title>RE: Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>Tried this script on SQL 2008, added a few columns and it worked like a charm. We will be saving a lot of time.:D</description><pubDate>Mon, 02 Feb 2009 02:49:54 GMT</pubDate><dc:creator>mario.lottering@webberwentzel.com</dc:creator></item><item><title>Automatically Restore Backup Files for SQL 2005</title><link>http://www.sqlservercentral.com/Forums/Topic619000-570-1.aspx</link><description>Comments posted to this topic are about the item [B]&lt;A HREF="/scripts/Restore+Backup/65226/"&gt;Automatically Restore Backup Files for SQL 2005&lt;/A&gt;[/B]</description><pubDate>Fri, 12 Dec 2008 17:58:14 GMT</pubDate><dc:creator>Lester Policarpio</dc:creator></item></channel></rss>