| | | | | | | |

  Terminal Services
 
 

Article Written 5-3-2005

Moving the Citrix Data Store from One MS SQL to another MS SQL Server.


Introduction: If you decided to upgrade your MS SQL server with brand new hardware, because the server was getting old and outdated. Here is an outline of how we moved the Citrix Data Store Database from one MS SQL Server to the new Server we purchased.

1. Preparing the Server: When we received the new server, we racked it, and installed Windows 2003 Server and SQL 2000, installed service packs and anti virus etc...

2. Functional Testing Strategy: Fortunately we had a separate lab environment with 2 test SQL servers in which to test with. The test move worked flawlessly. We first performed an SQL database backup of the data store to the file system, then performed an SQL database restore on the other test SQL server. Then logged into each Citrix Server in the lab and opened the mf20.dsn with the Windows Control Panel ODBC Data Sources tool and pointed the other SQL server, rebooted and everything came up working perfectly.

3. Engineering a strategy: Since our Farm is 24 X 7, we decided to engineer a strategy to quickly and safely move the datastore to the new SQL server, then configure the mf20.dsn on each Citrix Server to point to the new SQL Server. Citrix Technical support recommended logging into each server desktop, opening control panel and using the ODBC Drivers configuration tool to change the database server configuration. For our medium sized Farm of 101 servers that would have taken a couple of hours at best.

We accomplished configuring the mf20.dsn on each server by scripting it. We tested the script over and over before running it against production.


The DataStore move was %100 successful.

Below are the scripts we used to configure the Citrix Servers mf20.dsn.



The start.cmd is primary script, it is a simple for loop. It requires the text file servers.txt to be in the same directory, and contains the host names of all Citrix Servers in the Farm. It also calls another script called dnsrename.cmd which actually does the work.


Start.cmd

echo on
FOR /F "tokens=1" %%a in (servers.txt) DO CALL dsnrename.cmd %%a




dsnrename.cmd:

This script is called from the start.cmd script above, which stops the IMA Service, then renames the mf20.dsn, and copies the new mf20.dsn (pointed to the new SQL Server) to the Citrix server and starts the IMA Service. This script also creates a result.txt to document the success of each loop action.

Note: The sleep 10 line pauses the script for 10 seconds to give the IMA service enough time to completely stop before it is started again. You can replace the sleep command with a pause if you like, otherwise you will need the sleep.exe in the same directory as the scripts. You can get it from the Windows Resource Kit. You will also need the sc.exe utility from the resource kit in the same directory.

echo on
echo [\\%1] >> result.txt
sc \\%1 stop imaservice
rename "\\%1\c$\Program Files\Citrix\Independent Management Architecture\mf20.dsn" mf20_app3.dsn
xcopy MF20.dsn "\\%1\c$\Program Files\Citrix\Independent Management Architecture\"
Echo Stopping IMA
sleep 10
sc \\%1 start imaservice >> result.txt
pause



MF20.dsn file with new SQL Server name:

[ODBC]
DRIVER=SQL Server
UID=serviceaccount
Trusted_Connection=Yes
Address=SQL01,1433
Network=DBMSSOCN
DATABASE=Citrix
APP=Citrix IMA
SERVER=SQL01
Description=Citrix Data Store




The Backout Script (backout.cmd):

Here is the backout script we created just incase something went wrong. Everything went smooth so we did not need to use it.

echo on

echo \\%1 >> result.txt
xcopy MF201.dsn "\\%1\c$\Program Files\Citrix\Independent Management Architecture\mf20_sql01.dsn"
rename "\\%1\c$\Program Files\Citrix\Independent Management Architecture\mf20.dsn" mf20_app3.dsn
rename "\\%1\c$\Program Files\Citrix\Independent Management Architecture\mf20_sql01.dsn" mf20.dsn
sc \\%1 stop imaservice >> result.txt
sleep 10
sc \\%1 start imaservice >> result.txt
pause



Summary: The datastore move was successful and painless. The scripts above will not work as is, you will need to modify them to fit your specific configuration. Important note: Do not make any changes to your Citrix Environment using the Management console between the time you copy the SQL Citrix datastore database and cutting over the Servers to point to the copied SQL Citrix Datastore Database.

Article By: Scott Chiara


Quick Links

schiara@thin-world.com