Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Copying Data From Prod To Test Site

(1) ShareShare
ReportReport
Posted on by 245

We want to copy data from Prod To Test CRM site (on premise). We have only one CRM server and only one SQL server for Test and Prod. So we created two organizations in CRM, one for Prod and one for Test.

I have searched online and I found that we can take the backup of Prod DB and then restore it with different name in SQL Server, and then create a new organization using that new DB. My Question is, will it cause any problem as we will have two same databases with different names for Prod and Test on same SQL server? I am asking this because I know that CRM uses OrganizationID also for accessing the DB. And in our case we will have two databases (Prod and copy of Prod) with same OrganizationID on the same server. 

Yesterday, we tried to take backup for Prod DB and restored it and renamed it to same as Test DB but when we tried to access the Test CRM site, it gave the error: "The organizationid - 652493e3-31c0-42b0-ba66-f03067d2eb07 is missing or invalid ; stack trace :    at Microsoft.Crm.Caching.OrganizationBaseLanguageCacheLoader.GetBaseLanguage(Guid key, SqlExecutionContext context)"

6014.CRM-Error.jpg

Please Help!

Sam

*This post is locked for comments

  • SamCRM1 Profile Picture
    SamCRM1 245 on at
    RE: Copying Data From Prod To Test Site

    Thank you so much. I followed all the steps you explained and it worked!.

  • Verified answer
    RaviKashyap Profile Picture
    RaviKashyap 55,410 Moderator on at
    RE: Copying Data From Prod To Test Site

    Hi,

    Yes, you could do this using by creating a backup of your prod db and imorting organization using that db back up. You can refer the below blog for detailed steps with screenshot.

    Note that when you import the organization, it will create a new crm organization, it won't update the existing organization. So if you have created a new organization for your test then don't use that.

    www.cobalt.net/.../how-to-back-up-and-restore-a-database-in-a-crm-organization

    Hope this helps.

  • SamCRM1 Profile Picture
    SamCRM1 245 on at
    RE: Copying Data From Prod To Test Site

    Thank you so much for your help John. We will try it today after working hours when no one will be using CRM.

  • Verified answer
    John Hoven Profile Picture
    John Hoven 360 on at
    RE: Copying Data From Prod To Test Site

    Hi Sam,

    Yes, that should be OK.

    1) Backup your production database.

    2) Restore to a different database name.

    3) Import it through Deployment Manager.

    As mentioned, this import process will do various things (including actually changing the Organization Id as needed to make it unique within your CRM deployment/server).

    When "refreshing" the copy, the steps will roughly be: 1) delete the copy from Deployment Manager 2) delete the database copy from SQL and 3) repeat the steps above to bring in a new copy.  

    Note to be careful deleting databases that you have adequate backups and are targeting the right database!

    Thanks,

    John

  • SamCRM1 Profile Picture
    SamCRM1 245 on at
    RE: Copying Data From Prod To Test Site

    Hello John,

    Thank you so much for your reply. It is really helpful. I have one more question, we have both Prod site and test site on the same CRM server and databases are also on same SQL server. Will it be ok if we import the same database again on the same server? Will it not cause any problem as we will be importing same database again as it already exists. Even if we give it different name, are the things like OrganizationID going to cause any problems?

    Thank you.

  • Verified answer
    John Hoven Profile Picture
    John Hoven 360 on at
    RE: Copying Data From Prod To Test Site

    Hi Sam,

    When you restore a database from a backup, you must import it using the Dynamics 365 Deployment Administrator (on the Dynamics 365 Server).  That wizard and import process will clean up some settings in that database to work with the new installation (things like publishing reports, fixing database security, etc.).

    Each installation has its own MSCRM_Config database for server-level settings.  Each CRM database has an OrganizationId (select OrganizationId from dbo.Organization).  Your original "TEST" database has an OrganizationId like 00000000-0000-0000-0000-000000000000.  Your original "PROD" database has an OrganizationId like 55555555-5555-5555-5555-555555555555.  The problem at this point is the CRM database on your test server now has an ID of  55555555-5555-5555-5555-555555555555, but the Id registered in MSCRM_CONFIG is 00000000-0000-0000-0000-000000000000.  So, CRM doesn't know how to find settings.

    Do NOT try to fudge the Ids!  This is just an example and you'll be opening a rabbit hole of problems.  Just delete the organization from Deployment Manager and re-import it. 

    A user who is a "Deployment Administrator" must run the tool.  Originally, that would be limited to the domain account who installed the CRM server.  That account can add additional users from the program.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,409 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans