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 »

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
Product Manager
Posts: 2578
Liked: 707 times
Joined: Jun 14, 2013 9:30 am
Full Name: Egor Yakovlev
Location: Prague, Czech Republic
Contact:

Re: Restore current copy

Post by Egor Yakovlev »

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: 2010
Liked: 670 times
Joined: Sep 25, 2019 10:32 am
Full Name: Oleg Feoktistov
Contact:

Re: Restore current copy

Post by oleg.feoktistov » 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: masahide.k and 15 guests