Help Center
Choose product document...
Veeam Backup & Replication 9.5 [Archived]
PowerShell Reference

Start-VBRSQLDatabaseRestore

Short Description

Starts Microsoft SQL database restore.

Applies to

Platform: VMware, Hyper-V

Product Edition: Standard, Enterprise, Enterprise Plus

Syntax

This cmdlet provides two parameter sets.

  • For restoring to the original location:

Start-VBRSQLDatabaseRestore -Database <VBRSQLDatabase> [-GuestCredentials <CInternalCredentials>] [-SqlCredentials <CInternalCredentials>] [-ToPointInTime <datetime>] [-Force] [-Wait] [<CommonParameters>]

  • For restoring to another location:

Start-VBRSQLDatabaseRestore -Database <VBRSQLDatabase> [-ServerName <string>] [-InstanceName <string>] [-DatabaseName <string>] [-GuestCredentials <CInternalCredentials>] [-SqlCredentials <CInternalCredentials>] [-ToPointInTime <datetime>] [-Force] [-Wait] [<CommonParameters>]

Detailed Description

This cmdlet starts restore of a selected SQL database.

Parameters

Parameter

Description

Required

Position

Accept
Pipeline
Input

Accept
Wildcard
Characters

Database

Specifies the database you want to restore.

Accepts VBRSQLDatabase type.

True

Named

True (ByValue,
ByProperty
Name)

False

ServerName

Used for restoring to another location.

Specifies the name of the target server. The database will be restored to that server.

False

Named

False

False

InstanceName

Used for restoring to another location.

Specifies the name of the instance. The database will be restored to that instance.

False

Named

False

False

DatabaseName

Used for restoring to another location.

Specifies the new name of the database. The database will be restored with that name.

False

Named

False

False

Guest
Credentials

Specifies the user credentials to authenticate with the target server.

If not specified, Veeam will use the credentials indicated in the backup job settings.

False

Named

False

False

SqlCredentials

Specifies the credentials to authenticate with the target SQL instance.

If not specified, Veeam will use the credentials indicated in the backup job settings.

False

Named

False

False

ToPointInTime

Used to restore the database to a specific transaction.

Specifies the time of the transaction

False

Named

False

False

Force

If set, the command will overwrite the existing database with the database from backup.

Note: the cmdlet will show no prompt.

False

Named

False

False

Wait

Indicates that the command waits for the process to complete before accepting more input.

False

Named

False

False

<CommonParameters>

This cmdlet supports Microsoft PowerShell common parameters. For more information about common parameters, see http://go.microsoft.com/fwlink/p/?LinkID=113216.

Return Type

VBRSession

Example

This example shows how to restore a database to a selected point in time to the original location.

  1. Get the database you want to restore.

Run Get-VBRApplicationRestorePoint to get the "CRM_db" restore point. Save it to the $restorepoint variable.

PS C:\PS> $restorepoint = Get-VBRApplicationRestorePoint -SQL -Name "crm_db"

Select the third restore point from the list and run Get-VBRSQLDatabase with the $restorepoint[2] variable to get the database named "Locations". Save it to the $locations_db variable.

PS C:\PS> $locations = Get-VBRSQLDatabase -ApplicationRestorePoint $restorepoint[2] -Name "Locations"

  1. Get the credentials to connect to the server and to the database instance.

Run Get-VBRCredentials to get the credentials to authenticate with the target server. Save it to the $guestcreds variable.

Run Get-VBRCredentials to get the credentials to authenticate with the Microsoft SQL instance. Save it to the $sqlcreds variable.

PS C:\PS> $guestcreds = Get-VBRCredentials -Name "tech\administrator"

PS C:\PS> $sqlcreds = Get-VBRCredentials -Name "sql_administrator"

  1. Run Get-VBRSQLDatabaseRestoreInterval to check the available restore interval. Select the time to restore the database.

PS C:\PS> Get-VBRSQLDatabaseRestoreInterval -Database $locations

  1. Run Start-VBRSQLDatabaseRestore with the saved variables.

PS C:\PS> Start-VBRSQLDatabaseRestore -Database $locations -GuestCredentials $guestcreds -SqlCredentials $sqlcreds -ToPointInTime "10/28/2015 12:33:39 PM"

Related Commands

Get-VBRSQLDatabase

Get-VBRCredentials

Veeam Large Logo

User Guide for VMware vSphere

User Guide for Microsoft Hyper-V

Enterprise Manager User Guide

Veeam Cloud Connect Guide

Veeam Agent Management Guide

Veeam Backup Explorers User Guide

Backup and Restore of SQL Server Databases

PowerShell Reference

RESTful API Reference

Veeam Backup FREE Edition User Guide