We get this error in our test environment when restoring a copy only backup file from production.
Screendump of SQL Server log
It doesn’t happen all the time and I can see no pattern. This started to happen after we made a change in production from ordinary SQL backups to Veem backups. To get a backup file to restore in test environment we take an standard SQL copy only backup. Even stranger is that the same backup file can be successfully restored in another database on the same test server (then without the RemoveStaleDbEntries message).
Our problem is that restores are made via Azure DevOps pipelines (using PowerShell commands) that are run on schedule during the night and when it happens we must manually fix it using SSMS the next morning. If this can be handled in some way it will reduce the time it takes to restore in test environment (several hours to redo).
We are using SQL Server 2022 Standard Edition (build 16.0.4131.2) running on a Windows 2022 Server.
3