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:
Verify the name of the database and database server that is currently used by startingPowerShellfrom theDesktop StudioConsole.
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
Connect to theSQL serverand open theMicrosoft SQL Server Management Studio.
Connect to theDatabase Engine.
Expand the Databases node for your server and navigate to the database identified in Step 2.
Right-click database, selectTasks>Back Up.
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.
CickOKand ensure that the backup completed successfully.
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:
Connect to theDatabase Engine.
Expand theDatabasesnode for your server and navigate to the name of your XenDesktop database.
Right-click database, selectTasks>Restore>Database.
选择你要恢复的备份集摇来摇去m the list or go to the next step on how to select a file.
The source can be changed toFrom devicethen select the browse “…” icon
SelectAddto locate the backup file from its folder.
Ensure the correct backup set is selected then clickOptions.
FromOptions, clickOverwrite the existing databaseandRestore with recovery.
ClickOK.
RestartEach Broker.
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-PvsVmServiceStatusNote: 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.
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.
Read to the Desktop groups all changes including catalogs, hosts, or assignments made after the backup date.
Additional Resources
CTX128075 -XDDBDiag for XenDesktop
CTX127254 -XenDesktop 5.6 SDK Cmdlet Help
CTX114501 –Supported Databases for Citrix Products
CTX130532 –How to Restore a XenDesktop 5 Database on a SQL 2008 Server