Migrate Citrix Virtual Apps and Desktop databases to a new SQL server

Migrate Citrix Virtual Apps and Desktop databases to a new SQL server

book

Article ID: CTX558936

calendar_today

Updated On:

Description

Please follow these steps.
1. Close all instances of Citrix studio. Any configuration changes (even through powershell) to be stopped while following the steps(You can power down DDCs to be extra cautious) Take VM snapshot or take backup of all Delivery Controllers.

2. Take full backup of Site, Monitor and Logging databases.
3. Restore Site, Monitor and Logging databases from backup to the new SQL server.
4. Add databases to Cluster, Always-on or Mirror (if applicable).
5. Create logons for the Delivery Controllers on new SQL server(s) and permission should like this.
-- In this example Databases are Citrix1912-LTSRSiteCitrix1912-LTSRLogging and Citrix1912-LTSRMonitoring

image.png

image.png

image.png


6. Power on all Delivery Controllers and note down DB connection Strings for Broker service and Logging and Monitor datastore.
- Open Administrator PowerShell on one Delivery Controller and execute following commands
-- Add-PSSnapin Citrix*
-- Get-BrokerDBConnection
-- Get-LogDataStore
-- Get-MonitorDataStore


image.png

7. Make sure there is no connectivity issue from Delivery Controller to new SQL Server / Cluster / Always-on Listener.
-- You can create a file with .udl extension, open it on the Delivery Controller and test connection as follows.

image.png

8. Prepare DB Connection strings to set though PowerShell. If you are using specific SQL instance and non-default SQL port connection string will be like this.
$Site = "Server=<NewSQLServer\InstanceName,CustomPortNumber>;Initial Catalog=<Site Database name>;Integrated Security=True"
$Logging = "Server=<NewSQLServer\InstanceName,CustomPortNumber>;Initial Catalog=<Logging database name>;Integrated Security=True"
$Monitor = "Server=<NewSQLServer\InstanceName,CustomPortNumber>;Initial Catalog=<Monitor database name>;Integrated Security=True"


For default instance and port connection strings will be like this.
$Site = "Server=<NewSQLServer>;Initial Catalog=<Site Database name>;Integrated Security=True"
$Logging = "Server=<NewSQLServer>;Initial Catalog=<Logging database name>;Integrated Security=True"
$Monitor = "Server=<NewSQLServer>;Initial Catalog=<Monitor database name>;Integrated Security=True"

Example:

$Site = "Server=MYSQLSERVER.DOMAIN.LOCAL;Initial Catalog=MySiteDatabase;Integrated Security=True"


9. Download the script attached and update line 85 (Step 10), 103 (Step 11), 108 (Step 12) and execute sections as instructed in the script.

10. Restart Delivery Controllers, open Studio.
11. Check VDA registration and launch.

Environment

The above mentioned sample code is provided to you as is with no representations, warranties or conditions of any kind. You may use, modify and distribute it at your own risk. CITRIX DISCLAIMS ALL WARRANTIES WHATSOEVER, EXPRESS, IMPLIED, WRITTEN, ORAL OR STATUTORY, INCLUDING WITHOUT LIMITATION WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NONINFRINGEMENT. Without limiting the generality of the foregoing, you acknowledge and agree that (a) the sample code may exhibit errors, design flaws or other problems, possibly resulting in loss of data or damage to property; (b) it may not be possible to make the sample code fully functional; and (c) Citrix may, without notice or liability to you, cease to make available the current version and/or any future versions of the sample code. In no event should the code be used to support ultra-hazardous activities, including but not limited to life support or blasting activities. NEITHER CITRIX NOR ITS AFFILIATES OR AGENTS WILL BE LIABLE, UNDER BREACH OF CONTRACT OR ANY OTHER THEORY OF LIABILITY, FOR ANY DAMAGES WHATSOEVER ARISING FROM USE OF THE SAMPLE CODE, INCLUDING WITHOUT LIMITATION DIRECT, SPECIAL, INCIDENTAL, PUNITIVE, CONSEQUENTIAL OR OTHER DAMAGES, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. Although the copyright in the code belongs to Citrix, any distribution of the sample code should include only your own standard copyright attribution, and not that of Citrix. You agree to indemnify and defend Citrix against any and all claims arising from your use, modification or distribution of the sample code.