Howto move your XenApp Datastore (SQL)

24 Jul

We’re currently decommissioning our W2K3 servers. Part of the process is to move the datastore to a W2K8R2/SQL2008R2 server. Easy job, documented well. Here’s to another document about it 😎

First run a full backup of your database on the source SQL server. Copy the .bak file to your target SQL server. On the target SQL server create a new database (remember the name). Restore the backup to the newly created database. Select ‘Overwrite the database’ in your restore options, else you’ll get an error.

After your restore is completed create a sql login that is db_owner to your datastore. You can limit these permissions to db_reader and db_writer, however every time you update your farm you will need to change these permissions back to db_owner. So I guess it’s not recommended.

Now that your SQL work is done you can start migrating your servers. It’s not a tough job. Just get a MF20.dsn file (%programfiles(x86)%\Citrix\Independent Management Architecture folder) of a random XenApp server and edit it with notepad to insert the new connection data. Below the contents of my MF20.dsn file.


[ODBC]
DRIVER=SQL Server
UID=
DATABASE=[sql_db_name]
APP=Citrix IMA
SERVER=[sql_server_fqdn]
Description=[description]

Now one-by-one logon to your servers. Perform the following sequence:

net stop imaservice /y
Stop IMA and it’s dependencies

copy [path_to_new]\mf20.dsn %programfiles(x86)%\citrix\independent management architecture /y
Copy the new mf20.dsn and overwrite the old one

dsmaint config /user:[sql_login] /pwd:[sql_password] /dsn:"C:\Program Files (x86)\CITRIX\Independent Management Architecture\mf20.dsn"
Connects IMA to the datastore. Gives a succes or failed message

dsmaint recreatelhc
Recreates the Local Host Cache

net start imaservice
Starts IMA

That’s all there is to it.

Update: I wrote a powershell script to automate this process. You can download it if you are logged in.

Comments

  • Marc Scholte, is saying:

    Precies wat ik nodig had. Had ooit in een ver verleden ook eens zoiets gemaakt voor KPN. Kom ik bij nu bij jou uit.

    Reply this message
    • mark, is saying:

      Hoi Marc,

      Dat is inderdaad grappig. Maar goed om te horen dat er nog iemand dit blog leest 🙂

      Succes met de migratie!

      Groet, Mark

      Reply this message
  • Marc Scholte, is saying:

    Zet dit nou eens in een powershell scriptje. Alle citrix servers in de farm even voorzien van een nieuwe MF20. Lijkt me een leuke uitdaging 🙂

    Marc.Scholte@Ordina

    Reply this message
    • mark, is saying:

      Ik ben niet echt een ps scripter maar zal even kijken of ik iets voor je in elkaar kan zetten.

      Groet, Mark

      Reply this message
  • mark, is saying:

    Ok Marc, I always like a good challenge so I wrote the script.
    It first stops IMA, then modifies the MF20.DSN. It runs the dsmaint config & recreatelhc command and then starts IMA on all remote servers in the input.txt file.

    You can find the explanation and usage in the script. Please let me know if you have additional questions.
    You need to log in (and register) to download the script.

    With kind regards,

    Mark

    Reply this message
  • GUERAULT, is saying:

    Hello Mark,
    I must migrate a datastore on a new SQL server and I will need to automate
    configuring servers. Would it be possible to send me a copy of Script: Connect to XenApp Servers (new) datastore (32) ?
    Thanks
    Jean-Louis

    Reply this message
    • mark, is saying:

      Hi Jean-Louis,

      I send you the script via the mail.

      Kind regards,

      Mark

      Reply this message
  • Mahi, is saying:

    Very good article, I would like to utilize the script to automate the process. Would you be so kind emailing it to me.

    Thanks.

    Mahi

    Reply this message
  • Andrew, is saying:

    Hi Mark,
    I was looking at utilisng this script but was unable to register. Can you possibly send a copy via email?
    Thanks in advance.
    Andrew

    Reply this message

Leave a Reply