Author | Kirill Kravtsov (@nvarscar), nvarscar.wordpress.com |
Availability | Windows, Linux, macOS |
Want to see the source code for this command? Check out New-DbaDacOption on GitHub.
Want to see the Bill Of Health for this command? Check out New-DbaDacOption.
Creates a new Microsoft.SqlServer.Dac.DacExtractOptions/DacExportOptions object depending on the chosen Type
Creates a new Microsoft.SqlServer.Dac.DacExtractOptions/DacExportOptions object that can be used during DacPackage extract. Basically saves you the time from remembering the SMO assembly name ;)
See:
https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.dacexportoptions.aspx
https://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dac.dacextractoptions.aspx
for more information
New-DbaDacOption
[[-Type] <String>]
[-Action] <String>
[[-PublishXml] <String>]
[[-Property] <Hashtable>]
[-EnableException]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
PS C:\> $options = New-DbaDacOption -Type Dacpac -Action Export
PS C:\> $options.ExtractAllTableData = $true
PS C:\> $options.CommandTimeout = 0
PS C:\> Export-DbaDacPackage -SqlInstance sql2016 -Database DB1 -Options $options
Uses DacOption object to set the CommandTimeout to 0 then extracts the dacpac for SharePoint_Config on sql2016 to C:\temp\SharePoint_Config.dacpac including all table data.
PS C:\> $options = New-DbaDacOption -Type Dacpac -Action Export -Property @{ExtractAllTableData=$true;CommandTimeout=0}
PS C:\> Export-DbaDacPackage -SqlInstance sql2016 -Database DB1 -Options $options
Creates a pre-initialized DacOption object and uses it to extrac a DacPac from the database.
PS C:\> $options = New-DbaDacOption -Type Dacpac -Action Publish
PS C:\> $options.DeployOptions.DropObjectsNotInSource = $true
PS C:\> Publish-DbaDacPackage -SqlInstance sql2016 -Database DB1 -Options $options -Path c:\temp\db.dacpac
Uses DacOption object to set Deployment Options and publish the db.dacpac dacpac file as DB1 on sql2016
Choosing an intended action: Publish or Export.
Alias | |
Required | True |
Pipeline | false |
Default Value | |
Accepted Values | Publish,Export |
Selecting the type of the export: Dacpac (default) or Bacpac.
Alias | |
Required | False |
Pipeline | false |
Default Value | Dacpac |
Accepted Values | Dacpac,Bacpac |
Specifies the publish profile which will include options and sqlCmdVariables.
Alias | |
Required | False |
Pipeline | false |
Default Value |
A Hashtable that would be used to initialize Options object properties.
If you want to specify DeployOptions parameters, which is a property of the options object,
add the DeployOptions key with an appropriate hashtable as a value:
@}
Alias | |
Required | False |
Pipeline | false |
Default Value |
By default, when something goes wrong we try to catch it, interpret it and give you a friendly warning message.
This avoids overwhelming you with "sea of red" exceptions, but is inconvenient because it basically disables advanced scripting.
Using this switch turns this "nice by default" feature off and enables you to catch exceptions with your own try/catch.
Alias | |
Required | False |
Pipeline | false |
Default Value | False |
If this switch is enabled, no actions are performed but informational messages will be displayed that explain what would happen if the command were to run.
Alias | wi |
Required | False |
Pipeline | false |
Default Value |
If this switch is enabled, you will be prompted for confirmation before executing any operations that change state.
Alias | cf |
Required | False |
Pipeline | false |
Default Value |