XenDesktop: Database could not be contacted

After installing Hotfix Update 4 for XenDesktop 5.6 I noticed errors in my eventviewer that the connection to the database was lost. I discovered the errors because I couldn’t create Desktop Groups, I keep getting the error: “Database could not be contacted“.

 Eventviewer

 After some searching I found that the database needs to be updated because of a minor version. The hotfix update 4 descriptions mentions the update of the datastore but normally you receive an update button whit in the Desktop Studio, but this one I didn’t receive.

Update Notes:

Caution: This section does not apply to customers who are upgrading from Hotfixes Update 3*; it does apply to all other customers: By design, the Broker hotfix (XD560BrokerSvc) included in this release modifies the DbSchema of your data store database (the “data store.”) This modification is permanent and irreversible. Should you decide, for any reason, to uninstall the Broker hotfix at a later time, these modifications will not automatically be reverted. As a matter of precaution, Citrix recommends strongly that you back up your data store before installing this hotfix. Doing so allows you to manually restore your data store to the backed up version. Even so, any changes you make to the data store between backing up and restoring it will be lost. For information about backing up and restoring your data store, see Knowledge Center article CTX135207.
* If you installed Hotfixes Update 3, the DbSchema of your data store database was updated on occasion of that installation. No further updates to the data store database will occur when you install Hotfixes Update 4.

To check the version of the database I used the following commands within Powershell:

Get-BrokerInstalledDBVersion –Upgrade
 Get-BrokerInstalledDBVersion

Which gave me the following output:

Versions before update

As you can see the Revision number is different, there are two updates available (revision 1 and 2) and the version of the production database was Revision 0 or 5.6.0.0.

To update the database revision I created an update script that I could use within SQL, to create the update script I used the following command within Powershell:

$update = Get-brokerdbversionchangescript –databasename mydatabasename –targetversion 5.6.0.2
$update.script >C:\upgrade.sql

This created an SQL script which I executed on the SQL server, and updated the Database. Before executing the script I created a backup of the database using the following article: http://support.citrix.com/article/CTX135207 and stopped the “Citrix Broker Service” on the Desktop Delivery Controller.

SQL: Database update

 After the script was executed I restarted the Citrix services on the Desktop Delivery Controller and checked the eventlog and also database version using Powershell and found that the database was having the appropriate version.

Version info after Upgrade

 Now I could create the Desktop Groups without having the error that the “Database could not be contacted”.

  • Luis Eduardo Torres

    Thanks for your help.

banner