How to prevent data loss coming from forced manual failover
Автор: ARSLANOV
Загружено: 2023-08-12
Просмотров: 1159
In this video, we will learn how to prevent data loss when you do forced manual failover to DR site asynchronous replica.
Below is tablediff command
=====================
USE distributeddb
GO
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
-- Run the difference command
SET QUOTED_IDENTIFIER ON
DECLARE @TableNames as table (
id int identity(1,1),
tableName varchar(100))
DECLARE @sTableDiff nvarchar(1000)
DECLARE @tableName varchar(100)
DECLARE @counter int
DECLARE @maxCount int
INSERT INTo @TableNames
SELECT name
FROM sysobjects WHERE type = 'U'
SET @counter = 1
SELECT @maxCount = COUNT(name)
FROM sysobjects WHERE type = 'U'
WHILE @counter @maxCount -- please add bigger sign here to make maxcount bigger
Begin
SELECT @tableName = tableName
FROM @TableNames
WHERE id = @counter
-- You should make sure that SQL Server service account has access to the location specified in '-f'
SET @sTableDiff= ' "C:\Program Files\Microsoft SQL Server\150\COM\tablediff" -sourceserver AG2019-SQLVM-1 -sourcedatabase distributeddb_snapshot -sourcetable ' + @tableName + ' -destinationserver AG2019-SQLVM-1 -destinationdatabase distributeddb -destinationtable ' + @tableName + ' -f F:\diff'
EXEC XP_CMDSHELL @sTableDiff
Set @counter = @counter + 1
End
-- To allow advanced options to be changed.
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To disable the feature.
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
📚 ►Full course on Troubleshooting sessions: • Troubleshooting
📷 ►Follow me on Instagram - https://www.instagram.com/arslanov_bo...
🧑💼►Follow me on LinkedIn - / bobirmirzo-arslanov-548960173
Watch all my playlists here:
🚀►Full course on Encrypting connections to SQL Server- • Full course on Encrypting connections to S...
🚀 ►SQL Server replication session: • SQL Server replication
🚀 ►SQL Server Always On Availability Group: • SQL Server Always On Availability Groups (AG)
🚀 ► SQL Server internals: • SQL Internals
🚀 ► Course in On-memory OLTP: • Course on In-Memory OLTP
Доступные форматы для скачивания:
Скачать видео mp4
-
Информация по загрузке: