Sql server 通过命令行部署SQL Server数据库项目(SSDT)

Sql server 通过命令行部署SQL Server数据库项目(SSDT),sql-server,visual-studio,sql-server-data-tools,sqlpackage,Sql Server,Visual Studio,Sql Server Data Tools,Sqlpackage,我有一个SQL Server数据库项目,目标是SQL Server 2012 RC0数据库。该项目是在Visual Studio 2010+SQL Server数据工具CTP4中创建的。(项目类型不同于常规的VisualStudio2010数据库项目——它是SQL开发人员工具CTP3 Juneau的下一个版本) 它在IDE中部署得很好。如何通过命令行部署它 我尝试了VSDBCMD.exe,但它需要一个不是由新项目类型创建的.deploymanifest文件。使用sqlpackage.exe,位于

我有一个SQL Server数据库项目,目标是SQL Server 2012 RC0数据库。该项目是在Visual Studio 2010+SQL Server数据工具CTP4中创建的。(项目类型不同于常规的VisualStudio2010数据库项目——它是SQL开发人员工具CTP3 Juneau的下一个版本)

它在IDE中部署得很好。如何通过命令行部署它


我尝试了VSDBCMD.exe,但它需要一个不是由新项目类型创建的.deploymanifest文件。

使用sqlpackage.exe,位于
C:\Program Files\Microsoft SQL Server\{version}\DAC\bin
C:\Program Files(x86)\Microsoft SQL Server\{version}\DAC\bin
其中
{version}
=
110
(SQL Server 2012)、
120
(SQL Server 2014)等

命令行参数:

/Action:{Extract|Report|Publish|Script}  Specifies the action to be performed.
                                         (short form /a)

/Quiet[+|-]                              Specifies whether detailed feedback is
                                         suppressed. Defaults to False. (short
                                         form /q)

/OverwriteFiles[+|-]                     Specifies if sqlpackage.exe should
                                         overwrite existing files. Specifying
                                         false causes sqlpackage.exe to abort
                                         action if an existing file is
                                         encountered. Default value is True.
                                         (short form /of)

/SourceServerName:<string>               Defines the name of the server hosting
                                         the source database. (short form /ssn)

/SourceDatabaseName:<string>             Defines the name of the source
                                         database. (short form /sdn)

/SourceUser:<string>                     For SQL Server auth scenarios, defines
                                         the SQL Server user to use to access
                                         the source database. (short form /su)

/SourcePassword:<string>                 For SQL Server auth scenarios, defines
                                         the password to use to access the
                                         source database. (short form /sp)

/SourceTimeout:<int>                     Specifies the timeout for establishing
                                         a connection to the source database in
                                         seconds. (short form /st)

/SourceEncryptConnection[+|-]            Specifies if SQL encryption should be
                                         used for the source database
                                         connection. (short form /sec)

/SourceTrustServerCertificate[+|-]       Specifies whether to use SSL to
                                         encrypt the source database connection
                                         and bypass walking the certificate
                                         chain to validate trust. (short form
                                         /stsc)

/SourceConnectionString:<string>         Specifies a valid SQL Server/Azure
                                         connection string to the source
                                         database. If this parameter is
                                         specified it shall be used exclusively
                                         of all other source parameters. (short
                                         form /scs)

/SourceFile:<string>                     Specifies a source file to be used as
                                         the source of action instead of a
                                         database. If this parameter is used,
                                         no other source parameter shall be
                                         valid. (short form /sf)

/TargetServerName:<string>               Defines the name of the server hosting
                                         the target database. (short form /tsn)

/TargetDatabaseName:<string>             Specifies an override for the name of
                                         the database that is the target of
                                         sqlpackage.exe Action. (short form
                                         /tdn)

/TargetUser:<string>                     For SQL Server auth scenarios, defines
                                         the SQL Server user to use to access
                                         the target database. (short form /tu)

/TargetPassword:<string>                 For SQL Server auth scenarios, defines
                                         the password to use to access the
                                         target database. (short form /tp)

/TargetTimeout:<int>                     Specifies the timeout for establishing
                                         a connection to the target database in
                                         seconds. (short form /tt)

/TargetEncryptConnection[+|-]            Specifies if SQL encryption should be
                                         used for the target database
                                         connection. (short form /tec)

