Home Applications Learning How to Migrate a Citrix Data Store from Access to SQL Server (Updated 05/27/2010)

Learning How to Migrate a Citrix Data Store from Access to SQL Server (Updated 05/27/2010)


Updated May 7, 2010

When a Citrix Farm is created, by default, the data store is created on the first server of the Farm using an Access database.  This article will teach you how to backup an Access data store and migrate that data store from Access to SQL Server.

There are a couple of advantages to using Access for the data store:

  • Easy to setup during XenApp installation
  • No complicated ODBC DSN file to create or configure

The disadvantages to using Access for the data store:

  • If the XenApp server hosting the data store goes down or is restarted, Farm functionality is severely crippled
  • Only recommended for very small Farms because of performance reasons
  • No High Availability options
  • Rarely included in backup or disaster recovery planning

The advantages to using SQL Server for the data store:

  • Is not run on a XenApp server
  • Can be used for any size Farm
  • High Availability options
  • Usually included in backup and disaster recovery planning

For this article, VMware Workstation 6.5.1-126130 will be used with Windows Server 2008 Standard (x86) and Citrix XenApp for Windows Server 2008 Platinum (x86).  The following Virtual Machines (VM) will be used:

  • Domain Controller: CitrixDC 
    • The VM will be assigned one processor, 1GB of RAM and 16GB of Hard Drive space
    • Domain Controller for the WebstersLab.com Active Directory domain 
    • Terminal Server License server and Citrix Licensing server
    • Static IP Address
  • SQL Server: CitrixSQL1
    • The VM will be assigned one processor, 2GB of RAM and 16GB of Hard Drive space
    • This VM will host the new migrated to SQL Server data store 
    • This VM will use SQL Server 2005 SP3
    • Static IP Address
  • XenApp 5 #1: CitrixXA1 
    • The VM will be assigned one processor, 2GB of RAM and 16GB of Hard Drive space 
    • This VM will host the original Access data store
    • Static IP Address
  • XenApp 5 #2: CitrixXA2 
    • The VM will be assigned one processor, 2GB of RAM and 16GB of Hard Drive space 
    • This VM is used to show how to change additional XenApp servers to use the new SQL Server data store
    • Static IP Address

 CitrixDC has a file share named CTXBACKUP that I will use to store the data store backup.  XenApp 5 for Windows Server 2008 was installed on CitrixXA1 and a new Farm named Webster was created during the installation.  After restarting the VM, XenApp 5 for Windows Server 2008 was installed on CitrixXA2 and then this instance was joined to the Webster Farm.  Two applications were published on the Farm: Notepad and Paint.  Both applications are configured to run from both XenApp servers. 


It is a Best Practice to always backup the data store before performing the migration.  The Access based data store, by default, is located in C:Program FilesCitrixIndependent Management Architecture and is named MF20.mdb.

From a command prompt on CitrixXA1, the following command was run to generate a backup:

dsmaint backup \CitrixDCCTXBackup

The command "dsmaint backup" makes a copy of the MF20.mdb Access data store to the location specified.  "dsmaint backup" is used only to backup an Access data store and must be run on the XenApp server hosting the Access data store.  It cannot be used to backup a data store which is using MSDE, SQL Server 2005 Express, SQL Server, Oracle or DB2.

This article is using the concepts from Citrix support article CTX677542.  For SQL Server Database specific information, please see page 183 of the XenApp Installation Guide.

BEFORE YOU START THE MIGRATION, make sure the account being used for this procedure is a Full Farm Administrator.

Note:  If you have a Microsoft SQL Server DBA available, please reference the Citrix Support article Citrix Presentation Server and Microsoft SQL 2005 Configuration.

To create the SQL Server data store database, open SQL Server Management Studio.  Click Start -> All Programs -> Microsoft SQL Server 2005 -> SQL Server Management Studio.

 Expand Databases in the left column.

Right-click Databases and select New Database.

It is recommended to put the Farm name in the database name.

