Sunday, June 5, 2011

Blog Post: Lync Server 2010 Disaster Recovery scenarios ? Restoring Enterprise Edition Back end server

While you can find official Lync Server 2010 Backup/Restore guide at Backing Up and Restoring Lync Server 2010, in this article I’m providing an additional recovery scenario to restore the data.

There’s nothing wrong with the procedure in official online Lync documentation, but while it is focusing solely on using Dbimpexp tool to backup and restore user data, this article provides another method to restore the data stored on your failed back end server – restore RTC database using SQL Server Management Studio.

First prerequisite to use this option to recover your data is, obviously, to have a backup of RTC database which you can conduct using SQL Server Management Studio.

If you are wondering why you would look for alternative solutions when you can use Dbimpexp tool, one good reason would be to avoid dependency on User Replicator full synchronization. Namely, if you want to successfully import data using Dbimpexp tool, you need to make sure that User Replicator process has completed initial synchronization (logged as Event ID 30024).

Certainly, you can trigger full synchronization with Update-CsUserDatabase and wait for completion of initial sync (make sure Event ID 30024 is logged), but in this case you depend on existence of at least one Front end server to trigger this process. In site disaster scenarios, though (such as natural disaster, site power failure etc), where all your Front end servers might be unavailable, you’d have to first rebuild at least one Front End server to trigger User Replicator initial sync.

Long story short, it might be beneficial to have multiple options when restoring user data, and that is why I’d recommend backing up RTC database on a regular basis (apart from regular export using Dbimpexp tool), so you can pick the method that suit you best.

So without further ado, let’s jump to the procedure itself:

 

A. Start with a clean or new server that has the same fully qualified domain name (FQDN) and IP settings as the failed SQL Back end server.

B. From a user account that is a member of the RTCUniversalServerAdmins group, log on to the server you are restoring.

C. Install SQL Server 2008 or SQL Server 2005 (whichever was deployed on your failed server) keeping the same SQL version and Service Pack, as well as instance names as before the failure.

D. From any available Front End server in environment:

  • Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2010, and then click Lync Server Management Shell
  • Use Install-CsDatabase cmdlet to create configured BE databases

Install-CsDatabase –ConfiguredDatabases –SqlServerFqdn <sqlfqdn>

Note: if the failed back end server hosted Archiving or/and Monitoring server databases, those databases will also be created when running Install-CsDatabase –ConfiguredDatabases

 

E. Restore the data by performing either of two options below:

Option A – Restore RTC database 

a) Restore RTC database from backup using SQL Server Management Studio. (use REPLACE option when restoring database)

b) If you’re getting error stating that exclusive access to the database could not be obtained, run the following SQL Query in SQL Server Management Stuido (providing correct path to backup file):

USE Master

ALTER DATABASE rtc SET SINGLE_USER with ROLLBACK IMMEDIATE

RESTORE DATABASE rtc

FROM DISK = ‘c:\backup\rtc.bak’

WITH REPLACE

GO     

 Option B – use Dbimpexp to import data to clean database

a) Verify that at least one Front End Server in the pool is running and that the User Replicator process has completed a full synchronization cycle. If you run Dbimpexp.exe before the synchronization is complete, the command will fail.

Important:

The Lync Server 2010 User Replicator service initial synchronization process occurs when the Lync Server 2010 Front End Server is started for the first time or when a regenerate operation is initiated.

LS User Replicator will log Event ID 30024 for completed initial synchronization of AD domain and user database.

If necessary (e.g. initial user synchronization has not been completed for any reason) you can trigger synchronization cycle by issuing Update-CsUserDatabase powershell command.

 

b) To restore the user data, at the command line, type:

Dbimpexp.exe /import /hrxmlfile:<path and file name of backed up Rtc database> /sqlserver:<SQL Server FQDN>\<instance name> /restype:all

For example:

Dbimpexp.exe /import /hrxmlfile:D\BackupUsers.xml /sqlserver:sql.contoso.com\rtc /restype:all

 

F. Restore RGS configuration settings

Note: to restore RGS configuration settings, you need to have a backup of RGS configuration. Please refer to Backing up Core Data and Settings for information on how to backup RGS configuration. 

  • From a user account that is a member of the RTCUniversalServerAdmins group (or has equivalent user rights), log on to any Front End server.
  • Copy the Get-CsApplicationContact.ps1 script, located in the Lync Server PowerShell blog at http://go.microsoft.com/fwlink/?LinkId=210869, and paste it into a text editor, such as Notepad or a Windows PowerShell editor. Save the script as Get-CsApplicationContact.ps1 on the server.
  • Start the Lync Server Management Shell: Click Start, click All Programs, click Microsoft Lync Server 2010, and then click Lync Server Management Shell.
  • At the command line, navigate to the folder where you saved the script, and then type:

          Import-Module .\Get-CsApplicationContact.ps1 

  • To retrieve the list of Response Group contact objects that are associated with the pool, at the command line, type:

Get-CsApplicationContact –OwnerUrn "urn:application:Rgs" –Filter "(MSRTCSIP-ApplicationOptions=1)" –RegistrarPool <pool FQDN>

For example:

Get-CsApplicationContact –OwnerUrn "urn:application:Rgs" –Filter "(MSRTCSIP-ApplicationOptions=1)" –RegistrarPool "pool01.contoso.com" 

  • Review the output of the Get-CsApplicationContact script to verify that the contact objects listed are the ones you want to remove. To remove the contact objects, at the command line, type:

Get-CsApplicationContact –OwnerUrn "urn:application:Rgs" –Filter "(MSRTCSIP-ApplicationOptions=1)" –RegistrarPool <pool FQDN> -Delete

 Note: You are prompted to confirm the deletion of each contact object, and you can skip any contact objects that you do not want to delete.

  • To restore the configuration settings, do the following:
    • If you have not already done so, locate the RgsImportExport.ps1 script in the Lync Server 2010 Resource Kit, and save it to the computer.
    • Using Lync Management Shell navigate to the folder where you saved the script, and type:

Import-Module .\RgsImportExport.ps1

Import-CsRgsConfiguration ApplicationServer:pool01.contoso.com –FileName D:\RgsConfigBackupFile.zip

 

G. If Option A (RTC database restore) in step 5 was used to restore user data, Event IDs 32118 and 51009 could be logged in Lync Server Event log, caused by crossed databases chaining being disabled. In this case you need to run the following command in SQL Query windows:

Alter database RTC set db_chaining on

Alter database RTCDYN set db_chaining on

 

Summary

This article addresses recovery of your failed Enterprise Edition Back End server, providing two different methods to restore the data.

Apart from use of Dbimpexp tool to recover user data, an alternative recovery option is provided – restore of RTC database using SQL Server Management Studio.

Restore of RTC database does not depend on full synchronization of User Replicator process and is thus preferred scenario in situations when you might not have accessible Front End server to trigger User Replication sync.

RTC database restore method can be used in all situations except when it’s necessary to restore user data from one pool to another pool, in which case you’ll have to use Dbimpexp tool.

This article addresses specifically the failure of the SQL Back End server that does not host Central Management Store. That specific scenario will be addressed in my next blog.

Rose McGowan Bar Refaeli Jessica White Anna Friel Monica Bellucci

No comments:

Post a Comment