dataplat / dbatools

🚀 SQL Server automation and instance migrations have never been safer, faster or freer

Home Page:https://dbatools.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`Restore-DbaDatabase` - Add `WITH RESTART`

mattcargile opened this issue · comments

Summarize Command's Functionality

Implement the restart restoration of log or the like in the event of a reboot or another failure. The T-Sql would look like

RESTORE LOG [db_laghsm] FROM  DISK = N'F:\LogInterrupted.trn' WITH  FILE = 1,  NORECOVERY,  NOUNLOAD,  STATS = 10, RESTART;

Is there a command that is similiar or close to what you are looking for?

No

Technical Details

Maybe one could check for this error upon restoration of a log?

Microsoft.Data.SqlClient.SqlError: A previous restore operation was interrupted and did not complete processing on file 'db_log'. Either restore the backup set that was interrupted or
restart the restore sequence.
At C:\Program Files\WindowsPowerShell\Modules\dbatools\1.1.125\allcommands.ps1:148291 char:9
+         throw $records[0]
+         ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (RemoteServer:String) [], Exception
    + FullyQualifiedErrorId : dbatools_Restore-DbaDatabase

Or maybe there is something in msdb?