Wednesday, March 4, 2020

Checklist for restore bacpac file in d365 database

CC DEV box – Database refresh

Pass     Fail  
Data via wetransfer.com as a bacpac file, put it in your Temp folder (This will be replaced by download from LCS Asset Library soon)

   


Tasks

Copy {EnterFileName}.backpac file to C:\temp\{EnterFileName}.backpac
   
To install, run PowerShell as administrator, then run these two commands one at a time: (replace parameters with local values)


PowerShell (PS) Script commands

Install-Module -Name d365fo.tools  -Force -AllowClobber

   
Install-Module -Name SQLServer  -Force -AllowClobber

   
Import-D365Bacpac -ImportModeTier1 -BacpacFile "c:\temp\{EnterFileName}.bacpac" -NewDatabaseName "AxDB_NewCopy" -SqlUser "AxDBAdmin" -SqlPwd "AOSWebSite@123"
This Takes a LONG Time… be patient
WARNING: [14:46:27][Set-SqlBacpacValues] Stopping because of errors
   
Stop-D365Environment
Stop D365 services and WWW services in services.msc
   
SQL Management Studio

Rename Existing AxDB to AXDB_yyyyMMDD via right click rename command
   
Rename AXDB_NewCopy to AXDB via right click rename command

   
--set main db to single connections and drop the existing connections
ALTER DATABASE AxDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE

--rename datbase to db_old
ALTER DATABASE AxDB MODIFY NAME = AxDB_20190319

--set the old db to multi user
ALTER DATABASE AxDB_20190319 SET MULTI_USER

--rename datbase to db_old
ALTER DATABASE AxDB_NewCopy MODIFY NAME = AxDB
   
PowerShell

Sync the DB w/ PS:
Invoke-D365DBSync -Verbose
This Takes a LONG Time… be patient
   
Start-D365Environment
   
SQL Management Studio

If needed DROP Database AXDB_yyyyMMDD to save space
   
Desktop

Run Provisioning Tool from desktop to add your email account as an adminuser
   


If you are running low on Disk Space, You will need to do the following:
Delete values on large tables container Log / Execution History files no longer needed


BatchHistory
BatchJobHistory
DMFExecution
DMFExecutionHistoryLog
Use SQL tasks to Shrink DB Files Tasks\Shrink\Files
You may have to re-provision size of DB Files
Re-index DB for table with highly fragmented indexes


DB> Task> Shrink> Files:  Log> Reorg> Shrink file to 0


Some times these issues are faced after followed above steps.





Track the exact information error in event viewer log.
1.       Regarding  D365 services in services, we got below error message in event viewer log

The description for Event ID 110 from source Microsoft Dynamics 365 for Finance and Operations, Enterprise edition cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

AX is shutting down due to an error.
Failed to open SQL connection
Exception details:
Microsoft.Dynamics.AX.InitializationException: Failed to open SQL connection
   at Microsoft.Dynamics.AX.AOS.StartupInternal(String[] Arguments)
   at Microsoft.Dynamics.AX.AOS.Startup()
   at Microsoft.Dynamics.AX.AosConfig.AzureConfig.Init()
   at Microsoft.Dynamics.AX.Batch.BatchService.OnStart(String[] args)


2.       Regarding Administrator provisioning, we got below error message.

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.

So we googled it and found the solution is that need to start services couple of SQL services (SQL Server browser and SQL server agent) and restarted it. Now we got below error messages.

Failed to create a metadata service client in 5 attempts.
                Machine: CIT-US-D365-199
Metadata service communication retry attempts failed to resolve issues with the following settings AX7CertificateUserName: FRServiceUser@dynamics.com; AX7CertificateThumbprint: 2C669BD45BB8A0305F4F962A175FF4FD6B4CAD7C; AX7FederationRealm: spn:00000015-0000-0000-c000-000000000000; AX7ProviderName: https://mintedtoken.dynamics.com; AX7TokenIssuer: https://fakeacs.accesscontrol.windows.net/   
                Component: Microsoft.Dynamics.Integration.Common.TraceLog
                User: NT AUTHORITY\NETWORK SERVICE
                Machine: CIT-US-D365-199
The description for Event ID 110 from source Microsoft Dynamics 365 for Finance and Operations, Enterprise edition cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

AX is shutting down due to an error.
Failed to open SQL connection
Exception details:
Microsoft.Dynamics.AX.InitializationException: Failed to open SQL connection
   at Microsoft.Dynamics.AX.AOS.StartupInternal(String[] Arguments)


The description for Event ID 140 from source Dynamics Server Azure cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

If the event originated on another computer, the display information had to be saved with the event.

The following information was included with the event:

Object Server Azure:
The internal time zone version number stored in the database is higher than the version supported by the kernel (13/12). Use a newer Microsoft Dynamics 365 for Finance and Operations kernel.




Solution :

Old DB:


New DB:


So I ran this on the New DB:
UPDATE SQLSYSTEMVARIABLES SET VALUE = 145 WHERE PARM = 'SYSTABVERSION'
UPDATE SQLSYSTEMVARIABLES SET VALUE = 12 WHERE PARM = 'SYSTIMEZONESVERSION'

I am now able to start the batch service and apply an ID.





See section : Restore the backup to a new database in the DevTSA.doc for me details:


No comments:

Post a Comment

Finacial dimensions using ledger dimension / main account

Select * from objMainAccount  inner join                from objDimensionAttributeValueCombination                  where objDimensionAttrib...