Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск Все разделы прочитаны

Опции темы Поиск в этой теме Опции просмотра
Старый 27.05.2020, 19:11   #1  
Blog bot is offline
Blog bot
24,298 / 817 (76) +++++++
Регистрация: 28.10.2006
Rahul Sharma: Dynamics 365 finance database import export operations - bacpac - SqlPackage.exe

Applies to:
  • Dynamics 365 Finance
  • Dynamics 365 Supply Chain Management
  • Dynamics 365 Commerce
This is a quick post on how to run Dynamics 365 Sandbox backup/restore operations that involve moving bacpac files. We are specifically going to check on SqlPackage command.

Sometimes we want to export sandbox database and/or import the exported sql bacpac file to a non-sandbox environment. For example; export the database backup from gold environment and import it into UAT or conversion environment etc.
How to import or export a SQL bacpac file from Dynamics 365

Below are some of the steps and commands to accomplish the same.
Export the database

Backup sandbox database to LCS Asset Library

On sandbox environments, application uses Azure SQL Database. You can use LifeCycle Services (LCS) to export the copy of a sandbox UAT environment and the process will save it into the asset library.

Backup non-sandbox database to LCS Asset Library

On non-sandbox environments, application uses local SQL Server. You can use command prompt to export database backup as a bacpac file.
Create a copy of database

You should create a copy of the database by using backup and restore options from Microsoft SQL Server Management Studio (SSMS) or using below t-sql commands that will generate a new database. We create copy of the database so that we can work on it instead of the actual source database, as we will be deleting database users from this database before creating the bacpac file.

Prepare the database

Run the following script against the newly created database "AxDB_CopyForExport".

Export the database as bacpac file

Open a Command Prompt window, and run the following commands.

Once you have the bacpac file, upload it to LCS Asset Library section.
Import the database

Restore to sandbox environment

You can restore the bacpac file from the LCS using database movement options.

Restore to non-sandbox environment

You can use the below command to import the bacpac file as a new a database.
We will not overwrite the existing database but will import it as a new database AxDb_fromUAT.

Update the database

You need to run the below script to add the database users back that we deleted earlier while exporting.

Turn on change tracking

Use the new database

To switch database, from old to the new database, first stop the following services:
  • World Wide Web Publishing Service
  • Microsoft Dynamics 365 Unified Operations: Batch Management Service
  • Management Reporter 2012 Process Service
After these services have been stopped, rename the AxDB database as AxDB_orig, rename your newly imported database to AxDB, and then restart the three services.

That's all for database export/import for today.

If you like the story, please support by sharing and posting your comments / feedback / queries.

Join me on facebook | twitter | linkedin !!!


Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Rahul Sharma: How to debug Dynamics 365 Finance production or UAT database Blog bot DAX Blogs 0 21.05.2020 23:11
sinedax: Synchronize the database manually - Dynamics 365 for Finance & Operations On Premises Installation Blog bot DAX Blogs 0 27.02.2018 02:13
survivingcrm: What’s An “App” in Dynamics 365 Anyway? Blog bot Dynamics CRM: Blogs 0 06.01.2018 22:14
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 13 Blog bot Dynamics CRM: Blogs 0 27.03.2013 22:12
german_nav_developer: Buildnummern-Übersicht Microsoft Dynamics 5.0 Service Pack 1 Blog bot Dynamics CRM: Blogs 0 04.06.2010 12:51
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Часовой пояс GMT +3, время: 10:04.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.