/TargetTrustServerCertificate[+|-]       Specifies whether to use SSL to
                                         encrypt the target database connection
                                         and bypass walking the certificate
                                         chain to validate trust. (short form
                                         /ttsc)

/TargetConnectionString:<string>         Specifies a valid SQL Server/Azure
                                         connection string to the target
                                         database. If this parameter is
                                         specified it shall be used exclusively
                                         of all other target parameters. (short
                                         form /tcs)

/TargetFile:<string>                     Specifies a target file (i.e., a
                                         .dacpac files) to be used as the
                                         target of action instead of a
                                         database. If this parameter is used,
                                         no other target parameter shall be
                                         valid. This parameter shall be invalid
                                         for actions that only support database
                                         targets. (short form /tf)

/Properties:<string>                     A name value pair for a Publish
                                         property, {PropertyName}={Value}.
                                         Refer to the help for the Publish
                                         action for valid property names.
                                         (short form /p)

/Variables:<string>                      Optional only if /Action:Publish is
                                         specified. Valid values for parameter
                                         name shall be SQL Command variables
                                         specified in the .dacpac file only.
                                         Parameter names specified that are not
                                         declared in the .dacpac shall result
                                         in an error. Valid command variable
                                         values shall be context-specific based
                                         on the command variable itself (e.g.,
                                         database name vs. schema names).
                                         (short form /v)

/Profile:<string>                        Optional if /Action:Publish is
                                         specified. Valid value is a file path
                                         to a Publish Profile. A user shall be
                                         able to use a Publish Profile to
                                         define the collection of Publish
                                         Properties to use for a Publish
                                         episode. (short form /pr)

/OutputPath:<string>                     Required if /Action:Report or
                                         /Action:Script is specified. Valid
                                         value is a file path to where the
                                         comparison report shall be written.
                                         (short form /op)

@<file>                                  Read response file for more options.
/Action:{Extract | Report | Publish | Script}指定要执行的操作。
(简表/a)
/安静[+|-]指定是否需要详细反馈
压制。默认为False。(短
表格∕q)
/OverwriteFiles[+|-]指定是否应
覆盖现有文件。指定
false导致sqlpackage.exe中止
如果现有文件被删除,则执行操作
遇到。默认值为True。
(简体/英文)
/SourceServerName:定义托管服务器的名称
源数据库。(简表/ssn)
/SourceDatabaseName:定义源的名称
数据库(缩写/sdn)
/SourceUser:对于SQL Server身份验证方案,定义
用于访问的SQL Server用户
源数据库。(简体/su)
/SourcePassword:对于SQL Server身份验证方案,定义
用于访问的密码
源数据库。(简表/sp)
/SourceTimeout:指定建立的超时时间
与中的源数据库的连接
秒。(简表/st)
/SourceEncryptConnection[+|-]指定是否应使用SQL加密
用于源数据库
连接。(缩写/秒)
/SourceTrustServerCertificate[+|-]指定是否使用SSL来
加密源数据库连接
和证书
链来验证信任。(简称
/(stsc)
/SourceConnectionString:指定有效的SQL Server/Azure
到源的连接字符串
数据库如果此参数为
规定应专门使用
所有其他源参数。(短
表格[附件]
/SourceFile:指定要用作源文件的源文件
行动的源泉,而不是
数据库如果使用此参数,
不得使用其他源参数
有效。(简表/sf)
/TargetServerName:定义托管服务器的名称
目标数据库。(简表/tsn)
/TargetDatabaseName:指定对数据库名称的重写
作为目标的数据库
sqlpackage.exe操作。(简称
/tdn)
/TargetUser:对于SQL Server身份验证方案,定义
用于访问的SQL Server用户
目标数据库。(简体/图)
/TargetPassword:对于SQL Server身份验证方案,定义
用于访问的密码
目标数据库。(缩写/tp)
/TargetTimeout:指定建立的超时时间
与中的目标数据库的连接
秒。(简称/tt)
/TargetEncryptConnection[+|-]指定是否应使用SQL加密
用于目标数据库
连接。(缩写/tec)
/TargetTrustServerCertificate[+|-]指定是否使用SSL来
加密目标数据库连接
和证书
链来验证信任。(简称
/(ttsc)
/TargetConnectionString:指定有效的SQL Server/Azure
到目标的连接字符串
数据库如果此参数为
规定应专门使用