Share via

Restore procedure on a database when replication is enabled

Mohammed Misselmany 0 Reputation points
2026-04-14T04:46:13.4833333+00:00

Hi,

I have a database in production for an application. Sometimes sometimes requires restores. Replication is enabled on the server as there is an ELT tool replicating the data to a data warehouse. There are 2 databases which are the Publishers but there are no subscribers anywhere as Replication is only required for the ELT tool.

I'd like some guidance regarding the procedure for restoring the database in a way that doesn't break replication. Are there special steps required after restoring the database? Because I know that the distribution database and the publisher database will be out of sync (i.e. the publisher will be behind)

I have been reading this documentation and from my understanding, this would be the procedure. I believe a lot of the steps can actually be skipped as there are no subscribers:

  1. Run the restore as I would usually.
  2. After restore is complete, I run the sp_replrestart procedure as stated in step 5c of the documentation to synchronise the Publisher and Distributor
  3. The restore is complete

Help with this is greatly appreciated. Thank you.

SQL Server Database Engine
0 comments No comments

1 answer

Sort by: Most helpful
  1. Marcin Policht 85,990 Reputation points MVP Volunteer Moderator
    2026-04-14T22:02:08.2366667+00:00

    Your assessment is accurate for your specific environment. Since your replication setup is intended for an ELT tool without standard SQL Server subscribers, you avoid the complexities of resynchronizing downstream databases. The primary hurdle during a restore is the LSN mismatch between the restored publisher and the distributor.

    You should perform your restore as you normally would. If you are restoring over the existing database on the same server, the replication metadata is generally preserved, but the Log Reader Agent will fail because it is looking for a log sequence that the restored database does not yet have.

    Immediately after the restore is finished, run EXEC sp_replrestart within the context of the restored publisher database.

    This procedure is designed for this scenario. It synchronizes the metadata between the publisher and the distributor by resetting the tracking points. This tells the Log Reader Agent to start its next scan at the end of the current transaction log of the restored database, effectively skipping any "future" transactions that were in the distributor prior to the restore.

    Be aware that your ELT tool might encounter data consistency issues. Because the publisher has traveled back in time, any transactions that occurred after the backup was taken but before the restore started are gone from the source. However, if those transactions were already captured by the distributor, the ELT tool might still attempt to process them. Depending on how your ELT tool tracks its own progress, you may need to clear the distribution database or perform a fresh metadata sync within the tool itself to ensure it doesn't try to apply changes to the data warehouse that no longer exist in your production source.


    If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.

    hth

    Marcin


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.