Publish-VESQLDatabase
Short Description
Publishes Microsoft SQL databases.
Applies to Veeam Backup & Replication
Product Edition: Community, Standard, Enterprise, Enterprise Plus
Syntax
Publish-VESQLDatabase [-Database] <VESQLDatabase> -ServerName <String> [-DatabaseName <String>] [-InstanceName <String>] [-Port <Int32>] [-UseSQLAuthentication <SwitchParameter>] [-SqlCredentials <PSCredential>] [-GuestCredentials <PSCredential>] [-ToPointInTime <DateTime>] [-Force <SwitchParameter>] [<CommonParameters>] |
Detailed Description
This cmdlet allows you to publish Microsoft SQL databases to the target SQL server.
Parameters
Parameter | Description | Type | Required | Position | Accept Pipeline Input | Accept Wildcard Characters |
---|---|---|---|---|---|---|
Database | Specifies a Microsoft SQL database that you want to publish. | Accepts the VESQLDatabase object. To get this object, run the Get-VESQLDatabase cmdlet. | True | 0 | True (ByValue) | False |
ServerName | Specifies a name of the target server. The cmdlet will publish a Microsoft SQL database to that server. | String | True | Named | False | False |
DatabaseName | Specifies a new name for a Microsoft SQL database. The cmdlet will publish the existing database with this name. | String | False | Named | False | False |
InstanceName | Specifies a name of the target instance. The cmdlet will publish a Microsoft SQL database to that instance. | String | False | Named | False | False |
Port | Specifies a port number. The cmdlet will use this port to connect to a Microsoft SQL server. | Int32 | False | Named | False | False |
SqlCredentials | Specifies credentials to authenticate against a Microsoft SQL server. If you do not specify the SQL credentials, the cmdlet will use the current account credentials. | PSCredential | False | Named | False | False |
UseSQLAuthentication | Defines that the cmdlet will use the SQL authentication to connect to the target Microsoft SQL server. | SwitchParameter | False | Named | False | False |
GuestCredentials | Specifies credentials to authenticate against the target server. Note:
| PSCredential | False | Named | False | False |
ToPointInTime | Specifies the point in time within a restore interval of a Microsoft SQL database. The cmdlet will publish the database to the state of the specified point in time. | DateTime | False | Named | False | False |
Force | Defines that the cmdlet will overwrite the existing database with the database from the backup. Note: The cmdlet will show no prompt before executing the command. | SwitchParameter | 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
Publishing to Specific Server
This example shows how to publish a Microsoft SQL database to a specific server.
$session = Get-VESQLRestoreSession $database = Get-VESQLDatabase -Session $session[0] -Name "SQLDatabase" Publish-VESQLDatabase -Database $database -ServerName "TargetServer" |
Perform the following steps:
- Run the Get-VESQLRestoreSession cmdlet. Save the result to the $session variable.
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).
- Run the Get-VESQLDatabase cmdlet. Set the $session variable as the Session parameter value. Specify the Name parameter value. Save the result to the $database variable.
- Run the Publish-VESQLDatabase cmdlet. Specify the following settings:
- Set the $database variable as the Database parameter value.
- Specify the ServerName parameter value.
Related Commands