Quantcast
Channel: MSBuild Extension Pack
Viewing all articles
Browse latest Browse all 1211

New Post: Sql2008.Database Restore fails with 'RestoreContainer::ValidateTargetForCreation'

$
0
0
So it looks like SQL has the files locked. You'll need to restore to a different file location (SQL will delete the files in use automatically). If you like you can then script a move of the datafiles back to where you need them.

e.g.

<MSBuild.ExtensionPack.Sql2008.Database TaskAction="Restore" DatabaseItem="Assassin" DataFilePath="....\DBBackups\Assassin.bak" ReplaceDatabase="True" NewDataFilePath="C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Assasin_Restore.mdf"LogFilePath="C:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\Assassin_Restore_log.LDF"LogName="Assassin_log"/>

I think I edited that right... heres my working repo:
<MSBuild.ExtensionPack.Sql2008.Database TaskAction="Restore" DatabaseItem="Mike" DataFilePath="C:\Databases\Backup\Mike-b.bak" NewDataFilePath="c:\b\Mike.mdf" ReplaceDatabase="true" LogFilePath="c:\b\Mike_log.ndf" LogName="Mike_log"/>
Mike

Viewing all articles
Browse latest Browse all 1211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>