User database

Restoring core services in Lync is one thing, but the users will certainly complain if they discover that all of their saved contacts or conference information is lost. It is not critical to restore the user database, but it's highly recommended to have a backup of the user data. This is not only intended for disaster recovery but also to help single users if their information is corrupted.

Getting ready

PowerShell is the only tool available to perform this task, running in the elevated prompt. The commands listed here will fail unless we provide information about where the user databases are stored. Before running any of these commands, run Get-CsService –UserDatabase and take note of the listed database(s), as shown in the following screenshot:

Getting ready

How to do it…

The following are the three steps to back up the user data and (or) conference directory:

  1. Start PowerShell in the elevated administrative mode.
  2. For each of the user database in your topology, type this:
    Export-CsUserData -PoolFqdn "mydatabaseserver.domain.com"´
     -FileName "C:BackupBackUserDataFromMyDatabaseServer.zip"
    
  3. Save these files in a secure location.

    Tip

    In large deployments, it might be wise to have the name of the targeted database server in the filename for easier restore.

Restoring is as simple as the backup, as long as we target the correct user database (the backend server where the users are homed). It would not be of much help for the user if the data was restored to the wrong pool or server.

The following are the two steps to restore user data:

  1. Start PowerShell in the elevated administrative mode.
  2. For the selected user database, type this (this must be repeated for each user database in the topology we have to restore):
    Import-CsUserData -PoolFqdn "mydatabaseserver.domain.com"´
    -FileName "C:BackupBackUserDataFromMyDatabaseServer.zip"
    

There's more…

Although the preceding examples show how to back up and restore the entire user database, the Export-CsUserData and Import-CsUserData commands are much more flexible. They can easily be used to export and import single users and/or conference directories. This is done using either –userfilter or –confdirectoryfilter.

By adding the following to the end of the Export-CsUserData string shown previously, -userfilter [email protected], the command exports user data only for the specified user. This will allow an administrator to go through the specified users' contacts; possibly remove, add, or change information; and then import the information back into the database.

By adding the same string to the end of the import string shown previously, the single user is restored as described earlier. This allows for a simple restore of a single user who might have been deleted, or the Lync account might be corrupted:

Import-CsUserData -PoolFqdn "mydatabaseserver.domain.com" 1.	-FileName "C:BackupBackUserDataFromMyDatabaseServer.zip" -userfilter [email protected]

Note

If, for some reason, the user database has been moved from one version to another version of Lync, we have the Convert-CsUserData command to change the file format between XML (Lync 2010) and ZIP (Lync 2013). The command for this is as follows:

Convert-CsUserData -InputFile "C:BackupBackUserDataFromMyDatabaseServer.zip" -OutputFile " C:Backupconverteuserdatato2010.xml" -TargetVersion Lync2010 -UserFilter " [email protected]"

This command will convert the data for a user who has been moved from Lync 2013 to Lync 2010 and then needs to be restored into Lync 2010 with the appropriate tools (DBImpExp.exe).

The users must be offline when you run the Import-CsUserData command.

Tip

There is a different command to update the database if a user is online at the time of restoring:

Update-CsUserData -Filename "C:BackupBackUserDataFromMyDatabaseServer.zip " -UserFilter [email protected]

If this is a large deployment with different pools, use the –routinggroupfilter switch to identify the correct user pool.

Note that the update command does not write to the database but through the fabric.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.66.185