I wonder if someone could point me to the right direction concerning point-in-time restore of an SQLServer database.
Code: Select all
$ServerName = "<my restore machine>"
$InstanceName = " " # If you have default instance, use " "
$DatabaseName = "DatabaseToRestore"
$DatabaseNameNew = "$($DatabaseName)_new"
$Restore_VM = "<Name of vm machine name>"
#OS and SQL Credentials, these must be stored in the credentials store in Veeam
$guestcreds = Get-VBRCredentials -Name "domain\name"
$sqlcreds = Get-VBRCredentials -Name "domain\name"
#Adjust after the WHERE clause for the right date.
$Restore = Get-VBRApplicationRestorePoint -Name "<Name of vm machine name>" -SQL | Where {$_.CreationTime.year -like "2018" -and $_.CreationTime.month -like "2" -and $_.CreationTime.day -like "24"}
$DBRestorePoint = Get-VBRSQLDatabase -ApplicationRestorePoint $Restore[0] -Name $DatabaseName
Get-VBRSQLDatabaseRestoreInterval -Database $DBRestorePoint
The "Get-VBRSQLDatabaseRestoreInterval -Database $DBRestorePoint" command returns:
FromUTC ToUTC
------- -----
24.2.2018 22:27:28 24.2.2018 22:27:28
Which is basically the point of the snapshot image.
Is there another method to retrieve am more broader timeframe. My goal is to automate restore through powershell scripts, preferably some point in time.