[HOW-TO] Find users published phone numbers in Lync 2013 database
Sometimes you will get a situation when contact cards in Lync client showing wrong phone numbers.
This is because of this menu in Lync client:
No matter of source issue, you must have a tool to investigate what happening in Lync SQL database (as soon as initial data for building Address Book files located there).
From this moment we will be talking about RTC database in RTCLOCAL instance that is located on Front-End server (in Enterprise deployment). Remember that in Enterprise Deployment every specific user can rely on their own "primary" server. If you have Standard deployment - there will be no problems to indentify the server needed.
There is a PublishedStaticInstance table in database which contain published phones information from users. You will have to run two queries against RTC.
SELECT TOP 1000 [ResourceId] ,[UserAtHost] FROM [rtc].[dbo].[Resource] WHERE UserAtHost LIKE 'michael@%'
In this query we searching for ResourceId of user michael. Lets assume that ResourceId will be 1111. Proceed to the next query.
SELECT TOP 1000 [PublisherId],[CategoryId],[ContainerNum],cast(cast([Data] as varbinary(max)) as varchar(max)) as Data FROM [rtc].[dbo].[PublishedStaticInstance] WHERE PublisherId = '1111' AND [CategoryId] = '23'
Copy results table to notepad and save it as .xml document and open it in Internet Explorer.
That will be the data published by Lync client to database.