Hi,
I want to programatically (c#) restore a database (SQL Server 2008) which was originally from my live environment. My local environment is obviously quite different, with different drive mappings.
I have followed this article (http://www.mssqltips.com/tip.asp?tip=1849) which has been a great help, but I am struggling to find out how I can restore the full text catalogs to a different location. I actually would like to completely ignore them as this process doesn't require them, but if I can't ignore them, I need to specify a different location for the files.
Could someone advise? I have used the following code to specify the location of the data files, and it maybe that I need something similar for the full text catalogs:
restoreDb.RelocateFiles.Add(new RelocateFile("SmartT", m_workingDirectory + "SmartT_Data.mdf"));
restoreDb.RelocateFiles.Add(new RelocateFile("SmartT_Log", m_workingDirectory + "SmartT_Log.ldf"));
Currently, my inner exception is:
- InnerException {Microsoft.SqlServer.Management.Common.ExecutionFailureException: An exception occurred while executing a Transact-SQL statement or batch. ---> System.Data.SqlClient.SqlException: Directory lookup for the file "g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTEventsFTCat.ndf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15100). File 'ftrow_SmartTEventsFTCat' cannot be restored to 'g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTEventsFTCat.ndf'. Use WITH MOVE to identify a valid location for the file. Directory lookup for the file "g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTArtistsFTCat.ndf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105). File 'ftrow_SmartTArtistsFTCat' cannot be restored to 'g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTArtistsFTCat.ndf'. Use WITH MOVE to identify a valid location for the file. Directory lookup for the file "g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTVenuesFTCat.ndf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105). File 'ftrow_SmartTVenuesFTCat' cannot be restored to 'g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_SmartTVenuesFTCat.ndf'. Use WITH MOVE to identify a valid location for the file. Directory lookup for the file "g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_ProfilesFTCat.ndf" failed with the operating system error 3(failed to retrieve text for this error. Reason: 15105). File 'ftrow_ProfilesFTCat' cannot be restored to 'g:\MSSQL\MSSQL10.MSSQLSERVER\MSSQL\DATA\ftrow_ProfilesFTCat.ndf'. Use WITH MOVE to identify a valid location for the file. Problems were identified while planning for the RESTORE statement. Previous messages provide details. RESTORE DATABASE is terminating abnormally. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async) at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) at System.Data.SqlClient.SqlCommand.ExecuteNonQuery() at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) --- End of inner exception stack trace --- at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(StringCollection sqlCommands, ExecutionTypes executionType) at Microsoft.SqlServer.Management.Smo.ExecutionManager.ExecuteNonQuery(StringCollection queries) at Microsoft.SqlServer.Management.Smo.BackupRestoreBase.ExecuteSql(Server server, StringCollection queries) at Microsoft.SqlServer.Management.Smo.Restore.SqlRestore(Server srv)} System.Exception {Microsoft.SqlServer.Management.Common.ExecutionFailureException}