Restore UAT DB in Teir 1 Using DFO Tool
Here's how you can restore the UAT DB in Tier 1 using the DFO tool script:
- Open Windows PowerShell ISE.
- Run the below command:
Write-Host "Get bacpac"
$currentDate = Get-Date -Format yyyyMMdd
$downloadPath = "J:\MSSQL_BACKUP\MockGL{0}.bacpac" -f $currentDate
$newDBName = "AxDB_{0}" -f $currentDate
Invoke-D365AzCopyTransfer -SourceUri "https://d365opsastey7emzowmgccv.blob.core.windows.net/81943951-e06d-4a0a-8780-6d12458ef954-c4a28672/0qRPInM8fa2QNEE7z0aNj9?skoid=9ef30196-cd78-4a47-955e-89a3947f0a23&sktid=975f013f-7f24-47e8-a7d3-abc4752bf346&skt=2024-01-17T12%3A35%3A23Z&ske=2024-01-20T13%3A35%3A23Z&sks=b&skv=2023-11-03&sv=2023-11-03&st=2024-01-17T12%3A35%3A23Z&se=2024-01-20T13%3A35%3A23Z&sr=b&sp=r&sig=abevcO9TIFnvzEZRxzYv6KZJhoDIcxF%2Fq0nFva5bluw%3D" -DestinationUri $downloadPath
Write-Host "Update model file"
$path = "J:\MSSQL_BACKUP\model\model.xml"
$pathUpdated = "J:\MSSQL_BACKUP\model\model_updated.xml"
Export-D365BacpacModelFile -Path $downloadPath -OutputPath $path
Get-Content -Path $path | ForEach-Object {$_.Replace('<Property Name="AutoDrop" Value="True" />','')} | Add-Content -Path $pathUpdated
Write-Host "Import Bacpac"
Import-D365Bacpac -ImportModeTier1 -BacpacFile $downloadPath -ModelFile $pathUpdated -NewDatabaseName $newDBName -ShowOriginalProgress -Verbose
Write-Host "Stop all AX Services"
Stop-D365Environment -All
Write-Host "Waiting 60 seconds, just to make sure that all services are really stopped..."
Start-Sleep -Seconds 60
Switch-D365ActiveDatabase -SourceDatabaseName $newDBName
Write-Host "Start DB Sync"
Invoke-D365DBSync -ShowOriginalProgress
Write-Host "Start all AX Services"
Start-D365Environment -All
Write-Host "Waiting 60 seconds, just to make sure that all services are really started..."
Start-Sleep -Seconds 60
Write-Host "Enable users"
Get-D365User -ExcludeSystemUsers | Enable-D365User
===================================================================
This will helps to restore the DB and sync also and also enable all the user
Comments
Post a Comment