Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Initialize action failed | Invalid object name 'tblBigTable' | CMS 11 -> CMS 12

Vote:
 

I am running into initialization issues when migrating from CMS 11.15.0 -> CMS 12.8. It seems CMS is having a hard time running a specific SQL script. I have verified the tblBigTable does exist in my CMS Database. If I open SSMS and run the SQL against CMS DB it executes fine, if I try to run it against Commerce DB (it obviously does not work) but does provide the error "Invalid object name 'tblBigTable'"; which leads me to believe something might be configured wrong on my end to where the application is trying to update the Commerce DB.

Error Summary

  • Initialize action failed
  • Failed to update database during execution of statement '--Update known types in DDS
  • Invalid object name 'tblBigTable'.

Attempts to fix

The only way I can get the error to go away (but introduce a new one) is to comment out my AddCmsAspNetIdentity line in Startup. I am using a custom Identity user called SiteUser, which inherits ApplicationUser.

I have also tried running dotnet-episerver update-database.

Full Error Stack

2023-05-24T13:43:07.456670232Z Starting ssh...
2023-05-24T13:43:07.506320602Z Starting OpenBSD Secure Shell server: sshd.
2023-05-24T13:43:07.506616207Z Starting application...
2023-05-24T13:43:12.800033044Z fail: EPiServer.Framework.Initialization.InitializationEngine[0]
2023-05-24T13:43:12.800474051Z       Initialize action failed for 'Initialize on class EPiServer.Data.DataInitialization, EPiServer.Data, Version=12.6.0.0, Culture=neutral, PublicKeyToken=8fe83dea738b45b7'
2023-05-24T13:43:12.801139561Z       System.Data.DataException: Failed to update database during execution of statement '--Update known types in DDS
2023-05-24T13:43:12.801161362Z       UPDATE tblBigTable SET ItemType = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileModel, EPiServer.Cms.UI.AspNetIdentity' WHERE StoreName = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileModel'
2023-05-24T13:43:12.801168062Z       UPDATE tblBigTableReference SET ElementType = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileModel, EPiServer.Cms.UI.AspNetIdentity' WHERE ElementStoreName = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileModel'
2023-05-24T13:43:12.801173662Z       IF EXISTS(select * FROM sys.views where name = 'VW_VisitorGroupCriterion')
2023-05-24T13:43:12.801178562Z       BEGIN
2023-05-24T13:43:12.801183362Z       	UPDATE [VW_VisitorGroupCriterion] SET TypeName = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileCriterion, EPiServer.Cms.UI.AspNetIdentity' WHERE TypeName = 'EPiServer.Personalization.VisitorGroups.Criteria.UserProfileCriterion, EPiServer.Cms.AspNetCore'
2023-05-24T13:43:12.801190062Z       END
2023-05-24T13:43:12.801194662Z       '
2023-05-24T13:43:12.801199462Z        ---> Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'tblBigTable'.
2023-05-24T13:43:12.801204662Z          at Microsoft.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
2023-05-24T13:43:12.801209762Z          at Microsoft.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
2023-05-24T13:43:12.801214863Z          at Microsoft.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
2023-05-24T13:43:12.801219463Z          at Microsoft.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
2023-05-24T13:43:12.801224463Z          at Microsoft.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean isAsync, Int32 timeout, Boolean asyncWrite)
2023-05-24T13:43:12.801229463Z          at Microsoft.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry, String methodName)
2023-05-24T13:43:12.801234663Z          at Microsoft.Data.SqlClient.SqlCommand.ExecuteNonQuery()
2023-05-24T13:43:12.801239563Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptRunnerImpl.<>c__DisplayClass5_0.<ExecuteScript>b__0()
2023-05-24T13:43:12.801257863Z       ClientConnectionId:228e6b60-4dcf-400e-a7e6-393ed9cffda8
2023-05-24T13:43:12.801263063Z       Error Number:208,State:1,Class:16
2023-05-24T13:43:12.801267463Z       ClientConnectionId before routing:032aa8d4-99a0-4b8f-ac7d-acf59f2cb103
2023-05-24T13:43:12.801272163Z       Routing Destination:d7e470a0fa81.tr37401.eastus1-a.worker.database.windows.net,11020
2023-05-24T13:43:12.801276564Z          --- End of inner exception stack trace ---
2023-05-24T13:43:12.801281464Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptRunnerImpl.<>c__DisplayClass5_0.<ExecuteScript>b__0()
2023-05-24T13:43:12.801286864Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass26_0`1.<ExecuteTransaction>b__0()
2023-05-24T13:43:12.801291564Z          at EPiServer.Data.Providers.Internal.NoRetriesPolicy.Execute[TResult](Func`1 method)
2023-05-24T13:43:12.801296364Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.ExecuteTransaction[TResult](Func`1 action)
2023-05-24T13:43:12.801300764Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptRunnerImpl.ExecuteScript(IDatabaseExecutor databaseHandler, StreamReader stream)
2023-05-24T13:43:12.801305064Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptRunnerImpl.<>c__DisplayClass2_0.<ExecuteScripts>b__0()
2023-05-24T13:43:12.801309964Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass25_0.<ExecuteTransaction>b__0()
2023-05-24T13:43:12.801314864Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.<>c__DisplayClass26_0`1.<ExecuteTransaction>b__0()
2023-05-24T13:43:12.801342465Z          at EPiServer.Data.Providers.SqlTransientErrorsRetryPolicy.Execute[TResult](Func`1 method)
2023-05-24T13:43:12.801349065Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.ExecuteTransaction[TResult](Func`1 action)
2023-05-24T13:43:12.801353865Z          at EPiServer.Data.Providers.Internal.SqlDatabaseExecutor.ExecuteTransaction(Action action)
2023-05-24T13:43:12.801428566Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptRunnerImpl.ExecuteScripts(IDatabaseExecutor databaseHandler, IEnumerable`1 streams)
2023-05-24T13:43:12.801510867Z          at EPiServer.Data.SchemaUpdates.Internal.ScriptExecutorImplementation.ExecuteScript(String connectionString, Stream stream)
2023-05-24T13:43:12.801519467Z          at EPiServer.Cms.UI.AspNetIdentity.Schema.AspNetIdentitySchemaUpdater`1.Update(ConnectionStringOptions connectionStringOptions)
2023-05-24T13:43:12.801573168Z          at EPiServer.Data.SchemaUpdates.Internal.DatabaseSchemaManagerImplementation.EnsureDatabaseSchema(DataAccessOptions dataAccessOptions)
2023-05-24T13:43:12.801580668Z          at EPiServer.Data.DataInitialization.ValidateDatabaseSchema(InitializationEngine context)
2023-05-24T13:43:12.801585868Z          at EPiServer.Data.DataInitialization.Initialize(InitializationEngine context)
2023-05-24T13:43:12.801711470Z          at EPiServer.Framework.Initialization.Internal.ModuleNode.<>c__DisplayClass4_0.<Initialize>b__0()
2023-05-24T13:43:12.801729671Z          at EPiServer.Framework.Initialization.Internal.ModuleNode.Execute(Action a, String key)
2023-05-24T13:43:12.801788971Z          at EPiServer.Framework.Initialization.Internal.ModuleNode.Initialize(InitializationEngine context)
2023-05-24T13:43:12.801796272Z          at EPiServer.Framework.Initialization.InitializationEngine.InitializeModules()

Startup.cs File

public void ConfigureServices(IServiceCollection services)
        {
            services.Configure<DataAccessOptions>(options => options.ConnectionStrings.Add(new ConnectionStringOptions
            {
                Name = "EcfSqlConnection",
                ConnectionString = _configuration.GetConnectionString("EcfSqlConnection")
            }));
            
            services.AddCmsAspNetIdentity<SiteUser>(o =>
            {
                if (string.IsNullOrEmpty(o.ConnectionStringOptions?.ConnectionString))
                {
                    o.ConnectionStringOptions = new ConnectionStringOptions
                    {
                        Name = "EcfSqlConnection",
                        ConnectionString = _configuration.GetConnectionString("EcfSqlConnection")
                    };
                }
            },
            null,
            null,
            builder =>
                builder.MigrationsAssembly("Evoqua.Core"));

            services.AddTransient<IPasswordHasher<SiteUser>, FallbackPasswordHasher<SiteUser>>();

            services.AddMvc(o => o.Conventions.Add(new FeatureConvention())).AddRazorOptions(ro => ro.ViewLocationExpanders.Add(new FeatureViewLocationExpander()));
            
            if (_webHostingEnvironment.IsDevelopment())
            {
                services.Configure<ClientResourceOptions>(uiOptions =>
                {
                    uiOptions.Debug = true;
                });
            }
            else
            {
                services.AddCmsCloudPlatformSupport(_configuration);
                services.AddCommerceCloudPlatformSupport(_configuration);
            }
            
            services.AddCommerce();
            services.AddFind();
            services.AddGetaCategories();
            services.AddMaxMindGeolocationProvider(o =>
            {
                o.DatabasePath = Path.Combine(_webHostingEnvironment.ContentRootPath, "App_Data", "GeoLite2-City.mmdb");
                o.LocationsDatabasePath = Path.Combine(_webHostingEnvironment.ContentRootPath, "App_Data", "GeoLite2-City-Locations-en.csv");
            });

            services.AddDbContext<CommerceDbContext>(options => options.UseSqlServer(_configuration.GetConnectionString("EcfSqlConnection")));

            SetTinyMceSettings(services);
        }

        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            app.UseNotFoundHandler();
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseGetaCategories();
            app.UseGetaCategoriesFind();

            app.UseAnonymousId();
            app.UseStaticFiles();
            app.UseRouting();
            app.UseCors();
            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(name: "Default", pattern: "{controller}/{action}/{id?}");
                endpoints.MapControllers();
                endpoints.MapRazorPages();
                endpoints.MapContent();
            });

            HttpContextHelper.Configure(app.ApplicationServices.GetRequiredService<IHttpContextAccessor>());
            WebHostHelper.Configure(app.ApplicationServices.GetRequiredService<IWebHostEnvironment>());
            
            var factory = app.ApplicationServices.GetService<IServiceScopeFactory>();
            
            using var scope = factory.CreateScope();
            using var context = scope.ServiceProvider.GetRequiredService<CommerceDbContext>();
            
            context.Database.Migrate();
        }

