In this article, I will share with you how to move an existing protected server with DPM to another DPM server and solve the following issue:
One or more of the selected data sources are already configured for protection on the primary DPM server. When you switch back protection, the replicas of these data sources will be protected from the primary DPM server. (ID: 31162).
Table of Contents
Introduction
System Center 2019 Data Protection Manager (SCDPM) is the latest release by Microsoft and with it comes a lot of improvements and new features. You can read more about what’s new in System Center 2019 Data Protection Manager here.
SCDPM is well recognized in the industry for the protection of Microsoft workloads and environments. With SCDPM 2019, you can protect application workloads such as Hyper-V VMs, Microsoft SQL Server, SharePoint Server, Microsoft Exchange, VMware VMs, Windows Server, and Windows clients to:
- Disk (D2D) giving the high Recovery Time Objectives (RTOs) for tier 1 workloads, short-term protection on-premises.
- Tape (D2D2T) for long-term online and off-site protection (Physical/Virtual Tape).
- Azure (D2D2C) for long-term online and off-site protection.
For more information on how to install System Center 2019 Data Protection Manager on Windows Server 2019, please check the following step-by-step guide.
I have recently come across a scenario where my primary DPM server failed due to hardware failure. In the same environment, I have another (standalone) DPM server sitting idle where I can use it to re-protect my production servers.
Since the primary DPM server is not available anymore, I went to the protected servers and re-point the DPM agent to the new DPM server using the (SetDPMServer.exe -dpmServerName DPMServerName) command.
When I am creating a new protection group and selected the data source, I received the following warning:
One or more of the selected data sources are already configured for protection on the primary DPM server. When you switch back protection, the replicas of these data sources will be protected from the primary DPM server. (ID: 31162).
The data source cannot be protected because it is still blocked by the failed DPM server.
Cause of the issue
After some digging, I have found that the problem was the DPM agent on the protected server communicated to the new DPM server that it was already protected by another DPM server and wrote it in the DPMDB on the secondary DPM server.
The entries of the protected data source on the primary DPM server could not directly protect on the secondary DPM server.
Please note that I am not using DPM Chaining (Primary/Secondary) in this environment. Additionally, moving protected servers between DPM servers that are under secondary protection isn’t supported. Please check the official documentation from Microsoft here to understand the different scenarios.
Resolution
To fix this issue, you need to take the following steps:
- First, you need to take a backup of the DPM database. This is a very important step before you proceed with the remaining steps.
- Update the DPM agent.
- Run the SQL query below to delete the entries of the protected server for the primary DPM server on the secondary (standalone) DPM server.
Please note that this workaround is NOT supported by Microsoft. Use the instructions below at your own risk, except and only when you are specifically instructed by Microsoft technical support specialist to do this.
SQL Query
You need to change the following two items in the script below:
- old-dpm.domain.com – Replace with FQDN of the original primary DPM server name in your environment (which no longer exists).
- protected-srv1.domain.com – Replace with FQDN of protected server or cluster name you want to clean up.
The SQL query that you want to run is the following:
-- Script to cleanup 'secondary protection history' from a DPM server
USE DPMDB -- Verify this is correct if using remote SQL server instance.
DECLARE @PrimaryDPMName NVARCHAR(400)
DECLARE @PSName NVARCHAR(400)
DECLARE @HyperVCLUSTERName NVARCHAR(400)
SET @HyperVCLUSTERName = 'default'
-- Provide the actual values below before running.
-- @PrimaryDPMName is the name of the DPM server which was protecting this PS primarily.
-- @PSName is the name of the production server for which the history has to be cleaned up.
-- In the case of a clustered resource, you need to run this shell script a minimum of three times and change the
-- @PSname variable to include:
-- Node1.domain.com
-- Node2.domain.com
-- Cluster-resource.cluster.domain.com
-- @HyperVCLUSTERName is OPTIONAL and is ONLY used to cleanup a Hyper-V Cluster resources, un-comment that line and run the script after all other -- cleanup work was done.
-- BE SURE TO INCLUDE THE '% %' around the hyper-V cluster name
SET @PrimaryDPMName = 'old-dpm.domain.com' --replace with FQDN of original primary dpm server name
SET @PSName = 'protected-srv1.domain.com' -- replace with FQDN of protected server name you want to cleanup
--SET @HyperVCLUSTERName = '%optional%' -- OPTIONAL - replace with '%FQDN_CLUSTER_NAME%' of the Hyer-V cluster only.
-- Step 1:
-- Check whether all the datasources from the PS of interest are in stop protected state on not.
-- Get the Secondary DPM Server ID
DECLARE @SecondaryDPMServerId Guid
DECLARE @error INT
SET @error = 0
SELECT @SecondaryDPMServerId = ServerId
FROM tbl_AM_Server
WHERE ServerId = DPMServerId
AND IsDPM = 1
AND MarkedForDeletion = 0
SELECT @error = dbo.udf_DPS_CheckRowCount(1)
IF (@error <> 0)
BEGIN
PRINT 'Could not get the secondary DPM ServerId. Aborting.'
GOTO _Exit
END
-- Get the Primary DPM Server ID
DECLARE @PrimaryDPMServerId Guid
SET @error = 0
SELECT @PrimaryDPMServerId = ServerId
FROM tbl_AM_Server
WHERE DPMServerId = @SecondaryDPMServerId
AND ServerId <> @SecondaryDPMServerId
AND ServerName = @PrimaryDPMName
AND IsDPM = 1
AND MarkedForDeletion = 0
SELECT @error = dbo.udf_DPS_CheckRowCount(1)
IF (@error <> 0)
BEGIN
PRINT 'Could not get the primary DPM ServerId for server ' + @PrimaryDPMName + '. Exiting...'
GOTO _Exit
END
-- Locate the PS of interest
DECLARE @ServerId Guid
SET @error = 0
SELECT @ServerId = ServerId
FROM tbl_AM_Server
WHERE ServerName = @PSName
AND MarkedForDeletion = 0
SELECT @error = dbo.udf_DPS_CheckRowCount(1)
IF (@error <> 0)
BEGIN
PRINT 'Could not find the production server '+ @PSName + '. Aborting.'
GOTO _Exit
END
-- Get all the datasources protected from this server
DECLARE @ProtectedDSCount INT
SET @ProtectedDSCount = 0
SELECT @ProtectedDSCount = COUNT(DS.DataSourceId)
FROM tbl_IM_DataSource DS
WHERE DS.ProtectedGroupId IS NOT NULL
AND DS.ServerId = @ServerId
IF (@ProtectedDSCount <> 0)
BEGIN
SELECT 'Following datasources are actively protected.' +
' Execute this script after stopping their protection with retain data.'
AS ErrorMessage
SELECT DS.DataSourceName AS Datasource,
AM.ServerName AS OnServer,
PG.FriendlyName AS ProtectedInPG
FROM tbl_IM_DataSource DS
JOIN tbl_AM_Server AM
ON AM.ServerId = DS.ServerId
JOIN tbl_IM_ProtectedGroup PG
ON PG.ProtectedGroupId = DS.ProtectedGroupId
WHERE DS.ProtectedGroupId IS NOT NULL
AND DS.ServerId = @ServerId
GOTO _Exit
END
-- Step 2:
-- Cleanup the tables
-- Delete the DatasourceVolume entries corresponding to the PS-datasource and
-- PrimaryDPM-replicavolume
SET @error = 0
DELETE tbl_IM_DatasourceVolume
FROM tbl_IM_DatasourceVolume DsVol
JOIN tbl_IM_Volume Vol
ON DsVol.VolumeId = Vol.VolumeId
JOIN tbl_IM_DPMDatasourceReplicaProperties DSProp
ON DsVol.DataSourceId = DSProp.DataSourceId
JOIN tbl_IM_DataSource DS
ON DS.DataSourceId = DSProp.DataSourceId
WHERE DSProp.ServerId = @PrimaryDPMServerId
AND Vol.ServerId = @PrimaryDPMServerId
AND DS.ServerId = @ServerId
SELECT @error = @@ERROR
IF (@error > 0)
BEGIN
PRINT 'Could not clean up the DatasourceVolume entries.'
PRINT 'Errorcode: ' + CAST(@error AS varchar(10))
GOTO _Exit
END
-- Delete the entries in tbl_IM_DPMDatasourceReplicaProperties
SET @error = 0
DELETE tbl_IM_DPMDatasourceReplicaProperties
FROM tbl_IM_DataSource DS
JOIN tbl_IM_DPMDatasourceReplicaProperties DSProp
ON DS.DataSourceId = DSProp.DataSourceId
WHERE DSProp.ServerId = @PrimaryDPMServerId
AND DS.ServerId = @ServerId
SELECT @error = @@ERROR
IF (@error > 0)
BEGIN
PRINT 'Could not clean up the DPMDatasourceReplicaProperties table. '
PRINT 'Errorcode:' + CAST(@error AS varchar(10))
END
-- ADDED 2-28-13 to cleanup Hyper-V cluster resources
-- Delete the entries in tbl_IM_DPMDatasourceReplicaProperties for HyperV clustered resources associated with Hyper-V cluster
-- Skip this section if @HyperVCLUSTERName = 'default'
IF @HyperVCLUSTERName = 'default'
goto _exit
-- check to see if @HyperVCLUSTERName entered matches known hyper-v clusters
DECLARE @ClusterCount INT
SET @ClusterCount = 0
SELECT @ClusterCount = COUNT(cd.Clustername)
FROM dbo.tbl_AM_ClusterDetail cd
WHERE Clustername like @HyperVCLUSTERName
and Isdag = 0
IF (@ClusterCount = 0)
begin
PRINT 'Could not get the HyperV Cluster name like ' + @HyperVCLUSTERName + '. Aborting.'
goto _exit
end
-- Now start clean up of Hyper-v data sources associated with @HyperVCLUSTERName
SET @error = 0
delete tbl_IM_DPMDatasourceReplicaProperties
where DataSourceId in (select Datasourceid from dbo.tbl_IM_DataSource ds
join dbo.tbl_AM_Server AM on ds.ServerId = am.ServerId
where am.ServerName like @HyperVCLUSTERName)
SELECT @error = @@ERROR
IF (@error > 0)
BEGIN
PRINT 'Could not clean up the DPMDatasourceReplicaProperties table. '
PRINT 'Errorcode:' + CAST(@error AS varchar(10))
END
_Exit:
PRINT 'Exiting...'
-- SCRIPT ENDS HERE
Finally, try to re-protect the protected server to the new DPM server and you should be able to select the data source that you want to protect again.
Hope this helps!
Learn more
Do you want to learn more about System Center Data Protection Manager and how to create a hybrid-cloud backup solution? Make sure to check my recently published book: Microsoft System Center Data Protection Manager Cookbook.
With this book (over 450 pages) on your side, you will master the world of backup with System Center Data Protection Manager and Microsoft Azure Backup Server deployment and management by learning tips, tricks, and best practices, especially when it comes to advanced-level tasks.
__
Thank you for reading my blog.
If you have any questions or feedback, please leave a comment.
-Charbel Nemnom-
Hi Charbel, is it possible to protect VMs on same DPM server? i set the property Set-DPMGlobalProperty -AllowLocalDataProtection but still not working. Thank you for your posts
Hello Arturo,
Could you please give me more details on what are you trying to accomplish here?
What do you mean by (protect VMs on the same DPM server)?
Thanks!
As per usual Mr. Nemnom a brilliant article that solved my issue. Thank you, How your average DPM Admin is supposed to fix that without your SQL script heaven only knows… Hey, Mr. Microsoft what the heck?
As per usual Mr. Nemnom, a superb article that fixed my problem. How your average DPM Admin is supposed to work this out who knows. Hey Mr. Microsoft – sort this out :-)
Hello Tim, thanks for the feedback! I am happy to hear your issue is resolved with this script!