Answered by:
Failed CRM 4.0 to 2011 migration. Hotfix for SE Bug 18083 interrupted with error.

Question
-
What can I do with this problem?
CRM Trace:
[2011-09-02 09:10:24.319] Process: mmc |Organization:00000000-0000-0000-0000-000000000000 |Thread: 13(Async/Worker-thread.) |Category: Exception |User: 00000000-0000-0000-0000-000000000000 |Level: Error | CrmException..ctor
at CrmException..ctor(String message, Exception innerException, Int32 errorCode, Boolean isFlowControlException)
at CrmException..ctor(String message, Exception innerException)
at ImportOrganizationInstaller.ImportAndUpgrade(OrganizationInfo organizationInfo)
at ImportOrganizationInstaller.Execute(Object obj)
at ProgressController.ExecuteHandler()
at StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)
at ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at ThreadPoolWorkQueue.Dispatch()
at _ThreadPoolWaitCallback.PerformWaitCallback()
>Crm Exception: Message: Upgrade Organization with Id=73b26af9-a07b-de11-94f0-00304886c434 failed with Exception:
System.Exception: Action Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction failed. ---> System.Data.SqlClient.SqlException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)
at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async)
at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
at Microsoft.Crm.Setup.Database.DatabaseUtility.ExecuteSql(InstallDatabase database, String sql, Int32 timeout, Boolean disablePool)
at Microsoft.Crm.Setup.Database.SqlScriptAction.Execute(DatabaseUtility dbUtility)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.ExecuteReleases(ReleaseInfo releaseInfo, Boolean isInstall)
at Microsoft.Crm.Setup.Database.DatabaseInstaller.Install(Int32 languageCode, String configurationFilePath, Boolean upgradeDatabase, Boolean isInstall)
at Microsoft.Crm.Setup.Common.Update.DBUpdateDatabaseInstaller.ApplyDBUpdatesInternal(Guid orgId, String releaseFilePath)
at Microsoft.Crm.Setup.Common.Update.DBUpdateDatabaseInstaller.ApplyDBUpdates(Guid orgId)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.ApplyDBUpdates(Guid orgId, String orgUniqueName, Boolean ignoreErrors)
at Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction.Do(IDictionary parameters)
at Microsoft.Crm.Setup.Common.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
--- End of inner exception stack trace ---
at Microsoft.Crm.Setup.Common.CrmAction.ExecuteAction(CrmAction action, IDictionary parameters, Boolean undo)
at Microsoft.Crm.Setup.Common.Installer.Install(IDictionary stateSaver)
at Microsoft.Crm.Tools.Admin.OrganizationOperation.Install(IDictionary stateSaver)
at Microsoft.Crm.Tools.Admin.OrganizationUpgrader.Install(IDictionary stateSaver)
at Microsoft.Crm.Tools.Admin.OrganizationOperation.Execute()
at Microsoft.Crm.Tools.Admin.ImportOrganizationInstaller.ImportAndUpgrade(OrganizationInfo organizationInfo), ErrorCode: -2147220970, InnerException: System.Exception: Action Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction failed. ---> System.Data.SqlClient.SqlException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
The statement has been terminated.The terminated statement is in the following batch (from SQL Trace), the table EmailSearchBase has no user records:
/*
//---------------------------------------------------------------------------
// Hotfix history
// CRM SE 18083: V5: CRM 2011: The user that signed up for CRM and created
// the org cannot track emails if the primary email address is the same as that used for signing up.
// 2/25/2011 abhishg
//---------------------------------------------------------------------------
SE Bug 18083: CRM 2011: The user that signed up for CRM and created the org cannot track emails if
the primary email address is the same as that used for signing up.This issue is because provisioning a new organization clones and updates guids for the initial user.
It does not correct the rows in EmailSearch table. The problem occurs only for the initial user since he is special in the above aspect.This fix has three parts, first two are insertion query to insert "internalemailaddress" and "windowsliveid" fields respectively (becauase email serach table has
seperate rows for different email fields). The third part is to remove incorrect rows from email search table.
*/-- Insert query for InternalEmailAddress field
if(exists(select InternalEMailAddress from SystemUserBase SU1 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 15 and ParentObjectId = SU1.SystemUserId) and
InternalEMailAddress is not null))
if(exists(select SystemUserId from SystemUserBase SU2 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 15 and ParentObjectId = SU2.SystemUserId) and
InternalEMailAddress is not null))
BEGIN
Insert into EmailSearch (EmailSearchId, EmailAddress, EmailColumnNumber, ParentObjectId, ParentObjectTypeCode)
values (
NEWID(),
(select InternalEMailAddress from SystemUserBase SU3 where not exists(Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 15 and ParentObjectId = SU3.SystemUserId) and InternalEMailAddress is not null),
15,
(select SystemUserId from SystemUserBase SU4 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 15 and ParentObjectId = SU4.SystemUserId) and InternalEMailAddress is not null),
8)
END
-- End: Insert-- Insert query for WindowsLiveId field
if(exists(select WindowsLiveId from SystemUserBase SU5 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 109 and ParentObjectId = SU5.SystemUserId) and
WindowsLiveId is not null))
if(exists(select SystemUserId from SystemUserBase SU6 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 109 and ParentObjectId = SU6.SystemUserId) and
WindowsLiveId is not null))
BEGIN
Insert into EmailSearch (EmailSearchId, EmailAddress, EmailColumnNumber, ParentObjectId, ParentObjectTypeCode)
values (
NEWID(),
(select WindowsLiveId from SystemUserBase SU7 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 109 and ParentObjectId = SU7.SystemUserId) and WindowsLiveId is not null),
109,
(select SystemUserId from SystemUserBase SU8 where not exists (Select 1 from EmailSearchBase where ParentObjectTypeCode = 8 and EmailColumnNumber = 109 and ParentObjectId = SU8.SystemUserId) and WindowsLiveId is not null),
8)
END
-- End: Insert-- Delete the incorrect rows
BEGIN
Delete EmailSearchBase where ParentObjectTypeCode = 8 and not exists(select 1 from SystemUser where SystemUserId = EmailSearchBase.ParentObjectId)
END
-- End: DeleteFriday, September 2, 2011 11:21 AM
Answers
-
The process was:
- backup organization data base on CRM 4.0
- restore this backup on another SQL Server for CRM 2011
- import organization with Deployment Manager (yes, it was with deployment administrator account, we have 2 administrators accounts) -> error
- Marked as answer by MScrm CRM Tuesday, September 6, 2011 5:37 AM
Monday, September 5, 2011 7:14 AM
All replies
-
Looks like it started here.
System.Exception: Action Microsoft.Crm.Tools.Admin.InstallDatabaseUpdatesAction failed. ---> System.Data.SqlClient.SqlException: Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.
User User: 00000000-0000-0000-0000-000000000000 Looks like the first user in the organization.
So your doing an in place upgrade?
Can you tell me more regarding accounts used to install or migrate the organization to the new server?
The deployment administrator account for the 4.0 org is being used to do the upgrade, right?
Curtis J Spanburgh- Edited by Curt Spanburgh MVP ModeratorMVP, Moderator Saturday, September 3, 2011 7:37 PM
Saturday, September 3, 2011 7:19 PMModerator -
The process was:
- backup organization data base on CRM 4.0
- restore this backup on another SQL Server for CRM 2011
- import organization with Deployment Manager (yes, it was with deployment administrator account, we have 2 administrators accounts) -> error
- Marked as answer by MScrm CRM Tuesday, September 6, 2011 5:37 AM
Monday, September 5, 2011 7:14 AM -
Possible "solution" (it works): uninstall Rollup 3 for CRM2011, restore CRM 4.0 database, import organization, then install Rollup 3 again.Tuesday, September 6, 2011 5:36 AM