Search code examples
c#.netsmo

How to restore database programatically from backup with multiple files


I have no problem with restoring database programatically (in C# using SMO) from backup containing one file. But when the backup contains multiple files (full and differential backups) I get the following error

The log or differential backup cannot be restored because no files are ready to rollforward

So what should I do to restore database with the latest data?


Solution

  • You will need to set the NoRecovery Option so that it will allow you to restore the rest of the files.

    Check this for reference.