Pages

Tuesday, January 31, 2012

CRM 2011: Cannot attach a database with same name

We had a situation where we had to move the CRM database to another server. However whenever trying to re-attach the database on the new database server (I believe the same issue would have been experienced for a database restore action), I was presented with the following error message:



This was very odd because there was in fact no other database with the same name on the database server. The error message was clearly wrong. And after I clicked Ok on the above error message, a database was still  created on the server albeit a faulty one that needed to be removed before the attach/restore action could be tried again.




To troubleshoot I tried to attach the database using the command line as follows:

USE [master]
GO
CREATE DATABASE [XXX_MSCRM] ON
( FILENAME = N'E:\SqlData\XXX_MSCRM.mdf' ),
( FILENAME = N'E:\SqlLogs\XXX_MSCRM.ldf' )
 FOR ATTACH ;
GO
And once I did so the following error message was displayed which revealed the real issue that SQL was having in trying to attach the database:


A little bit of research revealed that the issue had to do with the fact that the original database was installed on SQL Server Enterprise whereas the database I was trying to restore it on was SQL Server Standard. And the following KB article describes what the issue is and how to go about resolving:

http://support.microsoft.com/kb/2567984


In short:

  • Restore the database to another SQL Enterprise environment
  • Run the script in the above KB article
  • Backup the database and restore to a SQL Standard environment


No comments:

Post a Comment