In this blog I will show you all the steps it took for me to migrate an CRM 4.0 organization to CRM 2011:
1. Created backups of my CRM 4.0 organization DB and report server DB
2. Imported backups on target environment / SQL Server
3. Connected report server instance to my imported CRMReports DB
4. Restored the SSRS encryption key (you need a password for your encryption key file)
5. Within the CRMReports DB in the table "Key" I deleted multiple entries so that it should look like this:
6. Started the Deployment Manager:
7. Started to import organization:
8. Selected my restored CRM 4.0 organization DB
9. Finished auto-mapping of AD-users and replaced one of the old CRM administrator accounts with my current new administrator account (might not be important for you).
10. Clicked next and started the migration.
11. Error appeared:
12:42:11| Error| Exception occured during Microsoft.Crm.Tools.Admin.OrganizationUpgrader: Fehler bei der Aktion Microsoft.Crm.Tools.Admin.UpgradeDatabaseAction.
InnerException:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'.
12. SQL-Profiler identified the following entry:
Error: 2627, Severity: 14, State: 1 => Siehe Fehlermeldung oben.
SQL Statement:
exec sp_executesql N'INSERT INTO [LocalizedLabel] ( [LocalizedLabelId],
[LanguageId], [ObjectId], [ObjectColumnName], [Label], [LabelTypeCode], [ComponentState], [SolutionId], [OverwriteTime] ) VALUES ( @LocalizedLabelId,
@LanguageId, @ObjectId, @ObjectColumnName, @Label,
@LabelTypeCode, @ComponentState, @SolutionId,
@OverwriteTime )',N'@LocalizedLabelId uniqueidentifier,@LanguageId int,@ObjectId uniqueidentifier,@ObjectColumnName nvarchar(11),@Label nvarchar(79),@LabelTypeCode int,@ComponentState int,@SolutionId uniqueidentifier,@OverwriteTime datetime',@LocalizedLabelId='1F9A4FA5-C029-4F7E-B2C2-2C63194C3D11',@LanguageId=1031,@ObjectId='B1C70485-BA33-4C5F-8710-5446E3F68CA7',@ObjectColumnName=N'Description',@Label=N'Organisationseinstellungen, die in der Organisationsdatenbank gespeichert sind.',@LabelTypeCode=1,@ComponentState=0,@SolutionId='FD140AAD-4DF4-11DD-BD17-0019B9312238',@OverwriteTime='1900-01-01 00:00:00'
A search in Google gave me this:
Solution is to query the following statement:
UPDATE [Organisation_MSCRM].[MetadataSchema].[LocalizedLabel]
SET [LanguageId] = 1031
WHERE [ObjectId]='B1C70485-BA33-4C5F-8710-5446E3F68CA7'
13. After this error I had to restore my old DB because the migration stopped at this point.
I restored the DB with the "WITH REPLACE" option.
14. I had to repeat everything from step 6 and prepare the DB with the statement above before starting the migration again.
15. After doing this the import went through almost successfull.
I got the following error message:Performing GrantServiceAccountAccess on SqlServerName MUCDEVCRMDB01 where SqlServerMachineName=MUCDEVCRMDB01,
reportServerUrl=http://mucdevcrmdb01/reportserver
20:21:45
Error
An error occurred when trying import and upgrade organization database MUCDEVCRMDB01.Alegri_MSCRM:
System.Data.SqlClient.SqlException (0x80131904): The login already has an account under a different user name.
This message is called in the following method found in the stacktrace:
Microsoft.Crm.Setup.Server.Utility.SqlUtility.GrantSrsServiceAccountAccess
Microsoft.Crm.Setup.Database.Helpers.GrantCrmReaderAccessToNetworkService
Microsoft.Crm.Setup.Database.Helpers.GrantCrmReaderAccess
Microsoft.Crm.Setup.Database.DatabaseUtility.CreateUser
Microsoft.Crm.Setup.Database.SharedDatabaseUtility.CreateUser ======> ERROR
After some time of research I found out that CRM tries to add a user account to the SQL Server or CRM DB which was already there and existing.
As this was the only reason of the migration to fail I continued with a workaround (see next steps).
16. As the import/migration was interrupted through the error above the imported organization had the Status(State) of "Pending". This means the import was basically successfull but could not be finished and activated.
17. Workaround: manual activation of the organization
- Opened MS SQL Management Studio
- Opened the MSCRM_CONFIG DB
- Opened the table dbo.Organizisation in Edit-mode.
- Went to the row where my organization was and changed the State from 2 (pending) to 1 (activated).
- Back in the deployment manager I hit the "Refresh"-button and there you go -> the organization is activated.
- To make sure the manual activation was done right I disabled the organization via the UI and reactivated it because I stil don't know if with this action other modifications than the change of the State-column are happening.
18. Voilá the migration was successfully done and my CRM 4.0 organization is now running under CRM 2011.
(19.) Next steps would be to verify if all plugins, customizations (Javascript, custom webs) and reports are still working. In the meantime, I was able to fix some issues with custom webs and plugins. But this would be material for another blog.
1. Created backups of my CRM 4.0 organization DB and report server DB
2. Imported backups on target environment / SQL Server
3. Connected report server instance to my imported CRMReports DB
4. Restored the SSRS encryption key (you need a password for your encryption key file)
5. Within the CRMReports DB in the table "Key" I deleted multiple entries so that it should look like this:
6. Started the Deployment Manager:
7. Started to import organization:
8. Selected my restored CRM 4.0 organization DB
9. Finished auto-mapping of AD-users and replaced one of the old CRM administrator accounts with my current new administrator account (might not be important for you).
10. Clicked next and started the migration.
11. Error appeared:
12:42:11| Error| Exception occured during Microsoft.Crm.Tools.Admin.OrganizationUpgrader: Fehler bei der Aktion Microsoft.Crm.Tools.Admin.UpgradeDatabaseAction.
InnerException:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.Data.SqlClient.SqlException: Violation of PRIMARY KEY constraint 'XPKLocalizedLabel'. Cannot insert duplicate key in object 'MetadataSchema.LocalizedLabel'.
12. SQL-Profiler identified the following entry:
Error: 2627, Severity: 14, State: 1 => Siehe Fehlermeldung oben.
SQL Statement:
exec sp_executesql N'INSERT INTO [LocalizedLabel] ( [LocalizedLabelId],
[LanguageId], [ObjectId], [ObjectColumnName], [Label], [LabelTypeCode], [ComponentState], [SolutionId], [OverwriteTime] ) VALUES ( @LocalizedLabelId,
@LanguageId, @ObjectId, @ObjectColumnName, @Label,
@LabelTypeCode, @ComponentState, @SolutionId,
@OverwriteTime )',N'@LocalizedLabelId uniqueidentifier,@LanguageId int,@ObjectId uniqueidentifier,@ObjectColumnName nvarchar(11),@Label nvarchar(79),@LabelTypeCode int,@ComponentState int,@SolutionId uniqueidentifier,@OverwriteTime datetime',@LocalizedLabelId='1F9A4FA5-C029-4F7E-B2C2-2C63194C3D11',@LanguageId=1031,@ObjectId='B1C70485-BA33-4C5F-8710-5446E3F68CA7',@ObjectColumnName=N'Description',@Label=N'Organisationseinstellungen, die in der Organisationsdatenbank gespeichert sind.',@LabelTypeCode=1,@ComponentState=0,@SolutionId='FD140AAD-4DF4-11DD-BD17-0019B9312238',@OverwriteTime='1900-01-01 00:00:00'
A search in Google gave me this:
Solution is to query the following statement:
UPDATE [Organisation_MSCRM].[MetadataSchema].[LocalizedLabel]
SET [LanguageId] = 1031
WHERE [ObjectId]='B1C70485-BA33-4C5F-8710-5446E3F68CA7'
13. After this error I had to restore my old DB because the migration stopped at this point.
I restored the DB with the "WITH REPLACE" option.
14. I had to repeat everything from step 6 and prepare the DB with the statement above before starting the migration again.
15. After doing this the import went through almost successfull.
I got the following error message:Performing GrantServiceAccountAccess on SqlServerName MUCDEVCRMDB01 where SqlServerMachineName=MUCDEVCRMDB01,
reportServerUrl=http://mucdevcrmdb01/reportserver
20:21:45
Error
An error occurred when trying import and upgrade organization database MUCDEVCRMDB01.Alegri_MSCRM:
System.Data.SqlClient.SqlException (0x80131904): The login already has an account under a different user name.
This message is called in the following method found in the stacktrace:
Microsoft.Crm.Setup.Server.Utility.SqlUtility.GrantSrsServiceAccountAccess
Microsoft.Crm.Setup.Database.Helpers.GrantCrmReaderAccessToNetworkService
Microsoft.Crm.Setup.Database.Helpers.GrantCrmReaderAccess
Microsoft.Crm.Setup.Database.DatabaseUtility.CreateUser
Microsoft.Crm.Setup.Database.SharedDatabaseUtility.CreateUser ======> ERROR
After some time of research I found out that CRM tries to add a user account to the SQL Server or CRM DB which was already there and existing.
As this was the only reason of the migration to fail I continued with a workaround (see next steps).
16. As the import/migration was interrupted through the error above the imported organization had the Status(State) of "Pending". This means the import was basically successfull but could not be finished and activated.
17. Workaround: manual activation of the organization
- Opened MS SQL Management Studio
- Opened the MSCRM_CONFIG DB
- Opened the table dbo.Organizisation in Edit-mode.
- Went to the row where my organization was and changed the State from 2 (pending) to 1 (activated).
- Back in the deployment manager I hit the "Refresh"-button and there you go -> the organization is activated.
- To make sure the manual activation was done right I disabled the organization via the UI and reactivated it because I stil don't know if with this action other modifications than the change of the State-column are happening.
18. Voilá the migration was successfully done and my CRM 4.0 organization is now running under CRM 2011.
(19.) Next steps would be to verify if all plugins, customizations (Javascript, custom webs) and reports are still working. In the meantime, I was able to fix some issues with custom webs and plugins. But this would be material for another blog.
Do you have Customized Reports?
ReplyDeleteHow Can I Import my Customized Reports?
We had customized reports. They were migrated in the migration process. Otherwise you need to export the RDLs and import them later manually or via custom code.
ReplyDelete