Click Options and make sure Recovery Model is set to Full and Compatibility Level is set to SQL Server 2005 (90).  Click OK.

The new data store database is ready for use.

 On the XenApp server hosting the Access data store, a new Data Source Name (DSN) needs to be created for the SQL database.

Click Start -> Administrative Tools -> Data Sources (ODBC).

Note: What is ODBC?  This is taken from http://support.microsoft.com/kb/110093

"Open Database Connectivity (ODBC) is Microsoft’s strategic interface for accessing data in a heterogeneous environment of relational and non- relational database management systems. Based on the Call Level Interface specification of the SQL Access Group, ODBC provides an open, vendor- neutral way of accessing data stored in a variety of proprietary personal computer, minicomputer, and mainframe databases.

ODBC alleviates the need for independent software vendors and corporate developers to learn multiple application programming interfaces. ODBC now provides a universal data access interface. With ODBC, application developers can allow an application to concurrently access, view, and modify data from multiple, diverse databases."

Click the File DSN Tab.

Note:  What is the difference between "User DSN", "System DSN" and "File DSN"?  This is taken from http://support.microsoft.com/kb/213772.

User DSN: The User DSN is a data source that is user-specific. A User DSN is stored locally but is available only to the user who creates it.


System DSN: Unlike a User DSN, a System DSN is not user-specific. A System DSN is stored locally and is not dedicated to a particular user. Any user who logs on to a computer that has permission to access the data source can use a System DSN. Some programs, such as Microsoft SQL Server or Microsoft Internet Information Server (IIS), require a System DSN. This DSN must be created on the server where the program is located. System DSNs are stored in the Windows registry under the following key: HKEY_LOCAL_MACHINESoftwareOdbcOdbc.iniOdbc Data sources


File DSN: The File DSN is created locally and can be shared with other users. The File DSN is file-based, which means that the .dsn file contains all the information required to connect to the data source. Note that you must install the ODBC driver locally to use a File DSN.  File DSNs are not stored in the Windows registry. The .dsn file is a text file that you can view in any text editor, such as Microsoft Notepad.

Change the Look in to C:Program FilesCitrixIndependent Management Architecture.  The new DSN must be placed in this folder.  The IMASERVICE service is programmed to look in only this folder.

Click the Add button.

 Click on SQL Server and click Next.

Type in C:Program FilesCitrixIndependent Management ArchitectureWebsterFarmDSMF20.dsn and click Next.

Note: The DSN can be named anything as long as it has a .dsn file extension.  It does not need to contain "MF20" anywhere in the name.

Click Finish.

Enter a Description and type in the name of the SQL Server and click Next.

If a successful connection to the SQL Server is made click Next.  A common problem is the Windows Firewall is not configured to allow SQL traffic (TCP Port 1433).  To configure an instance of SQL Server 2005 to use a static port, follow the steps described in the "How to: Configure a Server to Listen on a Specific TCP Port (SQL Server Configuration Manager)" topic in SQL Server 2005 Books Online.

Note:  If SQL Server is set to use a static port, click Client Configuration, then uncheck Dynamically determine port and enter the value for the static port number.

 If the account listed in the grayed out Login ID authenticates successfully to the SQL Server, Change the default database to the new SQL Server data store and click Next

One problem could be the Login ID account is not setup to access the SQL Server.

Click Finish.

Click Test Data Source.

If the message TESTS COMPLETED SUCCESSFULLY is shown, click OK.  Otherwise, you will need to troubleshoot the ODBC connection to the SQL Server.

 Click OK.

Your new DSN is created.  Click OK.

Click Start, right-click Command Prompt and select Run as administrator.

Type in DSMAINT MIGRATE /srcdsn:"C:Program FilesCitrixIndependent Management ArchitectureMF20.dsn" /srcuser:citrix /srcpwd:citrix /dstdsn:"C:Program FilesCitrixIndependent Management ArchitectureWebsterFarmDSMF20.dsn" /dstuser:websterslabadministrator /dstpwd:password and press Enter.

/srcdsn is the Access MF20.dsn that was created when the Farm was created

