Export-VESQLDatabase
Short Description
Exports a backed-up Microsoft SQL Server database.
Note |
|
In Veeam Backup & Replication 13.1, this cmdlet became deprecated. Use the |
Product: 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] [-SqlCredentials <PSCredential>] [-GuestCredentials <PSCredential>] [-ToBackupFile] [-EnableCompression] [-Force] [<CommonParameters>] |
Detailed Description
This cmdlet allows you to export a Microsoft SQL Server database to the machine where the PowerShell session is running. 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
ToBackupFileparameter.
Parameters
|
Parameter |
Description |
Type |
Required |
Position |
Accept Pipeline Input |
|---|---|---|---|---|---|
|
Database |
Specifies a Microsoft SQL Server database that you want to export.
Accepts the |
True |
0 |
True (ByValue) |
|
|
EnableCompression |
For the 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. |
|
False |
Named |
False |
|
Force |
Defines that the cmdlet will overwrite the following files:
Note: The cmdlet will show no prompt before executing the command. |
|
False |
Named |
False |
|
GuestCredentials |
Specifies credentials for authenticating to the staging server. Consider the following:
Accepts the |
|
False |
Named |
False |
|
InstanceName |
Specifies the Microsoft SQL Server instance on the staging server to which the cmdlet will connect. |
|
False |
Named |
False |
|
Path |
Specifies the export path on the machine where the PowerShell session is running.
To export your database as a backup (.bak) file, specify the
Note: To overwrite an existing file in the export destination, use the |
|
True |
Named |
False |
|
Port |
Specifies a port number that will be used to connect to the staging server. |
|
False |
Named |
False |
|
ServerName |
Specifies DNS name or IP address of the staging server. |
|
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 |
|
False |
Named |
False |
|
ToBackupFile |
Defines that the cmdlet will export the specified Microsoft SQL Server database as a backup (.bak) file. |
|
False |
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). |
|
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 |
|
False |
Named |
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. 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:
|
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:
|
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:
|
Related Commands
Get-VESQLRestoreSessionReturns active restore sessions started to perform operations with backed-up Microsoft SQL Server databases.Get-VESQLDatabaseReturns backed-up Microsoft SQL Server databases.Get-DateGet-CredentialGet-VESQLDatabaseRestoreIntervalReturns details on the available restore period for a backed-up Microsoft SQL Server database.