CMS Package List

<PackageReference Include="EPiServer.CMS" Version="12.8.0" />
<PackageReference Include="EPiServer.CloudPlatform.Cms" Version="1.2.0" />
<PackageReference Include="EPiServer.CloudPlatform.Commerce" Version="1.1.2" />
<PackageReference Include="EPiServer.CMS.AspNetCore.HtmlHelpers" Version="12.6.0" />
<PackageReference Include="EPiServer.CMS.Core" Version="12.6.0" />
<PackageReference Include="EPiServer.Find.Cms" Version="14.2.4" />
<PackageReference Include="EPiServer.Find.Commerce" Version="12.1.0" />
<PackageReference Include="EPiServer.Framework" Version="12.6.0" />
<PackageReference Include="EPiServer.Framework.AspNetCore" Version="12.6.0" />
<PackageReference Include="EPiServer.Hosting" Version="12.6.0" />
<PackageReference Include="EPiServer.Personalization.Commerce" Version="4.0.11" />
<PackageReference Include="EPiServer.Tracking.Commerce" Version="4.0.11" />
<PackageReference Include="EPiServer.Personalization.Content.UI" Version="1.0.1" />
<PackageReference Include="EPiServer.Personalization.MaxMindGeolocation" Version="2.3.0" />
<PackageReference Include="EPiServer.TinyMCESpellChecker" Version="3.0.0" />
<PackageReference Include="EPiServer.Commerce" Version="14.3.1" />
<PackageReference Include="EPiServer.ConnectForMarketingAutomation" Version="6.1.1" />
<PackageReference Include="EPiServer.Forms" Version="5.2.0" />
<PackageReference Include="EPiServer.Labs.LanguageManager" Version="5.1.2" />
<PackageReference Include="EPiServer.Marketing.Automation.Forms" Version="3.1.1" />
<PackageReference Include="EPiServer.MarketingAutomationIntegration.Marketo" Version="5.1.0" />
<PackageReference Include="EPiServer.ServiceApi" Version="6.1.0" />
<PackageReference Include="EPiServer.ServiceApi.Commerce" Version="6.1.0" />
<PackageReference Include="EPiServer.CMS.UI" Version="12.8.0" />