/srcuser and /srcpwd are both, by default, "citrix"

/dstdsn is the new DSN file

/dstuser and /dstpwd are the username and password of the account that has rights to the new data store SQL database

Click Yes on the Dsmaint confirmation popup.

 The migration starts. 

If the following error is received:

"Result: "an unknown error occurred while migrating the table, please verify the destination datasource is clean. [Microsoft][ODBC SQL server Driver][SQL server]violation of primary key constraint ‘CL’. Cannot insert duplicate key in object "keytable". Indexes have been successfully patched."

This is usually caused by the default database being set to Master.  That is a huge mistake.  Make sure the default database for the DSN file is set to the new data store database.

When the migration completes, answer Yes to the Dsmaint comparison popup.

The comparison runs and completes.

Next DSMAINT CONFIG needs to be run.  The /pwd option needs to be used and according to the XenApp Administrator’s Guide:

"You must stop the Citrix Independent Management Architecture service before using config with the /pwd option."

In the command prompt window, type NET STOP IMASERVICE and press Enter.

Type in DSMAINT CONFIG /user:websterslabadministrator /pwd:password /dsn:"C:Program FilesCitrixIndependent Management ArchitectureWebsterFarmDSMF20.dsn" and press Enter.

 Type in NET START IMASERVICE and press Enter.

One cause of the IMASERVICE not restarting is the currently logged in account is not a Full Farm Administrator.

Type in CD "C:Program FilesCitrixIndependent Management Architecture" and press Enter.

Copy the new DSN file to the remaining XenApp server’s C:Program FilesCitrixIndependent Management Architecture folder.

Edit the copied DSN file and change the WSID line to reflect the name of that XenApp server.

UPDATE: I have found out the WSID line is not used.  You can safely edit the line to read WSID= .

On each remaining XenApp server, type in:

NET STOP IMASERVICE and press Enter.

DSMAINT CONFIG /user:websterslabadministrator /pwd:password /dsn:"C:Program FilesCitrixIndependent Management ArchitectureWebsterFarmDSMF20.dsn" and press Enter


On any of the XenApp servers, start the Access Management Console (AMC).

The AMC communicates with the data store to retrieve the Farm information.

If any errors are received, go to http://support.citrix.com and search for the error number.

An alternate way to test connectivity to the data store is from a command prompt type in QFARM and press enter.

You learned how to:

  • backup an Access data store
  • Create a new File DSN for a SQL Server data store
  • Migrate to the new data store
  • Configure all XenApp servers to communicate with the new data store
  • Stop and restart the IMA service on a XenApp server
  • Using the Access Management Console, verify communication with the new data store


More Resources:

DABCC DABCC.com, the world leader in sharing the finest Virtualization & Cloud news and support resources. #Citrix, #VMware, #Microsoft, #Mobility and much more! Brought to you by @douglasabrown & team!

White Papers

    Evolving Requirements of BYOD Management – White Paper

    While the bring your own device (BYOD) trend helps organizations reduces infrastructure costs, only a fraction of those organizations — 16 percent — are fully equipped to support BYOD programs. That’s one of the many findings revealed in Evolving Requirements for Bring Your Own Device (BYOD) Management,  a new white paper by leading IT research […]


      Citrix Load & Performance Testing – Download AppLoader!

      Load testing for Citrix XenApp, XenDesktop, PeopleSoft, Java, .NET, Adobe, client-server, Oracle, Siebel, SAP, web, custom apps and more Download NRG Global’s load and performance testing solution for all applications from the end user’s perspective. This easy-to-use, script-free load and performance testing solution stresses your application with real-life traffic to accurately assess end to end […]

      On-Demand Webinars

        Latest Videos

          ServiceDesk Plus – Request Management as an Administrator

          ServiceDesk Plus is a game changing IT help desk software which is used by more than 100,000 service desks across 185 countries. This video series will help you get the most out of ServiceDesk Plus. In this video you will learn how to add organisational details, import users, and configure the request management module in […]