Skip to content

Latest commit

 

History

History
54 lines (41 loc) · 2.98 KB

File metadata and controls

54 lines (41 loc) · 2.98 KB
title MSSQL_ENG003165
description MSSQL_ENG003165
author MashaMSFT
ms.author mathoma
ms.date 09/25/2024
ms.service sql
ms.subservice replication
ms.topic reference
ms.custom
updatefrequency5
helpviewer_keywords
MSSQL_ENG003165 error
monikerRange =azuresqldb-mi-current||>=sql-server-2016

MSSQL_ENG003165

[!INCLUDE SQL Server SQL MI]

Message Details

Attribute Value
Product Name SQL Server
Event ID 3165
Event Source MSSQLSERVER
Component [!INCLUDEssDEnoversion]
Symbolic Name
Message Text Database '%ls' was restored; however, an error was encountered while replication was being restored/removed. The database has been left offline. See the topic MSSQL_ENG003165 in SQL Server Books Online.

Explanation

This error is raised if a problem occurs restoring a backup of a replicated database:

  • If the backup is being restored to the same database and server on which it was taken, the error indicates that replication settings could not be restored properly.

  • If the backup is being restored to a different database or server, the error indicates that replication settings could not be removed properly (by default, replication settings are removed if the database or server is different).

The error is probably the result of a mismatch between the state of the restored database and one or more system databases that contain replication metadata: msdb, master, or the distribution database.

User Action

To resolve this issue:

  1. Execute ALTER DATABASE to bring the database online; for example: ALTER DATABASE AdventureWorks SET ONLINE. For more information, see ALTER DATABASE (Transact-SQL). If you want to preserve replication settings, go to step 2. If not, go to step 3.

  2. Execute sp_restoredbreplication (Transact-SQL). If this stored procedure executes successfully, the restore is complete. If it does not execute successfully, go to step 3.

  3. Execute sp_removedbreplication (Transact-SQL) to remove all replication settings.

    Reconfigure replication if necessary. If you have scripted the replication topology as recommended, use scripts to reconfigure the topology.

Related content