I am trying to use Get-VBRSQLDatabase in a script that looks for a database in the latest restore points available in a SQL backup.
This works, however I get warnings about Get-VBRSQLDatabase being obsolete and to use Get-VESQLDatabase instead.
Get-VESQLDatabase does not appear to offer the same functionality as Get-VBRSQLDatabase as it only seems to allow for checking an existing restore session and not just checking existing backup restore points for databases.
So... if I use Get-VBRSQLDatabase, will it be removed eventually and my script will fail? Is there an equivalent non-obsolete cmdlet to search restore points for databases?
Also, this backup is of an Availibility Group and only 1 node has the active database at any given time. Is there a powershell way to determine which node backup restore points contain the database most recently?
-
- Enthusiast
- Posts: 30
- Liked: 2 times
- Joined: Mar 20, 2018 1:19 pm
- Full Name: Colin Small
- Contact:
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Mar 07, 2019 12:49 pm
- Full Name: Bohumil Bily
- Contact:
Powershell script Restore database to another server
Hi
I have problem with powershell scripts after last Veeam update.
When i need restore SQL database to another server with powershell, i need change files name and path.
But i dont know how to make it.
Before the Veeam update, the file names was changed automatically.
Some lines from my code...
Thnank you
I have problem with powershell scripts after last Veeam update.
When i need restore SQL database to another server with powershell, i need change files name and path.
But i dont know how to make it.
Before the Veeam update, the file names was changed automatically.
Some lines from my code...
Code: Select all
$Files = Get-VESQLDatabaseFile $Database
Path Type
---- ----
H:\SQLData\Test.mdf Primary
I:\SQLLogs\Test.ldf Secondary
$Files[1].path = "G:\SQLData\Test3.mdf"
'path' is a ReadOnly property.
Restore-VESQLDatabase -Database $Database -DatabaseName "Test" -ServerName "SRV-SQL-TEST2" -GuestCredentials $MySecureCreds -file $Files
Restore-VESQLDatabase : Missed database restore paths (File Exists on source db, or i need change drive letter on second server...)
-
- Lurker
- Posts: 2
- Liked: never
- Joined: Mar 07, 2019 12:49 pm
- Full Name: Bohumil Bily
- Contact:
Re: Get-VBRSQLDatabase v.s. Get-VESQLDatabase
Hi,
I'm trying the same thing.
Maybe it will help.
Now I would like to change the location and title for each file, but that still can not be done.
I'm trying the same thing.
Maybe it will help.
Code: Select all
Connect-VBRServer -Server "SRV.doman" -ErrorAction SilentlyContinue
$restorepoint = Get-VBRApplicationRestorePoint -SQL | Where-Object name -eq "Test-SQL" | Sort-Object CreationTime
$restorepoint
Start-VESQLRestoreSession -RestorePoint $restorepoint[$restorepoint.Count-1]
$session = Get-VESQLRestoreSession
$session[0]
$Database = Get-VESQLDatabase -Session $session[0] | Where-Object name -eq "Test-db"
Restore-VESQLDatabase -Database $Database -DatabaseName "Test-Restore" -ServerName "Test-SQL2" -GuestCredentials $MySecureCreds -TargetFolder "D:\Backup"
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Get-VBRSQLDatabase v.s. Get-VESQLDatabase
Actually this can be done, check this post for more information. Thanks!
Who is online
Users browsing this forum: Bing [Bot] and 12 guests