Page 1 of 1

Help: DB Error Upon Launching Mirror Site

Posted: Mon Feb 27, 2012 11:46 pm
by moustafa
Hi,

We have had a bunch of design work done to our site on a dev server. In order to test it out before going live, I took the new code and pointed it at the live site's DB. It worked fine, except that it still looked like the old site (b/c the Theme, Content Page, Display Page, etc. are stored in the DB). So far, so good.

I made a copy of the DB and pointed the new code to the replicated DB. I would then go in and manually change the theme info. However, I'm now getting the error below.

Can anyone tell me how to fix this problem or how to solve this problem properly? I really want the new code on the old DB during go-live so that I don't lose order or product info. I can't use DataPort either b/c I don't have that kind of access to the live server.

The error is below:

Code: Select all

Server Error in '/' Application.

Cannot insert the value NULL into column 'UserId', table 'Moustafa_shukr_co_uk_n.dbo.ac_Users'; column does not allow nulls. INSERT fails.
The statement has been terminated.

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: Cannot insert the value NULL into column 'UserId', table 'Moustafa_shukr_co_uk_n.dbo.ac_Users'; column does not allow nulls. INSERT fails.
The statement has been terminated.

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): Cannot insert the value NULL into column 'UserId', table 'Moustafa_shukr_co_uk_n.dbo.ac_Users'; column does not allow nulls. INSERT fails.
The statement has been terminated.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +33
   System.Data.SqlClient.SqlDataReader.get_MetaData() +83
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
   System.Data.SqlClient.SqlCommand.ExecuteScalar() +139
   CommerceBuilder.Data.Database.a(DbCommand A_0) +90
   CommerceBuilder.Data.Database.ExecuteScalar(DbCommand command) +83
   CommerceBuilder.Users.User.BaseSave() +2690
   CommerceBuilder.Users.User.Save() +1166
   CommerceBuilder.Users.UserDataSource.a(String A_0) +504
   CommerceBuilder.Users.UserDataSource.LoadForUserName(String userName, Boolean createMissing) +194
   CommerceBuilder.Common.Token.InitUserContext(HttpContext context) +632
   CommerceBuilder.Services.c.b(Object A_0, EventArgs A_1) +74
   System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +68
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Version Information: Microsoft .NET Framework Version:2.0.50727.3623; ASP.NET Version:2.0.50727.3618
Thanks in advance,
Moustafa

Re: Help: DB Error Upon Launching Mirror Site

Posted: Tue Feb 28, 2012 8:29 am
by jmestep
You might need to change the owner of your database tables to dbo
It looks like this one is named Moustafa_shukr_co_uk_n.dbo.ac_Users

Re: Help: DB Error Upon Launching Mirror Site

Posted: Tue Feb 28, 2012 11:12 am
by AbleMods
moustafa wrote:Can anyone tell me how to fix this problem or how to solve this problem properly?
Check the ac_Users table in the replicated database. Make sure the UserId column has the Identity property set. It doesn't appear to be so from the error message you've shown. If not, your replicated copy is no good, trash it and use backup/restore to copy the live db.

Identity-type columns may not be replicating correctly using SQL replication.

It's better to use backup/restore to copy an AC7 database rather than SQL replication.