Full Error
TFS database backup job failed with error: TF30040: The database is not correctly configured. Contact your Team Foundation Server administrator.System.Data.SqlClient.SqlException (0×80131904): Could not find stored procedure ‘prc_TfsSetTransactionLogMark’.
Problem
We started getting an error in the event log every time our backups ran that had the below details in it.
Exception Message: TF30040: The database is not correctly configured.
Contact your Team Foundation Server administrator. (type DatabaseConfigurationException)
Exception Stack Trace: at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.
TranslateException(Int32 errorNumber, SqlException sqlException, SqlError sqlError)
at Microsoft.TeamFoundation.Framework.Server.
TeamFoundationSqlResourceComponent.TranslateException(SqlException sqlException)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.MapException(
SqlException ex, QueryExecutionState queryState)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.HandleException(Exception exception)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.Execute(
ExecuteType executeType, CommandBehavior behavior)
at Microsoft.TeamFoundation.Framework.Server.TeamFoundationSqlResourceComponent.ExecuteNonQuery(Boolean bindReturnValue)
at Microsoft.TeamFoundation.Admin.AdminSqlResourceComponent.ExecuteNonQuery(
SqlQuery sqlQuery, SqlInfoMessageEventHandler infoMessageHandler)
at Microsoft.TeamFoundation.Admin.SqlHandler.ExecuteNonQuery(String connectionString, SqlQuery sqlQuery)
at Microsoft.TeamFoundation.Admin.SqlHandler.ExecuteNonQuery(String connectionString, String sqlStatement)
at Microsoft.TeamFoundation.Admin.Jobs.DatabaseBackupJob.TakeTransactionalBackups(
TeamFoundationRequestContext requestContext, BackupSettings settings, ITFLogger logger)
Inner Exception Details:
Exception Message: Could not find stored procedure ‘prc_TfsSetTransactionLogMark’. (type SqlException)
SQL Exception Class: 16
SQL Exception Number: 2812
SQL Exception Procedure:
SQL Exception Line Number: 1
SQL Exception Server: <server>
SQL Exception State: 62
SQL Error(s):</server>
The problem started occurring after we started restoring backups from our production instance into our test/dev TFS environment.
Solution
After attaching/restoring a new collection you must reconfigure your TFS scheduled backups.
Reason for error
When you configure your scheduled backups the application creates the stored procedure ‘prc_TfsSetTransactionLogMark’ in all the databases that would be backed up. Because we detached our collection on one server and then reattached it on another (that was originally configured to backup) and didn’t reconfigure the backups, the scheduled would assume that the collection database has this procedure and tries to execute using it.