Search through blog..

Sunday, September 20, 2020

How to: copy databases (for D365FO tests)

First post in year 2020, I am surprised by myself that I haven't managed to make a single post this year - given that I am, like most of you, working from home for the majority of the year. 

Anyways, here comes a small tip about Copying Databases. With Dynamics 365 for Finance and operations (now a.k.a Dynamics 365 for Finance, Dynamics 365 for Supply Chain Management and also Dynamics 365 for Commerce) - you might be in need to perform several database operations during the Project implementation phases. Also you might want to take a back up of the existing database for recovery perspective. 

Below is something which I use to support with Copy actions on databases.

How to make a quick copy of AXDB hosted in Azure SQL (Tier 2 and above)

  1. To begin connect to the Azure SQL database from within the primary AOS server (AOS 01 - because this is where you would great maximum permissions to perform actions on SQL database)
  2. You should use the credentials from LCS to connect to Azure SQL database from SSMS in AOS 01
  3. Open the SQL Query window
  4. And use the below command to perform copy action

    CREATE DATABASE [Name-for-New-Copy] AS COPY OF [Database-name-of-the-Source-DB(AXDB)];

  5. Once you execute this commend, you would get a message stating that action is finished and usually SSMS is quick to give you this message
  6. However, important to understand is that this is only the trigger, the copy continues in the background
  7. You could confirm by looking at the database size of the [New copy]
  8. I usually leave it overnight

How to make a quick copy of AXDB hosted in SQL Server (Tier 1 and/or Cloud hosted environments)

  1. The easiest way is always to use the functions available in SSMS UI
  2. Connect to SQL database using SSMS in the server
  3. Usually credentials are auto-populated with the User details
  4. Right click on the [Source] database > Tasks > Copy Database


  5. Just follow the wizard 
  6. However, Important to understand that SQL Server Agent needs to be Active for this to work
  7. Another tip, if you are working with Microsoft Managed Tier-1 environment, easiest way to get around SQL Server Agent is to go to Services.msc and start the service from in there
  8. Once you are all set, Click on Finish on the Wizard and you should have copy of your database soon enough

Hope this helps. Happy DAXing.

 

No comments: