PowerShell script exchange
Post Reply
krisak8989
Lurker
Posts: 1
Liked: never
Joined: Feb 14, 2020 6:31 am
Contact:

Restore current copy

Post by krisak8989 » Feb 14, 2020 6:55 am

Good afternoon!
Tell me how to restore the current copy of the SQL database using PS?

From the management console, I have the ability to restore the closest point. Via PS, the output of the Get-VBRRestorePoint command does not show the latest recovery points. Log transactions every 15 minutes

Egor Yakovlev
Veeam Software
Posts: 932
Liked: 234 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Contact:

Re: Restore current copy

Post by Egor Yakovlev » Feb 14, 2020 10:57 am

You need to use Start-VESQLRestoreSession, pick a database from mounted backup via Get-VESQLDatabase, find available restore interval Get-VESQLDatabaseRestoreInterval and restore via Restore-VESQLDatabase with -ToPointInTime parameter. Last but not least, stop mounted session via Stop-VESQLRestoreSession.

Check out Veeam Explorer for Microsoft SQL Powershell Reference Guide.

/Cheers!

oleg.feoktistov
Veeam Software
Posts: 144
Liked: 46 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Restore current copy

Post by oleg.feoktistov » Feb 14, 2020 11:15 am 1 person likes this post

Besides, use Get-VBRApplicationRestorePoint rather than Get-VBRRestorePoint to retrieve restore points with AAIP enabled.
Then, filter it by creation time and pass to Start-VESQLRestoreSession, like Egor wrote above.
Example:

Code: Select all

$date = (Get-Date).AddHours(-24)
$restorepoint = Get-VBRApplicationRestorePoint -SQL | where {$_.CreationTime -ge $date}
Start-VESQLRestoreSession -RestorePoint $restorepoint[-1]

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest