CTX140319
XenApp,XenDesktop
XenDesktop 7_1,XenDesktop 7
Installation/Upgrade
2016-04-18
2005-06-06
This article describes how to migrate a XenDesktop database from SQL 2008 to a second SQL 2012 Server.

Objective

This article describes how to migrate a XenDesktop database from SQL 2008 to a second SQL 2012 Server.


Instructions

When using Microsoft SQL Server, refer to?? 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.

In this scenario, it is expected that the Citrix Data Store is unavailable until the procedure is complete. Therefore, complete all the steps in the following procedure within the same change window.

Notes:

  • Citrix strongly recommends that no administrative changes be attempted until the Database is back online and verified.

  • All Management Consoles should be closed.

Review throttling and idle pool settings as soon as you restore the DB to mitigate the possibility of boot storms.

The following environmental data is used as an example:

User-added image

Planning

Stop the Configuration Logging Service

  1. Start Windows PowerShell as an Administrator and run:

     asnp Citrix*
  1. Before moving the database, stop configuration Logging:

     ???? ##Disable Configuration Logging

    From GUI - ?? Logging > Preferences > Disable.

    User-added image

    -Or-

    In PowerShell, run:

     Set-LogSite -State "Disabled"

    User-added image

  1. Close Citrix Studio and reopen so the PowerShell command can take effect.

Stop Monitoring

In PowerShell, run:

 Set-MonitorConfiguration -DataCollectionEnabled $False

User-added image

Backup and Restore Process

  1. Backup Registry.
  2. Backup the Existing Database and restore it onto the SQL target server.

    Refer to the Copying Databases with Backup and Restore web page of Microsoft MSDN library for more information.

  3. Verify that all the Delivery Controllers have valid logins for their machine account in the form DomainName\Computername$ on the database server. If verified, repeat Step 2.

Creating a Delivery Controller SQL Login

Complete the following procedure to create machine logins for all Delivery Controllers (Controllers) on the database server:

  1. Start SQL Server Management Studio or SQLCMD.

  2. Run the create login [domain\machine$] from windows query, as displayed in the following screen shot:

    User-added image

  1. Each Delivery Controllers Machine Login should have a corresponding user account under the restored Database. Locate these accounts and verify that their Database role membership is set to the following role, as displayed in the screen shot:

    ROLE

    Account (one for each Broker)

    ADIdentitySchema_ROLE

    DOMAIN\MACHINE$

    chr_Broker

    DOMAIN\MACHINE$

    chr_Controller

    DOMAIN\MACHINE$

    ConfigLoggingSchema_ROLE

    DOMAIN\MACHINE$

    ConfigLoggingSiteSchema_ROLE

    DOMAIN\MACHINE$

    ConfigurationSchema_ROLE

    DOMAIN\MACHINE$

    DAS_ROLE

    DOMAIN\MACHINE$

    DesktopUpdateManagerSchema_ROLE

    DOMAIN\MACHINE$

    EnvTestServiceSchema_ROLE

    DOMAIN\MACHINE$

    HostingUnitServiceSchema_ROLE

    DOMAIN\MACHINE$

    Monitor_ROLE

    DOMAIN\MACHINE$

    MonitorData_ROLE

    DOMAIN\MACHINE$

    StorefrontSchema_ROLE

    DOMAIN\MACHINE$

    User-added image

    User-added image

Test Restored Database

From Each Controller, test the database connection string before making changes:
IMPORTANT NOTE: ?? Test-AnalyticsDBConnection -DBConnection?? is for 7.6 and later.

 ## ## Replace <dbserver> with the New SQL server, and instance if present ## Replace <dbname> with the name of your restored Database ## ## $ServerName="<dbserver>" $DBName ="<dbname>" # $cs="Server=$ServerName; Initial Catalog=$DBName; Integrated Security=True" $cs Test-AdminDBConnection -DBConnection $cs Test-ConfigDBConnection -DBConnection $cs Test-AcctDBConnection -DBConnection $cs Test-AnalyticsDBConnection -DBConnection $cs Test-HypDBConnection -DBConnection $cs Test-ProvDBConnection -DBConnection $cs Test-BrokerDBConnection -DBConnection $cs Test-EnvTestDBConnection -DBConnection $cs Test-LogDBConnection -DBConnection $cs Test-MonitorDBConnection -DBConnection $cs Test-SfDBConnection -DBConnection $cs

User-added image

