Restore-VESQLDatabase
Short Description
Restores backed-up Microsoft SQL databases.
Applies to
Veeam Backup & Replication
Product Edition: Enterprise, Enterprise Plus, Veeam Universal License
Syntax
Restore-VESQLDatabase [-Database] <VESQLDatabase> [-DatabaseName <string>] [-ServerName <string>] [-InstanceName <string>] [-Port <int>] [-SqlCredentials <pscredential>] [-UseSQLAuthentication] [-GuestCredentials <pscredential>] [-ToPointInTimeUtc <datetime>] [-AvailabilityGroupName <string>] [-TargetFolder <string>] [-File <VESQLDatabaseFile[]>] [-TargetPath <string[]>] [-Force] [-RecoveryState {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 object. 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. | Accepts the PSCredential object. To get this object, run the Get-Credential cmdlet. | False | Named | False | False |
UseSQLAuthentication | Defines 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. | Accepts the PSCredential object. To get this object, run the Get-Credential cmdlet. | False | Named | False | False |
ToPointInTimeUtc | Specifies the point in time in UTC 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[] object. 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:
| String[] | False | Named | False | False |
Force | Defines 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.
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
Example 1. Restoring to Original Location
This example shows how to restore a Microsoft SQL database to the original location. The restore session will run with the following settings:
Perform the following steps:
The Get-VESQLRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Example 2. Restoring to Specific Folder
This example shows how to restore a Microsoft SQL database to the specific folder. The SQL credentials are used to authenticate against the guest OS and a Microsoft SQL server.
Perform the following steps:
The Get-VESQLRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Example 3. Restoring to Specific Array
This example shows how to restore Microsoft SQL database files to the specific array. The restore session will run with the following options:
Perform the following steps:
The Get-VESQLRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Example 4. Restoring to Latest Restore Point
This example shows how to restore Microsoft SQL database files to the latest restore point.
Perform the following steps:
The Get-VESQLRestoreSession cmdlet will return an array of restore sessions. Mind the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Related Commands