This is an archive version of the document. To get the most up-to-date information, see the current version.

Restore-VESQLDatabase

Short Description

Restores backed-up Microsoft SQL databases.

Applies to Veeam Backup & Replication

Product Edition: Enterprise, Enterprise Plus

Syntax

Restore-VESQLDatabase [-Database] <VESQLDatabase> [-DatabaseName <string>] [-ServerName <string>] [-InstanceName <string>] [-Port <int>] [-SqlCredentials <pscredential>] [-UseSQLAuthentication] [-GuestCredentials <pscredential>] [-ToPointInTime <datetime>] [-AvailabilityGroupName <string>] [-TargetFolder <string>] [-File <VESQLDatabaseFile[]>] [-TargetPath <string[]>] [-Force] [-RecoveryState <RestoreMode> {Recovery | NoRecovery | StandBy}] [-StandbyFilePath <string>]  [<CommonParameters>]

Detailed Description

This cmdlet restores backed-up Microsoft SQL databases. You can restore Microsoft SQL databases to the original location or to another location.

Parameters

Parameter

Description

Type

Required

Position

Accept Pipeline Input

Accept Wildcard Characters

Database

Specifies a Microsoft SQL database. The cmdlet will restore this database.

Accepts the VESQLDatabase type. To get this object, run the Get-VESQLDatabase cmdlet.

True

0

True (ByValue)

False

DatabaseName

For restore to another location.

Specifies a name for a Microsoft SQL database. The cmdlet will restore the database with the specified name.

String

False

Named

False

False

ServerName

For restore to another location.

Specifies a name of a Microsoft SQL target server. The cmdlet will restore a Microsoft SQL database to the specified target server.

String

False

Named

False

False

InstanceName

For restore to another location.

Specifies a name of a target instance. The cmdlet will restore a Microsoft SQL database to the specified target instance.

String

False

Named

False

False

Port

Specifies a port number that will be used to connect to the target Microsoft SQL server.

Int32

False

Named

False

False

SqlCredentials

Specifies SQL credentials to authenticate against a Microsoft SQL server.

Note: If you do not specify SQL credentials, the cmdlet will use current account credentials. If these credentials do not work, the cmdlet will use credentials specified in the backup job.

PSCredential

False

Named

False

False

UseSQLAuthentication

Indicates that the cmdlet will use the SQL authentication to connect to the target Microsoft SQL server.

Note: If you omit this parameter, the cmdlet will use credentials specified in the SqlCredentials parameter to connect to both the Microsoft SQL server and to the guest OS.

SwitchParameter

False

Named

False

False

GuestCredentials

Specifies credentials to authenticate against the target Microsoft SQL server. If these credentials do not work, the cmdlet will use credentials, specified in the backup job.

Note: If you omit this parameter, the cmdlet will use credentials specified in the SqlCredentials parameter or current account credentials to connect to both the Microsoft SQL server and to the guest OS.

PSCredential

False

Named

False

False

ToPointInTime

Specifies the point in time within a restore interval of a Microsoft SQL database.

The cmdlet will restore the database to the state of the specified point in time.

Datetime

False

Named

False

False

AvailabilityGroupName

Specifies the name of the AlwaysOn availability group. The cmdlet will add a Microsoft SQL database to the specified group.

String

False

Named

False

False

TargetFolder

For restore Microsoft SQL database files to one location.

Specifies the folder. The cmdlet will restore all database files to that folder.

Note: This parameter is not available if you use the TargetPath parameter.

String

False

Named

False

False

File

Specifies an array of file names for Microsoft SQL databases.

Accepts the VESQLDatabaseFile[] type. To get this object, run the Get-VESQLDatabaseFile cmdlet.

False

Named

False

False

TargetPath

Specifies a target path array. The cmdlet will restore Microsoft SQL database files to locations, specified in the target path array.

Note:

  • For every Microsoft SQL database file, you must assign the specific file path.
  • This parameter is not available if you use the TargetFolder parameter.

String[]

False

Named

False

False

Force

Indicates that the cmdlet will overwrite an existing Microsoft SQL database with a Microsoft SQL database from a backup.

Note: The cmdlet will show no prompt before executing the command.

SwitchParameter

False

Named

False

False

RecoveryState

Specifies the restore scenario.

  • Recovery - use this option to leave a Microsoft SQL database in the ready to use state. With this option, you will not be able to restore additional transaction logs.
  • NoRecovery - use this option to leave a Microsoft SQL database in the non-operational state and not to roll back uncommitted transactions. Use this option to restore transaction logs that are backed up with the third-party tool.
  • StandBy - use this option to leave a Microsoft SQL database in the read-only mode. It allows you to undo uncommitted transactions. The undo actions are saved in a standby file so that the recovery effects can be reversed.

Default: Recovery.

RestoreMode

False

Named

False

False

StandbyFilePath

For the StandBy parameter.

Specifies a location for the standby file with the uncommitted transactions.

String

False

Named

False

False

<CommonParameters>

This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About Common Parameters section of Microsoft Docs.

Examples

Restore-VESQLDatabaseExample 1. Restoring to Original Location

Restore-VESQLDatabaseExample 2. Restoring to Specific Folder

Restore-VESQLDatabaseExample 3. Restoring to Specific Array

Restore-VESQLDatabaseExample 4. Restoring to Latest Restore Point

Related Commands