Bring back to restoring state an online database
Once you recovered the database, the primary and the secondary diverged. So, you have to restore the LS secondary from a fresh backup of the primary and re-establish LS.
Related videos on Youtube
Hazim Mohammed
Updated on September 18, 2022Comments
-
Hazim Mohammed almost 2 years
I configured logshipping for a database. I did some tests and tried a controlled failover.
During log shipping secondary db is in restoring state.
To have a controlled failover i stopped the primary database. then i put online my secondary db with:
RESTORE DATABASE AdventureWorks WITH RECOVERY
Then stopped the log shipping jobs in the secondary server and pointed my application (a website) to the secondary server.
Everything worked as expected. Now i want to bring back online the primary server: i started the primary server then i pointed the application to the primary server and restarted the logshipping jobs in the secondary server. I only need to set the secondary db in restoring mode but the command:
RESTORE DATABASE AdventureWorks WITH NORECOVERY
and it gives me the error:
The database is already fully recovered. RESTORE DATABASE is terminating abnormally.
do i need to restore a backup in the secondary anyway?
which are the best practice in this case? how do i revert to the initial situation?