Contact Support

Customers who viewed this article also viewed

banner
CTX135207 {{tooltipText}}

How to Backup and Restore your XenApp/XenDesktop Database

Applicable Products

  • XenApp 7.5
  • XenDesktop

Objective

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

Requirements

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.

Background

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.


Instructions

Backup

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 startingPowerShellfrom theDesktop StudioConsole.
    User-added image

  1. Run the following command:Get-BrokerDBConnectionto get the name of the database server/Data Source and the Database/Initial Catalog name.
    Example 1
    PS C:\> Get-BrokerDBConnection
    Server=sqlserver.training.local;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 theSQL serverand open theMicrosoft SQL Server Management Studio.

  2. Connect to theDatabase 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, selectTasks>Back Up.
    User-added image

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

  1. CickOKand ensure that the backup completed successfully.
    User-added image

SeeCreating Full and Differential Backups of a SQL Server Database.

Restore

Important

  • 备份后删除任何热补丁应用之前e 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 theDatabase Engine.
    User-added image

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

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

  1. 选择你要恢复的备份集摇来摇去m the list or go to the next step on how to select a file.
    User-added image

    The source can be changed toFrom devicethen select the browse “…” icon
    User-added image

  1. SelectAddto locate the backup file from its folder.
    User-added image

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

  1. FromOptions, clickOverwrite the existing databaseandRestore with recovery.
    User-added image

  1. ClickOK.
    User-added image

  1. RestartEach Broker.

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

    Add-PSSnapin Citrix.*
    Get-AcctServiceStatus
    Get-BrokerServiceStatus
    Get-ConfigServiceStatus
    Get-HypServiceStatus
    Get-LicServiceStatus
    Get-ProvServiceStatus
    Get-PvsVmServiceStatus

    Note: Verify that all preceding commands have returned a result ofOK. 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 theXDDBDiag utility- CTX128075 -XDDBDiag for XenDesktopto 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.


Additional Resources


Disclaimer

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.
Share this page