Invalid object name 'dbo.GenericAttribute' when upgrading to 2.6

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
11 years ago
Performing an upgrade from nopCommerce 2.5 to 2.6. I upgraded the SQL database with no errors. Replaced the files for 2.6 and backed up App_Data/Settings.txt and InstalledPlugins.txt. Also backed up content/images. After new files for 2.6 were uploaded, put the backed up files back on the server.

When running locally or from the web server, I receive the following error:

Server Error in '/' Application.
Invalid object name 'dbo.GenericAttribute'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.GenericAttribute'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[SqlException (0x80131904): Invalid object name 'dbo.GenericAttribute'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +1754306
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +5295182
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +242
   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +1683
   System.Data.SqlClient.SqlDataReader.TryConsumeMetaData() +61
   System.Data.SqlClient.SqlDataReader.get_MetaData() +90
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +365
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite) +1355
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite) +175
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +53
   System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method) +134
   System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior) +41
   System.Data.Common.DbCommand.ExecuteReader(CommandBehavior behavior) +10
   System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +437

[EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.]
   System.Data.EntityClient.EntityCommandDefinition.ExecuteStoreCommands(EntityCommand entityCommand, CommandBehavior behavior) +507
   System.Data.Objects.Internal.ObjectQueryExecutionPlan.Execute(ObjectContext context, ObjectParameterCollection parameterValues) +730
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +131
   System.Data.Objects.ObjectQuery`1. System.Collections.Generic.IEnumerable<T>.GetEnumerator() +36
   System.Data.Entity.Internal.Linq.InternalQuery`1.GetEnumerator() +40
   System.Data.Entity.Infrastructure.DbQuery` 1.System.Collections.Generic.IEnumerable<TResult>.GetEnumerator() +40
   System.Collections.Generic.List`1..ctor(IEnumerable`1 collection) +369
   System.Linq.Enumerable.ToList(IEnumerable`1 source) +58
   Nop.Services.Common.<>c__DisplayClass1.<GetAttributesForEntity>b__0() +450
   Nop.Core.Caching.CacheExtensions.Get(ICacheManager cacheManager, String key, Int32 cacheTime, Func`1 acquire) +93
   Nop.Services.Common.GenericAttributeService.GetAttributesForEntity(Int32 entityId, String keyGroup) +125
   Nop.Services.Common.GenericAttributeExtentions.GetAttribute(BaseEntity entity, String key, IGenericAttributeService genericAttributeService) +134
   Nop.Services.Common.GenericAttributeExtentions.GetAttribute(BaseEntity entity, String key) +84
   Nop.Web.Framework.StoreLastVisitedPageAttribute.OnActionExecuting(ActionExecutingContext filterContext) +343
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +41
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodFilter(IActionFilter filter, ActionExecutingContext preContext, Func`1 continuation) +253
   System.Web.Mvc.<>c__DisplayClass17.<InvokeActionMethodWithFilters>b__14() +21
   System.Web.Mvc.ControllerActionInvoker.InvokeActionMethodWithFilters(ControllerContext controllerContext, IList`1 filters, ActionDescriptor actionDescriptor, IDictionary`2 parameters) +191
   System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +324
   System.Web.Mvc.Controller.ExecuteCore() +106
   System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +91
   System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +10
   System.Web.Mvc.<>c__DisplayClassb.<BeginProcessRequest>b__5() +34
   System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +19
   System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +10
   System.Web.Mvc.Async.WrappedAsyncResult`1.End() +62
   System.Web.Mvc.<>c__DisplayClasse.<EndProcessRequest>b__d() +48
   System.Web.Mvc.SecurityUtil.<GetCallInAppTrustThunk>b__0(Action f) +7
   System.Web.Mvc.SecurityUtil.ProcessInApplicationTrust(Action action) +22
   System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +60
   System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +9
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +9615056
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.17626


Any help would be greatly appreciated.
11 years ago
SilhouetteBS wrote:
Invalid object name 'dbo.GenericAttribute'.

You don't have a new [GenericAttribute] table. It means that you did not execute the database upgrade script over your database
11 years ago
Andrei, it did create a GenericAttribute table, just not named dbo.GenericAttribute. It named it SWSAdmin.GenericAttribute. SWSAdmin is the name of the SQL user. Any idea why it would have done this?
11 years ago
I see. So you have a wrong schema (it should be [dbo]). Follow the next steps:
1. Restore your database to the previous state (as it was before running the upgrade scripts for the first time). If you don't have a backup, then simply drop all the new tables. stored procedures, etc with a wrong schema ([SWSAdmin] in your case).
2. Execute the upgrade script one more time but ensure that it's done using your database owner account so [dbo] schema is used during objects creation.

UPDATE: Or use any SQL Server user which has [dbo] as default schema
11 years ago
Thank you Andrei. I changed the schema for my SQL user to dbo and it works.
11 years ago
I'm having the exact same problem on Arvixe.

Where do you change the Schema for the user?

Not sure if I have rights to do that.

Tried this in MS SQL Server Management Studio

  ALTER SCHEMA dbo TRANSFER [myuser].[GenericAttribute]

and got this

  Msg 15151, Level 16, State 1, Line 1
  Cannot find the object 'GenericAttribute', because it does not exist or you do not have permission.

Table [myuser].[GenericAttribute] does exist.

Never had this problem with previous upgrades scripts...
11 years ago
What hosting plan are you using?
11 years ago
Ok.  I was able to execute the following to change the default schema.  

  ALTER USER [myuser] WITH DEFAULT_SCHEMA = dbo

Then restored the database from backup and re-executed the upgrade scripts.  All is well...
11 years ago
a.m. wrote:
What hosting plan are you using?

Arvixe shared hosting.
11 years ago
SWW wrote:
Arvixe shared hosting.

Is your user a database owner?
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.