Export-VESQLDatabase
Short Description
Exports a backed-up Microsoft SQL Server database.
Applies to
Veeam Backup & Replication
Product Edition: Community, Standard, Enterprise, Enterprise Plus, Veeam Universal License
Syntax
Export-VESQLDatabase [-Database] <VESQLDatabase> -Path <String> [-ToPointInTime <DateTime>] [-ServerName <String>] [-InstanceName <String>] [-Port <Int32>] [-UseSQLAuthentication <SwitchParameter>] [-SqlCredentials <PSCredential>] [-GuestCredentials <PSCredential>] [-ToBackupFile <SwitchParameter>] [-EnableCompression <SwitchParameter>] [-Force <SwitchParameter>] [<CommonParameters>] |
Detailed Description
This cmdlet allows you to export a Microsoft SQL Server database to the machine where the Veeam Backup & Replication console is installed. You can use the following export options:
- Export a Microsoft SQL Server database in the .mdf format. If transaction log backups are available for the selected restore point, they will be exported as well, in the .ldf format.
- Export a Microsoft SQL Server database as a backup (.bak) file. To enable this option, use the ToBackupFile parameter.
Parameters
Parameter | Description | Type | Required | Position | Accept Pipeline Input |
---|---|---|---|---|---|
Database | Specifies a Microsoft SQL Server database that you want to export. | Accepts the VESQLDatabase object. To get this object, run the Get-VESQLDatabase cmdlet. | True | 0 | True (ByValue) |
Path | Specifies the export path on the machine where the Veeam Backup & Replication console is installed. To export your database as a backup (.bak) file, specify the ToBackupFile parameter. Note: To overwrite an existing file in the export destination, use the Force parameter. | String | True | Named | False |
ToPointInTime | Specifies a point in time within the restore interval of a Microsoft SQL Server database. The cmdlet will export the database to the state of the specified point in time. Note: Make sure that the value you assign to this parameter is converted to Universal Coordinated Time (UTC). | DateTime | False | Named | False |
ServerName | Specifies the staging server. | String | False | Named | False |
InstanceName | Specifies the Microsoft SQL Server instance on the staging server that the cmdlet will connect to. | String | False | Named | False |
Port | Specifies a port number that will be used to connect to the staging server. | Int32 | False | Named | False |
SqlCredentials | Specifies SQL credentials for authenticating to Microsoft SQL Server on the staging server. Note: If you do not specify SQL credentials, the cmdlet will use the current account credentials. If these credentials do not work, the cmdlet will use the credentials specified in the backup job. | Accepts the PSCredential object. To get this object, run the Get-Credential cmdlet. | False | Named | False |
UseSQLAuthentication | Defines that the cmdlet will use SQL authentication to connect to Microsoft SQL Server on the staging server. Note: If you omit this parameter, the cmdlet will use the credentials specified in the SQLCredentials parameter to connect to both Microsoft SQL Server and to the guest OS on the staging server. | SwitchParameter | False | Named | False |
GuestCredentials | Specifies credentials for authenticating to the staging server. Consider the following:
| Accepts the PSCredential object. To get this object, run the Get-Credential cmdlet. | False | Named | False |
ToBackupFile | Defines that the cmdlet will export the specified Microsoft SQL Server database as a backup (.bak) file. | SwitchParameter | False | Named | False |
EnableCompression | For the ToBackupFile parameter. Defines that the cmdlet will compress the new backup (.bak) file. Note: This option is available only if your version of Microsoft SQL Server supports the compression option. | SwitchParameter | False | Named | False |
Force | Defines that the cmdlet will overwrite the following files:
Note: The cmdlet will show no prompt before executing the command. | SwitchParameter | False | Named | False |
<CommonParameters>
This cmdlet supports Microsoft PowerShell common parameters. For more information on common parameters, see the About CommonParameters section of Microsoft Docs.
Examples
Example 1. Exporting Microsoft SQL Server Database Files to Latest State
This example shows how to export Microsoft SQL Server database files to the latest state on the backup file. This example uses the backup server as a staging server.
Perform the following steps:
The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Example 2. Exporting Microsoft SQL Server Database to Latest State as .bak File
This example shows how to export a Microsoft SQL Server database to the latest state on the backup file. The database is exported as a .bak file. This example uses SQL credentials to authenticate to the guest OS and Microsoft SQL Server on the staging server.
Perform the following steps:
The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
|
Example 3. Exporting Microsoft SQL Server Database Files to Specific Point in Time
This example shows how to export Microsoft SQL Server database files to a specific point in time state.
Perform the following steps:
The cmdlet will return an array of restore sessions. Note the ordinal number of the necessary restore session. In our example, it is the first restore session in the array.
Note that you can use the Get-VESQLDatabaseRestoreInterval cmdlet to get the restore interval of the necessary database in UTC.
|
Related Commands