***Update – I’ve tested this process with OCS 2007 R2 as well and it works as expected. The only difference is that you need to repeat the backup/restore processes on the acddyn and rtcab databases.***
In this post I'll go over the relatively easy process of moving the OCS databases from one SQL 2005 server to another using only SQL Management Studio. Of course there are many options for how you perform backups and restores, but given the small size of the core OCS databases I find that it's usually fastest to use the built in tools. The entire process usually takes under 15 minutes.
Before you begin, stop all the OCS services on all servers in the pool. Now you are ready to take a backup of your existing rtc, rtconfig, and rtcdyn databases. To do so, open SQL Management Studio, right click on the database you wish to backup, and select Tasks/Backup:
You will be presented with some backup options:
All you need to do here is note the file location of the .bak file (or change it to a location of your choosing) then click OK. This will start the backup and the circle in the bottom left will show the backup progress. You will need to perform these steps on the rtc, rtcconfig, and rtcdyn databases. When you are done you can either copy the .bak files to the new server or note the location and access them via \\servername\share\location from the new SQL server.
Next you must restore the databases to the new SQL server. On the new SQL server right click Databases and select Restore Database:
You will be presented with a restore options window:
Enter the name of the database you are restoring (rtc, rtcconfig, or rtcdyn only). Next click the "From device" option to indicate that you would like to restore from a file and click the [...] button to specify the file. Once you have selected it it will be listed in the Backup location list. Click OK to continue:
You must check the box next to the restore set to continue:
On the options page you have the ability to specify the restore location. By default it displays the original location of the files. Modify these as appropriate to match the desired location of the mdf and ldf files on the new SQL server. It is a best practice to place the database files on a separate spindle set from the log files.
Now click OK and the database will restore. Complete this step for the rtc, rtcconfig, and rtcdyn databases.
At this point we're more than halfway done. There are a few other items to complete before we are ready to start the services up again. SQL databases retain their permissions during a restore, but the SQL server login information is stored in the master database on each SQL server, so we will need to give the appropriate RTC groups access to the new SQL server. Also, the rtc and rtcdyn databases require database chaining to be enabled. I've included the SQL query that you need to execute to handle all of this at once. To execute this query, open SQL Management Studio and click the New Query button in the top left:
Modify the query below so that <domain> matches your actual domain name (for example, CORP) and paste it into the query window
CREATE LOGIN [<domain>\RTCArchivingUniversalServices] FROM WINDOWS WITH DEFAULT_DATABASE=master;
CREATE LOGIN [<domain>\RTCComponentUniversalServices] FROM WINDOWS WITH DEFAULT_DATABASE=master;
CREATE LOGIN [<domain>\RTCHSUniversalServices] FROM WINDOWS WITH DEFAULT_DATABASE=master;
CREATE LOGIN [<domain>\RTCUniversalReadOnlyAdmins] FROM WINDOWS WITH DEFAULT_DATABASE=master;
CREATE LOGIN [<domain>\RTCUniversalServerAdmins] FROM WINDOWS WITH DEFAULT_DATABASE=master;
CREATE LOGIN [<domain>\RTCUniversalUserAdmins] FROM WINDOWS WITH DEFAULT_DATABASE=master;
EXEC sp_dboption 'rtc', 'db chaining', TRUE
EXEC sp_dboption 'rtcdyn', 'db chaining', TRUE
Now click the Execute button.
Now you are at the last step - updating the OCS pool configuration to point to the new database. To perform this step you need to be on a system that has OCS or the OCS administrative tools installed. One of your pool servers is a likely candidate.
Open a command prompt and navigate to the location of lcscmd.exe, which is usually in C:\Program Files\Common Files\Microsoft Office Communications Server 2007. Next run lcscmd with the appropriate switches to update the pool backend:
lcscmd /forest /action:updatepoolbackend /poolname:mypool /poolbe:mysqlserver\rtc
Note that the "poolname" option must be entered the same way it is displayed in the OCS admin console rather than using the FQDN like you are probably used to. In the example above I specified "mysqlserver tc" as the pool backend. This indicates that I've restored my databases to the SQL server "mysqlserver" that is running an "rtc" instance. If you are using the default (unnamed) instance you would simply specify /poolbe:mysqlserver.
Once you have the command line options set to match your environment push enter and you should receive something similar to this:
Microsoft Office Communications Server 2007 Deployment Command Console
Copyright (c) Microsoft Corporation. All rights reserved.
Executing "Initialize Forest Object"
Executing "Initialize Active Directory Connections"
Executing "Check Pools Container"
Executing "Check Active Directory Object CN=Pools"
Executing "Update Pool Backend"
Executing "Update Attribute msRTCSIP-BackEndServer of Pool pool1"
Executing "Check Pool Active Directory Objects"
Executing "Check Active Directory Object CN=pool1"
Executing "Check Active Directory Object CN=Microsoft"
Executing "Check Active Directory Object CN=LC Services"
Executing "Check Active Directory Object CN=LS WebComponents Services"
Executing "Read Attribute msRTCSIP-BackEndServer"
Executing "Update Attribute msRTCSIP-BackEndServer"
Executing "Read Attribute msRTCSIP-BackEndServer"
Check the log file "C:\DOCUME~1\mike\LOCALS~1\Temp\3\updatepoolbackend[2008_02_
27][10_47_51].html" for details.
Action completed successfully
Execution time = 750 ms
Now you're finished! Depending on your Active Directory environment it may take a few minutes for this change to replicate to all the DCs in the site where OCS resides. Allow enough time for this to take place and then start all the OCS services back up on each pool server.