Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

Upgrade from CMS 11 to CMS 12 'IDX_tblContentLanguage_fkLanguageBranchID' already exists on table 'dbo.tblContentLanguage

Vote:
 

I'am upgrading from CMS 11 to CMS 12. And i get this error either at startup or when running the command 

dotnet-episerver update-database MyProject.csproj

with an existing database (CMS 11 database):

The operation failed because an index or statistics with name 'IDX_tblContentLanguage_fkLanguageBranchID' already exists on table 'dbo.tblContentLanguage'.
dotnet-episerver : Unhandled exception: Microsoft.Data.SqlClient.SqlException (0x80131904): The operation failed because an index or statistics with name 'IDX_tblContentLanguage_fkLanguageBranchID' already exists on table 'dbo.tblContentLanguage'.
At line:1 char:1
+ dotnet-episerver update-database MyProject.csproj
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (Unhandled excep...ntentLanguage'.:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError
 
   at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
   at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
   at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at EPiServer.Net.Cli.ScriptRunner.<>c__DisplayClass5_0.<ExecuteScript>b__0() in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\ScriptRunner.cs:line 55
   at EPiServer.Net.Cli.DatabaseHandler.Execute[T](Func`1 f, Boolean commit) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\DatabaseHandler.cs:line 95
   at EPiServer.Net.Cli.ScriptRunner.ExecuteScript(StreamReader stream) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\ScriptRunner.cs:line 53
   at EPiServer.Net.Cli.ScriptRunner.ExecuteScripts(IEnumerable`1 files, Boolean requiresValidation) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\ScriptRunner.cs:line 97
   at EPiServer.Net.Cli.ScriptRunner.Execute(IEnumerable`1 files, Boolean requiresValidation) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\ScriptRunner.cs:line 29
   at EPiServer.Net.Cli.Commands.UpdateDatabase.RunAsync(CancellationToken token) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\Commands\UpdateDatabase.cs:line 127
   at EPiServer.Net.Cli.Commands.UpdateDatabase.StartAsync(CancellationToken cancellationToken) in E:\BuildAgent\work\e72ed2d7d1e92bba\src\EPiServer.Net.Cli\Commands\UpdateDatabase.cs:line 63
   at Microsoft.Extensions.Hosting.Internal.Host.StartAsync(CancellationToken cancellationToken)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at Microsoft.Extensions.Hosting.HostingAbstractionsHostExtensions.RunAsync(IHost host, CancellationToken token)
   at System.CommandLine.Invocation.CommandHandler.GetResultCodeAsync(Object value, InvocationContext context)
   at System.CommandLine.Invocation.ModelBindingCommandHandler.InvokeAsync(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseErrorReporting>b__21_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass25_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass23_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__22_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseParseDirective>b__20_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseDebugDirective>b__11_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__10_0>d.MoveNext()
--- End of stack trace from previous location ---
   at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass14_0.<<UseExceptionHandler>b__0>d.MoveNext()

Are there any solution to fixing this error

#303563
Jun 15, 2023 12:42
Vote:
 

Hi,

The easiet solution is to find the 'IDX_tblContentLanguage_fkLanguageBranchID' on tblContentLanaguge and remove / delete, then run your update script again.

I have seen this with find indexes the odd time.

Paul

#303611
Jun 16, 2023 7:56
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.