<PackageReference Include="Advanced.CMS.AdvancedReviews" Version="1.2.2" />
<PackageReference Include="Baaijte.Optimizely.ImageSharp.Web" Version="1.0.6" />
<PackageReference Include="Geta.NotFoundHandler.Optimizely" Version="5.0.6" />
<PackageReference Include="Geta.Optimizely.Categories.Find" Version="1.0.0" />
<PackageReference Include="Geta.Optimizely.Sitemaps" Version="3.1.0" />
<PackageReference Include="Geta.Optimizely.Sitemaps.Commerce" Version="3.1.0" />
<PackageReference Include="LazyCache" Version="2.4.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.WsFederation" Version="6.0.16" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation" Version="6.0.16" />
<PackageReference Include="NHibernate" Version="5.4.2" />
<PackageReference Include="PictureRenderer.Optimizely" Version="2.5.0" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.AspNetCore" Version="5.0.0" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="ClosedXML" Version="0.100.3" />
<PackageReference Include="CsvHelper" Version="30.0.1" />
<PackageReference Include="DocumentFormat.OpenXml" Version="2.19.0" />
<PackageReference Include="Geta.Optimizely.Categories" Version="1.0.0" />
<PackageReference Include="ExcelNumberFormat" Version="1.1.0" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.0" />>
<PackageReference Include="PowerSlice" Version="5.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="RestSharp" Version="108.0.3" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="System.ServiceModel.Http" Version="4.8.1" />
<PackageReference Include="Threenine.LinqToCsv" Version="1.6.0" />
#302394
May 26, 2023 4:44
Vote:
 

