Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. $bacpacFile = 'D:\Backup\sandbox_adhoc.bacpac'
  2.  
  3. $sourceDatabaseName = "AxDB_Source_$(Get-Date -UFormat "%y%m%d%H%M")"
  4.  
  5.  
  6.  
  7. #Remove any old temp source DB
  8.  
  9. Remove-D365Database -DatabaseName $sourceDatabaseName -Verbose
  10.  
  11.  
  12.  
  13. #Stop local environment components
  14.  
  15. Stop-D365Environment -All
  16.  
  17.  
  18.  
  19. # Import the bacpac to local SQL Server
  20.  
  21. Import-D365Bacpac -ImportModeTier1 -BacpacFile $bacpacFile -NewDatabaseName $sourceDatabaseName -Verbose
  22.  
  23.  
  24.  
  25. #Remove any old AxDB backup (if exists)
  26.  
  27. Remove-D365Database -DatabaseName 'AxDB_original' -Verbose
  28.  
  29.  
  30.  
  31. #Switch AxDB with source DB
  32.  
  33. Switch-D365ActiveDatabase -DatabaseName 'AxDB' -NewDatabaseName $sourceDatabaseName -Verbose
  34.  
  35.  
  36.  
  37. Start-D365Environment -All
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement