Migrate Citrix databases to new database SQL server (cluster, Always On or Mirroring)
book
Article ID: CTX280675
calendar_today
Updated On:
Description
You can follow this article if your objective is to migrate your Citrix databases from one SQL server to another.
Instructions
1. Take a backup of Citrix Servers / Databases (note logon /user mappings to the DDC). *VERY IMPORTANT* 2. Close down Studio (Don’t make any configuration changes). 3. Power down old SQL server 4. Create new SQL server add domain and configure IP. (if not already completed) 5. Restore Citrix SQL databases from a backup to the new server. 6. Create logons for the DDC(S). Step 6 is when you are creating your new SQL database during the install you create a logon for the DDC(S) to allow them access to the database. In my Screen shot “ME” is my domain and “DDC” is my delivery controller. 7. Setting the Connection Strings to point at the new SQL server *We are doing the below steps on all DDC's* This is very important that this step is completed successfully otherwise the environment will not work correctly
You can skip this step but you will have to run the Logging command-line with "-force".
Open Administrator PowerShell Window and run the following command
Asnp Citrix* (This loads the Citrix snap-in commandlets)
Retrieve the Connection Strings for each DB
Site database = Get-BrokerDBConnection Monitoring database = Get-MonitorDBConnection –DataStore Monitor Configuration logging database = Get–LogDBConnection –DataStore Logging -Please take note of these and change for string in accordance to the new hostname Then check all services connection strings : Get-Command -Name get-*DBConnection Get-Command -Name get-*ServiceStatus - to check the status of all citrix services that communicate with DB Get-Command -Name get-*ServiceStatus | select name Next step will be to check the connection string for Logging and Monitoring Data store: Get-LogDataStore Get-MonitorDataStore After we found out all these names we have to change all connection strings to $null. Set-AcctDBConnection -DBConnection $null Set-AnalyticsDBConnection -DBConnection $null Set-AppLibDBConnection -DBConnection $null Set-BrokerDBConnection -DBConnection $null Set-ConfigDBConnection -DBConnection $null Set-EnvTestDBConnection -DBConnection $null Set-HypDBConnection -DBConnection $null Set-OrchDBConnection -DBConnection $null Set-ProvDBConnection -DBConnection $null Set-SfDBConnection -DBConnection $null Set-TrustDBConnection -DBConnection $null Set-MonitorDBConnection -Datastore Monitor -DBConnection $null Set-MonitorDBConnection -DBConnection $null Set-LogDBConnection -Datastore Logging -DBConnection $null Set-LogDBConnection -DBConnection $null Set-AdminDBConnection -DBConnection $null If you will encounter any error while running those commands you should run again the failing commands, with -force. For example, let's say that you encounter an error while running the following command: Set-MonitorDBConnection -Datastore Monitor -DBConnection $null In order to fix that, you should just run the same command-line followed by -force. Set-MonitorDBConnection -Datastore Monitor -DBConnection $null -force Finally, copy in notepad the following connection strings and run them in this order:
# Site DB $cs = "Server=SQL;Initial Catalog=CitrixticSite;Integrated Security=True" # Logging DBget $csl = "Server=SQL;Initial Catalog=CitrixticLogging;Integrated Security=True" # Monitor DB $csm = "Server=SQL;Initial Catalog=CitrixticMonitoring;Integrated Security=True"
Set-AdminDBConnection -DBConnection $cs Set-AcctDBConnection -DBConnection $cs Set-AnalyticsDBConnection -DBConnection $cs Set-AppLibDBConnection -DBConnection $cs Set-BrokerDBConnection -DBConnection $cs Set-ConfigDBConnection -DBConnection $cs Set-EnvTestDBConnection -DBConnection $cs Set-HypDBConnection -DBConnection $cs Set-OrchDBConnection -DBConnection $cs Set-ProvDBConnection -DBConnection $cs Set-SfDBConnection -DBConnection $cs Set-TrustDBConnection -DBConnection $cs Set-LogDBConnection -DBConnection $cs Set-LogDBConnection -Datastore Logging -DBConnection $null Set-LogDBConnection -Datastore Logging -DBConnection $csl Set-MonitorDBConnection -DBConnection $cs Set-MonitorDBConnection -Datastore Monitor -DBConnection $null Set-MonitorDBConnection -Datastore Monitor -DBConnection $csm All this connections strings that we are trying to change via PowerShell are found in Registry, on the DDC, under HKLM\SOFTWARE\Citrix\XDservices andHKEY_LOCAL_MACHINE\SOFTWARE\Citrix\DesktopServer\DataStore\Connections\Controller