I am using SMO Backup and Restore objects to manage backup and restore workflows for SQL Server. Even though the NoRecovery
property of my Restore
object is set to false
, if the ToPointInTime
is set, the database is left in a "Recovering" state.
Does anyone know why this is or the proper way to restore a database to a point in time using the SMO Restore object?
The problem was that I was not restoring the database up until the specified point in time (per the timezone of the SQL Server on which the database resides). Once the database had been restored to that state, it was automatically taken out of the "Recovering" state. I guess this makes sense, but I think it's worth noting that if you try to apply any additional restores after that point, an exception will be thrown since the database is not in a "Recovering" state.