How to Backup and Restore your XenApp/XenDesktop Database

  • CTX135207
  • Created onMar 26, 2014
  • Updated onSep 10, 2014
Article Topic Configuration


This article describes how to back up and restore a XenDesktop database on Microsoft SQL Server.


This article assumes you are an SQL administrator with basic knowledge of SQL Server or appropriate resources to assist with the execution of the SQL statement command.


When using Microsoft SQL Server, consult the Database Server product documentation for scheduling automated backups of the data store. In most cases, daily backup is sufficient to prevent loss of farm data.



The following process describes how to perform a one-time, manual backup. It does not prevent the need to perform scheduled backups of the database. This backup captures a snapshot of the database at that time it is performed. It is recommended that no administrative changes be performed while the backup is in progress.

Complete the following procedure:

  1. Verify the name of the database and database server that is currently used by starting PowerShell from the Desktop Studio Console.
    User-added image

  1. Run the following command:  Get-BrokerDBConnection to get the name of the database server/Data Source and the Database/Initial Catalog name.
    Example 1
    PS C:\> Get-BrokerDBConnection
    Server=;Database= CitrixXenDesktopDB ;Trusted_Connection=True"

    Example 2
    PS C:\> Get-BrokerDBConnection
    Data Source=SQLServer; Failover Partner=SQLServer2; Initial Catalog=CitrixXenDesktopDB; Integrated Security=True; Network=dbmssocn

  1. Connect to the SQL server and open the Microsoft SQL Server Management Studio.     

  2. Connect to the Database Engine.
    User-added image

  1. Expand the Databases node for your server and navigate to the database identified in Step 2.
    User-added image

  1. Right-click database, select Tasks > Back Up.
    User-added image

  1. Verify that the backup type is set to Full and verify the information listed. There is an option you can leverage to verify the backup when finished.
    User-added image

  1. Cick OK and ensure that the backup completed successfully.
    User-added image

See Creating Full and Differential Backups of a SQL Server Database.



  • Remove any hotfixes applied after the backup before performing the restore.

  • As a precaution, back up the present database before the restore.

The following process describes how to perform a restore from the backup done in the previous section. This process returns the database to the point in time when the backup was performed. Any changes made after that point in time will be lost.

Complete the following procedure: 

  1. Connect to the Database Engine.
    User-added image

  1.  Expand the Databases node for your server and navigate to the name of your XenDesktop database.
    User-added image

  1. Right-click database, select Tasks Restore > Database
    User-added image

  1. Select the backup set that you want to restore from the list or go to the next step on how to select a file.
    User-added image

    The source can be changed to From device then select the browse “…” icon
    User-added image

  1. Select Add to locate the backup file from its folder.
    User-added image

  1. Ensure the correct backup set is selected then click Options.
    User-added image

  1. From Options , click Overwrite the existing database and Restore with recovery.
    User-added image

  1. Click OK.
    User-added image

  1. Restart Each Broker.

  2. From each broker, open  a PowerShell prompt and run the following commands to verify the status of each service:

    Add-PSSnapin Citrix.*

    Note: Verify that all preceding commands have returned a result of OK.  If a result other than OK is returned for any of these commands, it might be necessary to enable logging or tracing to determine the cause of the connection failure.

  1. Use the XDDBDiag utility - CTX128075 - XDDBDiag for XenDesktop  to verify the consistency of the database after the restore. If any Virtual Desktop Agents were running when the DDC services were shut down in Step 1, it could take up to 10 minutes before the Virtual Desktop Agents reregister. No other action is required.

  2. Read to the Desktop groups all changes including catalogs, hosts, or assignments made after the backup date.


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 of 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 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 code.

Applicable Products

Automatic translation

Important: Non-English versions of this article are translated by an automatic translation system (also referred to as Machine Translation, or MT) and have not been translated or reviewed by a person. Citrix offers a machine translated version of this article to allow for greater access to the support content. However, automatic translation is not always perfect and may contain vocabulary, syntax or grammar errors. Citrix is not responsible for inconsistencies, errors or damage incurred as a result of the use of machine translated articles. Thank you.

Traduction automatique

Important : cet article a été traduit par un système de traduction automatique (également appelé Traduction automatique ou TA) et n'a pas été vérifié par des spécialistes. Citrix propose une traduction automatique de cet article afin de permettre à toute personne ne maîtrisant pas l'anglais d'accéder au contenu de l'assistance. Toutefois, la traduction automatique n'étant pas parfaite, elle peut contenir des erreurs de terminologie, de syntaxe ou de grammaire. Citrix n'est pas responsable des incohérences, erreurs ou dommages pouvant résulter de l'utilisation par nos clients d'articles TA.

Automatische vertaling

Belangrijk: Dit artikel is vertaald door een automatisch vertalingssysteem (ook Machine Translation of MT genoemd) en is niet vertaald of beoordeeld door mensen. Citrix biedt een machine-vertaalde versie van dit artikel aan om een betere toegang mogelijk te maken tot de support-inhoud. Automatisch vertalen werkt echter niet altijd perfect en het resultaat kan fouten bevatten in de woordkeuze, syntaxis of grammatica. Citrix is niet verantwoordelijk voor inconsistenties, fouten of schade als gevolg van het gebruik van MT-artikelen door onze klanten.

Maschinelle Übersetzung

Wichtig: Dieser Artikel wurde mit einem maschinellen Übersetzungssystem und ohne jegliche Bearbeitung durch Personen übersetzt. Citrix bietet maschinelle Übersetzungen von Artikeln an, damit Benutzer umfassenden Zugriff auf Support-Inhalte haben. Maschinelle Übersetzungen enthalten jedoch möglicherweise Fehler in Bezug auf Terminologie, Syntax und Grammatik. Citrix übernimmt keine Verantwortung für Inkonsistenzen, Fehler oder Schäden, die aus der Verwendung von maschinell übersetzten Artikeln durch Kunden resultieren.


重要提示:本文是由自动翻译系统翻译完成的(也称为“机器翻译”或 MT),未经人工翻译或审查。Citrix 提供本文的机器翻译版本是为了方便更多人访问支持内容。然而,自动翻译的文章并不总是完美的,可能存在词汇、语法或文法方面的错误。对于因客户使用机器翻译文章导致出现的不一致、错误或损害,Citrix 不承担任何责任。



Tradução automática

Importante: este artigo foi traduzido por um sistema de tradução automática (também conhecido por Machine Translation ou MT) e não foi traduzido nem revisado por pessoas. A Citrix oferece uma versão traduzida por máquina deste artigo para permitir maior acesso ao conteúdo de suporte. No entanto, a tradução automática não é sempre perfeita, podendo conter erros de vocabulário, sintaxe ou gramática. A Citrix não se responsabiliza por inconsistências, erros ou danos incorridos como resultado do uso de artigos de MT de nossos clientes.

Traducción automática

Importante: Este artículo ha sido traducido por un sistema de Traducción automática (también llamada MT o Machine Translation) sin intervención de un traductor humano. Citrix ofrece la traducción automática de este artículo para ampliar el acceso a la información de asistencia técnica. No obstante, la traducción automática no es perfecta y puede contener errores de vocabulario, sintaxis y gramática. Citrix no se hace responsable de cualquier imprecisión, error o daño ocasionados por el uso que hagan nuestros clientes de los artículos traducidos automáticamente.
Was this helpful?
Thank you for your feedback

Share your comments or find out more about this topic

Citrix Forums