Migrate First Controller to New Database

  1. Remove the existing Database connections:

    IMPORTANT!?? Set-AnalyticsDBConnection -DBConnection entry is for XenDesktop 7.6 and later.

    At the Delivery Controllers, from the open PowerShell window, run the following commands?? where <dbserver> is the name of your SQL server, which is the instance if defined and <dbname> is the name of the XenDesktop database. This process clears the existing database connection and then configures the new connection for each service:

 ## ## First unregister the Delivery Controllers from the current database: ## Set-ConfigDBConnection -DBConnection $null Set-AcctDBConnection -DBConnection $null Set-AnalyticsDBConnection -DBConnection $null 
 Set-HypDBConnection -DBConnection $null Set-ProvDBConnection -DBConnection $null Set-BrokerDBConnection -DBConnection $null Set-EnvTestDBConnection -DBConnection $null Set-SfDBConnection -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

User-added image

  1. If you see the following error, you must restart all the Citrix services:

    User-added image

  2. After restarting all the Citrix services, you must restart the server:

     Get-Service Citrix* | Stop-Service -Force ???? Get-Service Citrix* | Start-Service User-added image
  3. Rerun the original set of command?? to confirm that the existing connection is properly removed and returns status:
    DBUnconfigured.

  4. Redirect the Controller to the new database:
    IMPORTANT NOTE: ?? Set-AnalyticsDBConnection -DBConnection is for 7.6 and later.

     ## ## Replace <dbserver> with the New SQL server, and instance if present ## Replace <dbname> with the name of your restored Database ## ## $ServerName="<dbserver>" $DBName ="<dbname>" # $cs="Server=$ServerName;Initial Catalog=$DBName;Integrated Security=True" $cs Set-AdminDBConnection -DBConnection $cs Set-ConfigDBConnection -DBConnection $cs Set-AcctDBConnection -DBConnection $cs Set-AnalyticsDBConnection -DBConnection $cs Set-HypDBConnection -DBConnection $cs Set-ProvDBConnection -DBConnection $cs #Set-PvsVmDBConnection -DBConnection $cs Set-BrokerDBConnection -DBConnection $cs Set-EnvTestDBConnection -DBConnection $cs Set-LogDBConnection -DBConnection $cs Set-LogDBConnection -DataStore Logging -DBConnection $null Set-LogDBConnection -DBConnection $null Set-LogDBConnection -DBConnection $cs Set-LogDBConnection -DataStore Logging -DBConnection $csLogging Set-MonitorDBConnection -DBConnection $cs Set-MonitorDBConnection -DataStore Monitor -DBConnection $null Set-MonitorDBConnection -DBConnection $null Set-MonitorDBConnection -DBConnection $cs Set-MonitorDBConnection -DataStore Monitor -DBConnection $csMonitoring Set-SfDBConnection -DBConnection $cs

    User-added image

    Note: It is important to verify that all the preceding Set-<service>DBConnection commands have returned a result of OK. In case, when the result is other than OK for any of these commands, it might be necessary to enable logging or tracing to determine the cause of the connection failure.

    #Set-PvsVmDBConnection -DBConnection $cs command does not exist in version 7.x. In version?? 5.6, it exists but the # would needs to be removed.

    The XDDBDiag utility can be used to verify the consistency of your database after the move.

    If any Virtual Delivery Agents were running when the Controller services were shut down in Step 1, then it could take up to 10 minutes before the Virtual Desktop Agents re-registers. No other action should be necessary.

  5. After moving the Delivery Controllers, on each of them enable Monitoring and Logging:

     ##Enable Monitoring Set-MonitorConfiguration -DataCollectionEnabled $true

    User-added image

     ##Enable Configuration Logging Set-LogSite -State "Enabled"

    User-added image

  6. Restart Citrix Studio.

  7. From each Controller, test the database connection services to the new database:

 Get-AcctServiceStatus Get-AdminServiceStatus Get-BrokerServiceStatus Get-ConfigServiceStatus Get-EnvTestServiceStatus Get-HypServiceStatus Get-LogServiceStatus Get-MonitorServiceStatus Get-ProvServiceStatus Get-SfServiceStatus

User-added image


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.

 

Join the conversation

Citrix Discussions

Open a case

Citrix Support

特别说明


本文来源为Citrix.com所有,翻译后版权归翻译者所有.如需转载请注明出处.

文档版本


.

广告招租


最新留言


.

广告招租


.