Hi Billy,

Is this happening in local development environment and not DXP?

One thing I have noticed before is tblBigTable and tblBigReference are large is size. See here on how to check the largest tables.

If these tables are the largest then it might be possible that on initialization, you are getting a timeout warning, however sql is still running the scripts in the background to process.

I would let it run for some time, possibly overnight and then come back.

There is a way to safely clear down these tables, i'll dig out the info.

Thanks

Paul

#302398
May 26, 2023 8:14
Vote:
 

This issue is happening in both my local and DXP. I am not sure if your approach (I would let it run for some time, possibly overnight and then come back) will work in DXP, the app has been running for days now and the issue persists. Though, I could be wrong here. 

I do see the tblBigTable at the top of the file size list.

dbo.tblActivityLog 15,736,582 12,419,032 9,127,936 3,046,608 244,488
dbo.tblNotificationSubscription 4,797,676 1,565,168 697,104 817,904 50,160
dbo.BVN.NotFoundRequests 5,350,197 948,040 933,472 3,480 11,088
dbo.tblWorkContentProperty 244,138 240,592 174,584 58,856 7,152
dbo.tblScheduledItemLog 23,703 152,792 150,320 1,128 1,344
dbo.tblBigTable 27,546 119,992 95,768 20,912 3,312
dbo.tblContentProperty 78,484 89,992 66,432 20,224 3,336
dbo.tblWorkContent 81,846 67,848 33,176 30,768 3,904
dbo.tblContentLanguage 58,747 48,000 24,464 20,352 3,184
dbo.tblActivityArchive 65,968 28,776 28,312 192 272
dbo.tblContent 54,257 25,464 10,672 12,712 2,080
dbo.tblTree 270,946 17,880 8,880 7,976 1,024
dbo.tblBigTableReference 16,112 15,184 13,592 1,192 400
#302409
May 26, 2023 13:15
Vote:
 

Optimizely support got back and It seems that this was a bug with EPiServer.CMS.UI 12.8.0. Upgrading to the latest version will resolve the issue. https://world.optimizely.com/support/bug-list/bug/CMS-24819

#302561
May 29, 2023 14:03
Paul McGann (Netcel) - Jun 02, 2023 8:41
Glad Optimizely was able to hep you out with this one.
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* 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.