I’ve been doing a fair bit of work around coexistence and migration lately and throwing contact lists around all over the place using dbimpexp. In light of this, I thought it’d be a good idea to do up a post to help you understand what dbimpexp.exe is as it’s a super useful bit of kit to have at your disposal during a Lync implementation/migration or during day-to-day operations.
If you’ve had experience backing up or restoring OCS 2007 R2 or Lync Server, chances are you’ll be familiar with dbimpexp. It’s very helpful for moving contact lists in a DR situation or between deployments in different domains. The only constant is that the SIP address must be the same when exporting or importing, so there’s no dependency on the AD domain that the contact lists have been exported from or are being imported into.
What is Dbimpexp?
Essentially (as per Microsoft), it’s a utility for exporting, managing and importing XML files containing homed resource data from a Microsoft Lync Server 2010 SQL database. When they say homed resource data, they mean user contact lists and conference directories. Dbimpexp allows you to import or export users’ contact lists either on a per user basis or a bulk pool-wide basis.
Using dbimpexp.exe
Dbimpexp.exe is located in C:\Program Files\Common Files\Microsoft Lync Server 2010\Support on a Lync Front End Server. You’ll be running it on one of your Enterprise Edition Front End servers or your Standard Edition server to export or import users’ contact lists.
The commands are slightly different for Standard and Enterprise Edition Front Ends, so I’ll cover both in the following sections.
Exporting Contact Lists
So the first thing we want to do is get those contact lists out of one server/pool so we can have them stored to restore in the event of failure, or so we can import them into a new server where the SIP domain is the same. We can export the contact list of an individual or the contact lists of all users on the server/pool.
Standard Edition
For Lync Server Standard Edition, we run the following commands to export users’ contact lists.
For a Single User
This will export out an XML file of the contact list for the single user you specify:
dbimpexp.exe /user:<sip address> /hrxmlfile:”<path that you want to write the xml file to>”
So an example of this would be:
dbimpexp.exe /user:jmorris@justin-morris.net /hrxmlfile:”C:\justin.xml”
For all users homed on the server
This will export out an XML files of all users’ contact lists on the server/pool:
dbimpexp.exe /hrxmlfile:”<path that you want to write the xml file to>”
An example of this would be:
dbimpexp.exe /hrxmlfile:”C:\allusers.xml”
Enterprise Edition
For Lync Server Enterprise Edition, we need to specify the backend SQL instance to connect to that the rtc database resides on. Run the following commands to export users’ contact lists from your Enterprise Edition Front End pool:
For a Single User
This will export out an XML file of the contact list for the single user you specify:
dbimpexp.exe /user:<sip address> /sqlserver:”<SQL Server FQDN\instance name>” /hrxmlfile:”<path that you want to write the xml file to>”
So an example of this would be:
dbimpexp.exe /user:justin@justin-morris.net /sqlserver:”SQL01.justin-morris.net\LYNC” /hrxmlfile:”C:\justin.xml”
For all users homed on the pool
This will export out an XML files of all users’ contact lists on the server/pool:
dbimpexp.exe /sqlserver:”<SQL Server FQDN\instance name>” /hrxmlfile:”<path that you want to write the xml file to>”
So an example of this would be:
dbimpexp.exe /sqlserver:”SQL01.justin-morris.net\LYNC” /hrxmlfile:”C:\justin.xml”
Importing Contact Lists
So now that we’ve exported our contact lists from the source server/pool, we can take the XML files that dbimpexp has created and import the contact lists into the target server/pool.
The only difference between the export and import commands is that to import users, you need to specify the /import switch and the restore type switch of /restype:user (which is different from /restype:all which will attempt to import the conference directories also).
Standard Edition
For Lync Server Standard Edition, we run the following commands to import users’ contact lists.
For a Single User
This will import the contact list from the XML file for the single user you specify:
dbimpexp.exe /import /user:<sip address> /hrxmlfile:”<path where the xml file resides>” /restype:user
So an example of this would be:
dbimpexp.exe /import /user:jmorris@justin-morris.net /hrxmlfile:”C:\justin.xml” /restype:user
For all users homed on the server
This will import all users’ contact lists on the server/pool from the XML file you specify:
dbimpexp.exe /import /hrxmlfile:”<path where the xml file resides>” /restype:user
An example of this would be:
dbimpexp.exe /import /hrxmlfile:”C:\allusers.xml” /restype:user
Enterprise Edition
For Lync Server Enterprise Edition, we run the following commands to import users’ contact lists.
For a Single User
This will import the contact list from the XML file for the single user you specify:
dbimpexp.exe /import /user:<sip address> /sqlserver:”<SQL Server FQDN\instance name>” /hrxmlfile:”<path where the xml file resides>” /restype:user
So an example of this would be:
dbimpexp.exe /import /user:justin@justin-morris.net /sqlserver:”SQL01.justin-morris.net\LYNC” /hrxmlfile:”C:\justin.xml” /restype:user
For all users homed on the pool
This will import all users’ contact lists on the server/pool from the XML file you specify:
dbimpexp.exe /import /sqlserver:”<SQL Server FQDN\instance name>” /hrxmlfile:”<path where the xml file resides>” /restype:user
So an example of this would be:
dbimpexp.exe /sqlserver:”SQL01.justin-morris.net\LYNC” /hrxmlfile:”C:\allusers.xml” /restype:user
Conclusion
So as you can see, it’s a really good tool to have up your sleeve. It’s great for restoring data after you’ve had to do a force move of users or have just rebuilt a new server and have a working Front End ready to go.
If you’ve got any questions about how it works or when you’d need to use it, drop me a comment below.