Sitecore 10.1 Upgrade: Could not find stored procedure xdb_collection.GetContactsByIdentifiersTvp_V_10_1_0

In the process of upgrading a 9.3 instance to 10.1, we chose to create copies of the 9.3 databases and upgrade those, leaving the 9.3 DBs intact. Then, we could just simply point the upgraded 10.1 instance to these new databases. All was going pretty well with this approach until I started seeing this error in the xConnect logs:

Could not find stored procedure 'xdb_collection.GetContactsByIdentifiersTvp_V_10_1_0'.

When executing the upgrade scripts against the shard databases, I knew I’d seen a block that created this stored procedure, so I went and looked at the shards.

So, the stored procedure is actually there, what the hell??

Thankfully, @ChristopherAuer had run into this exact issue a few days prior and pointed me in the right direction… If you look at the DatabaseName column in the __ShardManagement.ShardsGlobal table in the ShardMapManagerDb, it holds the database names of the shards.

Since we had created copies of our 9.3 databases with different names, the ShardMapManagerDb was still pointing at the old databases. Thankfully, this is a very easy fix!

Step 1: Update the database names in the ShardMapManagerDb as well as the Shard* databases

UPDATE 	[Mcc10.Sitecore.Xdb.Collection.ShardMapManagerDb].[__ShardManagement].[ShardsGlobal] 
SET 	DatabaseName = 'Mcc10.Sitecore.Xdb.Collection.Shard0' 
WHERE 	DatabaseName = 'MCC.Sitecore.Xdb.Collection.Shard0' 

UPDATE 	[Mcc10.Sitecore.Xdb.Collection.ShardMapManagerDb].[__ShardManagement].[ShardsGlobal] 
SET 	DatabaseName = 'Mcc10.Sitecore.Xdb.Collection.Shard1' 
WHERE 	DatabaseName = 'MCC.Sitecore.Xdb.Collection.Shard1' 

UPDATE 	[Mcc10.Sitecore.Xdb.Collection.Shard0].[__ShardManagement].[ShardsLocal] 
SET 	DatabaseName = 'Mcc10.Sitecore.Xdb.Collection.Shard0' 

UPDATE 	[Mcc10.Sitecore.Xdb.Collection.Shard1].[__ShardManagement].[ShardsLocal] 
SET 	DatabaseName = 'Mcc10.Sitecore.Xdb.Collection.Shard1'

Step 2: Rebuild the xDB Indexes

Once you have changed the database names in the tables, you need to rebuild the xDB indexes using the xConnect Search Index Worker role, per the Sitecore documentation. This will essentially boil down to executing the following command:

<search worker service root>\App_Data\jobs\continuous\IndexWorker\Sitecore.XConnectSearchIndexer.exe -requestrebuild

However, please refer to the documentation for more details. Or, if you’re using Azure Search, the instructions might be slightly different.

Happy Sitecore trails, my friend!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: