Skip to content

Instantly share code, notes, and snippets.

@keyan1603
Created September 20, 2023 18:17
Show Gist options
  • Save keyan1603/8a7fb9ead92fca517c99c525ff952260 to your computer and use it in GitHub Desktop.
Save keyan1603/8a7fb9ead92fca517c99c525ff952260 to your computer and use it in GitHub Desktop.
re-use the Sitecore Shard databases after database restore
# Execute below statement in all the shard DBs
UPDATE [__ShardManagement].[ShardsLocal] SET ServerName ='<new db server name>', DatabaseName = '<restored new shard xDB db name with new prefix>'
# Execute below statement in the ShardMapManager DB against each Shard DB
UPDATE [__ShardManagement].[ShardsGlobal] SET ServerName ='<new db server name>', DatabaseName = '<restored new shard xDB db name with new prefix>' WHERE DatabaseName = '<new shard xDB db1 name with old prefix>'
UPDATE [__ShardManagement].[ShardsGlobal] SET ServerName ='<new db server name>', DatabaseName = '<restored new shard xDB db name with new prefix>' WHERE DatabaseName = '<new shard xDB db2 name with old prefix>'
UPDATE [__ShardManagement].[ShardsGlobal] SET ServerName ='<new db server name>', DatabaseName = '<restored new shard xDB db name with new prefix>' WHERE DatabaseName = '<new shard xDB dbn name with old prefix>'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment