共用方式為


SqlPackage.exe

 

SqlPackage.exe 是一個命令列公用程式,可將下列資料庫開發工作予以自動化:

  • Extract:從即時 SQL Server 或 Windows Azure SQL 資料庫建立資料庫快照集 (.dacpac) 檔案。

  • Export:將即時資料庫 (包括資料庫結構描述和使用者資料) 從 SQL Server 或 Windows Azure SQL 資料庫匯出到 BACPAC 套件 (.bacpac 檔案)。

  • Import:將結構描述和資料表資料從 BACPAC 套件匯入至 SQL Server 或 Windows Azure SQL 資料庫執行個體中的新使用者資料庫。

  • Publish:累加更新資料庫結構描述以符合來源 .dacpac 檔案的結構描述。如果資料庫不存在伺服器上,則發行作業將建立它。否則,將更新現有的資料庫。

  • DeployReport:建立發行動作所做變更的 XML 報表。

  • DriftReport:建立自從上次註冊以來已經對註冊資料庫所做變更的 XML 報表。

  • Script:建立 Transact-SQL 累加更新指令碼,這個指令碼會更新目標的結構描述以符合來源的結構描述。

SqlPackage.exe 命令列可讓您指定這些動作以及動作特有的參數和屬性。

命令列語法

SqlPackage.exe 會使用命令列上指定的參數、屬性和 SQLCMD 變數來起始指定的動作。

SqlPackage {parameters}{properties}{SQLCMDVariables}

若要查看 Windows Azure SQL 資料庫、SQL Server Data Tools 和 SQL Server Management Studio 之常見客戶問題的解決方案,請參閱資料庫生命週期管理

一般參數

一般參數會影響 SqlPackage.exe 的整體運作。

參數 簡短形式 必要項? 說明
/Help /? N 顯示使用方式陳述式。
/Action:{Extract | DeployReport | DriftReport | Publish | Script | Export | Import | Pipe} /a:{Extract | DeployReport | DriftReport | Publish | Script | Export | Import | Pipe} Y 指定要執行的動作。
/Quiet:{True | False} /q:{True | False} N 指定是否隱藏詳細的意見反應。預設為 False
/OverwriteFiles:{True | False} /of:{True | False} N 指定 sqlpackage.exe 是否應該覆寫現有的檔案。指定 False 會導致 sqlpackage.exe 在遇到現有的檔案時中止動作。預設值為 True
@{file-path} N 指定回應檔的檔案路徑。

來源參數

下表顯示 SqlPackage.exe 支援用於定義來源的命令列參數:

參數 簡短形式 預設值 說明
/SourceConnectionString:{string} /scs:{string} 不適用 指定來源資料庫的有效 SQL Server/Azure 連接字串。如果指定了此參數,就應該以獨佔方式將它用於所有其他來源參數。
/SourceDatabaseName:{string} /sdn:{string} 不適用 定義來源資料庫的名稱。
/SourceUser:{value} /su:{value} 不適用 在 SQL Server 撰寫的情形下,指定用以存取資料庫的 SQL Server 使用者。
/SourceEncryptConnection:{True|False} /sec:{ True | False} False 指定 SQL 加密是否應該用於來源資料庫連接。
/SourceFile: { string } /sf:{ string } 不適用 指定要當做動作來源使用的來源檔案,而非資料庫。如果使用了此參數,其他來源參數都應該無效。
/SourcePassword:{string} /sp:{string} 不適用 在 SQL Server 撰寫的情形下,定義要用來存取來源資料庫的密碼。
/SourceServerName: {string} /ssn:{ string } 不適用 指定裝載資料庫的伺服器名稱。
/SourceTimeout:{string} /st:{string} 15 指定與來源資料庫建立連接的逾時秒數。
/SourceTrustServerCertificate:{True | False} /stsc:{True | False} False 指定是否要使用安全通訊端層 (SSL) 來加密來源資料庫連接,並且略過驗證信任的憑證鏈結。
/SourceUser:{string} /su:{string} 不適用 在 SQL Server 撰寫的情形下,指定用以存取資料庫的 SQL Server 使用者。

目標參數

下表顯示 SqlPackage.exe 支援用於定義目標的命令列參數:

參數 簡短形式 必要項? 說明
/TargetConnectionString{string} /tcs:{string} 不適用 指定目標資料庫的有效 SQL Server 或 SQL Azure 連接字串。如果命令列有此參數,其他目標參數便一律使用此連接字串。
/TargetDatabaseName:{string} /tdn:{string} 不適用 指定目標資料庫的名稱。
/TargetEncryptConnection: {True | False} /tec:{True | False} False 指定是否要將 SQL 加密用於目標資料庫。
/TargetFile:{string} /tf:{string} 不適用 指定將寫入 .dacpac 檔案的磁碟檔案路徑。
/TargetPassword:{ string } /tp:{ string } 不適用 在 SQL Server 撰寫的情形下,指定用以存取目標資料庫的密碼。
/TargetServerName:{ string } /ssn:{ string } 不適用 指定裝載目標資料庫的伺服器名稱。
/TargetTimeout:{ string } /tt:{ string } 15 指定與目標資料庫建立連接的逾時秒數。
/TargetTrustServerCertificate:{True | False} /ttsc:{True | False} False 指定是否要使用安全通訊端層 (SSL) 來加密目標資料庫連接,並且略過驗證信任的憑證鏈結。
/TargetUser:{ string } /tu:{ string } 不適用 在 SQL Server 撰寫的情形下,指定用以存取目標資料庫的 SQL Server 使用者。

Extract 參數和屬性

SqlPackage.exe Extract 動作可在 SQL Server 的內部部署執行個體或 Windows Azure SQL 資料庫執行個體,從即時資料庫以 .dacpac 檔案的形式建立資料庫快照。Extract 動作可以建立 .dacpac 檔案,其中只包含來源資料庫的結構描述,或結構描述和使用者資料表資料。

參數

**來源:**所有 來源參數 都適用於 Extract,但 /SourceFile: 除外。

目標:當您使用 SqlPackage.exe 來指定 Extract 動作時,只能使用下列目標參數:

參數 簡短形式 必要項? 說明
/TargetFile:{string} /tf:{string} Y 指定將寫入 .dacpac 檔案的磁碟檔案路徑。

屬性

屬性 預設值 說明
/p:CommandTimeout = {Integer} 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:DacApplicationDescription={ string } 不適用 定義要儲存在 DACPAC 中繼資料中的應用程式描述。
/p:DacApplicationName={ string } 不適用 定義要儲存在 DACPAC 中繼資料中的應用程式名稱。預設值為資料庫名稱。
/p:DacMajorVersion={integer} 1 定義要儲存在 DACPAC 中繼資料中的主要版本。
/p:DacMinorVersion={integer} 0 如果為 true,則只擷取指定之來源的應用程式範圍物件。如果為 false,則擷取指定之來源的所有物件。
/p:ExtractAllTableData={true | false} False 如果為 true,則建立 .dacpac 檔案,包含來自所有使用者資料表的資料庫結構描述和資料。
/p:ExtractApplicationScopedObjectsOnly={True | False} True 如果為 true,則只擷取指定之來源的應用程式範圍物件。如果為 false,則擷取指定之來源的所有物件。
/p:ExtractReferencedServerScopedElements={True| False} True 如果為 true,則擷取來源資料庫物件所參考的登入、伺服器稽核及認證物件。
/p:IgnoreExtendedProperties={True | False} False 指定是否應該忽略擴充屬性。
/p:IgnorePermissions={True | False} True 指定是否應該忽略權限。
/p:IgnoreUserLoginMappings={True | False} False 指定是否忽略使用者與登入之間的關聯性。
/p:Storage={File|Memory} File 指定支援儲存體的類型,以供結構描述模型在擷取期間使用。
/p:TableData={string} 不適用 此屬性用來指定要包括做為 Extract 動作一部分的個別使用者資料表。資料表是使用兩部分資料表名稱來指定。
/p:VerifyExtraction={True | False} False 指定是否應該驗證擷取的 dacpac。

**注意:**執行 Extract 動作時,若設定 /p:ExtractAllTableData=true,會禁止您同時使用 /p:TableData 屬性指定個別資料表。設定 /p:ExtractAllTableData=false,可以指定一個或多個要從中擷取資料的使用者資料表。

Publish 參數、屬性與 SQLCMD 變數

SqlPackage.exe 發行作業會累加更新目標資料庫的結構描述,使其符合來源資料庫的結構。發行部署套件時,若其中包含所有資料表或資料表子集的使用者資料,則除了結構描述以外,也會更新資料表資料。請注意,資料部署將覆寫目標資料庫之現有資料表中的結構描述和資料。對於未包括在部署套件的資料表,資料部署將不會變更目標資料庫中的現有結構描述或資料。

參數

來源:只有 /SourceFile: 參數適用於 Publish。

目標:所有 目標參數 都適用於 Publish,但 TargetFile 除外。

當您使用 SqlPackage.exe 來指定 Publish 動作時,也可以使用下列目標參數:

參數 簡短形式 必要項? 說明
/Profile:{string} /pr:{string} 不適用 指定 DAC 發行設定檔的檔案路徑。設定檔會定義產生輸出時要使用之屬性及變數的集合。
/Properties:{PropertyName}={Value} /p:{PropertyName}={Value} 不適用 指定動件特有屬性的名稱/值組:{PropertyName}={Value}。請參閱特定動作的說明,以便查看該動作的屬性名稱。

**注意:**您無需指定其他語法或限制,即可發行部署套件與資料表資料。

屬性

屬性 預設值 說明
/p:AdditionalDeploymentContributorArguments={string} 不適用 為部署參與者指定其他部署參與者引數。這應該是以分號區隔的值清單。
/p:AdditionalDeploymentContributors={string} 不適用 指定部署 dacpac 時應該執行的其他部署參與者。這應該是以分號區隔的完整組建參與者名稱或識別碼清單。
/p:AllowDropBlockingAssemblies ={True | False} False 指定 SqlClr 發行是否會在部署計畫中卸除封鎖的組件。根據預設,如果必須卸除任何參考組件,則該封鎖或參考組件會封鎖組件更新。
/p:AllowIncompatiblePlatform={True | False} False 指定儘管 SQL Server 平台可能不相容,是否仍要進行發行動作。
/p:BackupDatabaseBeforeChanges={True | False} False 在部署任何變更之前,先備份資料庫。
/p:BlockOnPossibleDataLoss={True | False} True 指定如果發行作業可能導致資料遺失時,是否會終止發行事件。
/p:BlockWhenDriftDetected={True | False} True 指定是否封鎖更新結構描述不再符合註冊或已取消註冊的資料庫。
/p:CommandTimeout = { integer } 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:CommentOutSetVarDeclarations={True | False} False 指定在產生的發行指令碼中 SETVAR 變數宣告是否標記為註解。如果您計畫在使用 SQLCMD.EXE 等工具進行發行時在命令列指定值,就可以選擇這種作法。
/p:CompareUsingTargetCollation={True | False} False 這個設定表示資料庫的定序於部署期間的處理方式。如果目標資料庫的定序不符合來源所指定的定序,預設會更新目標資料庫的定序。當設定這個選項時,則應該使用目標資料庫 (或伺服器) 的定序。
/p:CreateNewDatabase={True | False} False 指定當您發行至資料庫時,應該更新目標資料庫或應該卸除並重新建立目標資料庫。
/p:DeployDatabaseInSingleUserMode={True | False} False 如果為 true,則資料庫會在設定為單一使用者模式後部署。
/p:DisableAndReenableDdlTriggers={True | False} True 指定是否在發行程序開始時停用資料定義語言 (DDL) 觸發程序,並在發行動作結束時重新啟用。
/p:DoNotAlterChangeDataCaptureObjects={True | False} True 如果為 true,則不會改變異動資料擷取物件。
/p:DoNotAlterReplicatedObjects={True | False} True 指定驗證期間是否識別有複寫的物件。
/p:DoNotDropObjectType={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用。 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。
/p:DoNotDropObjectTypes= { string } 不適用 以分號區隔的物件類型清單,列出當 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:DropConstraintsNotInSource={True | False} True 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的條件約束。
/p:DropDmlTriggersNotInSource={True | False} True 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的資料操作語言 (DML) 觸發程序。
/p:DropExtendedPropertiesNotInSource={True | False} True 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的擴充屬性。
/p:DropIndexesNotInSource={True | False} True 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的索引。
/p:DropObjectsNotInSource={True | False} False 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的物件。
/p:DropPermissionsNotInSource={True | False} False 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的權限。
/p:DropRoleMembersNotInSource={True | False} False 指定當您發行至資料庫時,發行動作是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 中的角色成員。
/p:ExcludeObjectType={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用 部署期間應該忽略的物件類型。
/p:ExcludeObjectTypes={ string } 不適用 以分號區隔的物件類型清單,列出部署期間應該忽略的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:GenerateSmartDefaults={True | False} False 指定在更新含有資料且資料行不允許 null 值的資料表時,SqlPackage.exe 是否會自動提供預設值。
/p:IgnoreAnsiNulls={True | False} False 指定當您發行至資料庫時,應該忽略或更新 ANSI NULLS 設定的差異。
/p: IgnoreAuthorizer={True | False} False 指定當您發行至資料庫時,應該忽略或更新授權者的差異。
/p:IgnoreColumnCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料行定序的差異。
/p:IgnoreComments={True | False} False 指定當您發行至資料庫時,應該忽略或更新註解順序的差異。
/p:IgnoreCryptographicProviderFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新密碼編譯提供者檔案路徑的差異。
/p:IgnoreDdlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料定義語言 (DDL) 觸發程序順序的差異。
/p:IgnoreDdlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DDL 觸發程序之啟用或停用狀態的差異。
/p:IgnoreDefaultSchema={True | False} False 指定當您發行至資料庫時,應該忽略或更新預設結構描述的差異。
/p:IgnoreDmlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序順序的差異。
/p:IgnoreDmlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序之啟用或停用狀態的差異。
/p:IgnoreExtendedProperties={True | False} False 指定當您發行至資料庫時,應該忽略或更新擴充屬性的差異。
/p:IgnoreFileAndLogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案和記錄檔之路徑的差異。
/p:IgnoreFilegroupPlacement={True | False} True 指定當您發行至資料庫時,應該忽略或更新 FILEGROUP 位置的差異。
/p:IgnoreFileSize={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案大小的差異。
/p:IgnoreFillFactor={True | False} True 指定當您發行至資料庫時,應該忽略或更新填滿因數的差異。
/p:IgnoreFullTextCatalogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新全文檢索索引檔案之路徑的差異。
/p:IgnoreIdentitySeed={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之種子的差異。
/p:IgnoreIncrement={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之增量的差異。
/p:IgnoreIndexOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新索引選項的差異。
/p:IgnoreIndexPadding={True | False} True 指定當您發行至資料庫時,應該忽略或更新索引填補的差異。
/p:IgnoreKeywordCasing={True | False} True 指定當您發行至資料庫時,應該忽略或更新關鍵字大小寫的差異。
/p:IgnoreLockHintsOnIndexes={True | False} False 指定當您發行至資料庫時,應該忽略或更新索引之鎖定提示的差異。
/p:IgnoreLoginSids={True | False} True 指定當您發行至資料庫時,應該忽略或更新安全性識別碼 (SID) 的差異。
/p:IgnoreNotForReplication={True | False} False 指定當您發行至資料庫時,應該忽略或更新不可複寫設定。
/p:IgnoreObjectPlacementOnPartitionScheme={True | False} True 指定當您發行至資料庫時,應該忽略或更新物件在資料分割配置上的位置。
/p:IgnorePartitionSchemes={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料分割配置和函數的差異。
/p:IgnorePermissions={True | False} False 指定當您發行至資料庫時,應該忽略或更新權限的差異。
/p:IgnoreQuotedIdentifiers={True | False} False 指定當您發行至資料庫時,應該忽略或更新引號識別項設定的差異。
/p:IgnoreRoleMembership={True | False} False 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreRouteLifetime={True | False} True 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreSemicolonBetweenStatements={True | False} True 指定當您發行至資料庫時,應該忽略或更新 Transact-SQL 陳述式之間的分號差異。
/p:IgnoreTableOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料表選項的差異。
/p:IgnoreUserSettingsObjects={True | False} False 指定當您發行至資料庫時,應該忽略或更新使用者設定選項的差異。
/p:IgnoreWhitespace={True | False} True 指定當您發行至資料庫時,應該忽略或更新空白字元的差異。
/p:IgnoreWithNocheckOnCheckConstraints={True | False} False 指定當您發行至資料庫時,應該忽略或更新檢查條件約束之 WITH NOCHECK 子句值的差異。
/p:IgnoreWithNocheckOnForeignKeys={True | False} False 指定當您發行至資料庫時,應該忽略或更新外部索引鍵之 WITH NOCHECK 子句值的差異。
/p:IncludeCompositeObjects={True | False} False 指定是否將所有複合項目包含在單一發行作業中。
/p:IncludeTransactionalScripts={True | False} False 指定當您發行至資料庫時,是否應該盡可能使用交易陳述式。
/p:NoAlterStatementsToChangeClrTypes={True | False} False 指定發行在發現差異時一定要卸除並重新建立組件,而不是發出 ALTER ASSEMBLY 陳述式。
/p:PopulateFilesOnFilegroups={True | False} True 指定在目標資料庫中建立新 FileGroup 時,是否一併建立新檔案。
/p:RegisterDataTierApplication={True | False} False 指定結構描述是否向資料庫伺服器註冊。
/p:RunDeploymentPlanExecutors={True | False} False 指定當執行其他作業時,是否應該執行 DeploymentPlanExecutor 參與者。
/p:ScriptDatabaseCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料庫定序的差異。
/p:ScriptDatabaseCompatibility={True | False} True 指定當您發行至資料庫時,應該忽略或更新資料庫相容性的差異。
/p:ScriptDatabaseOptions={True | False} True 指定當您發行至資料庫時,應該設定或更新目標資料庫屬性。
/p:ScriptDeployStateChecks= {True | False } False 指定是否在發行指令碼中產生陳述式,來驗證資料庫名稱和伺服器名稱是否符合資料庫專案中指定的名稱。
/p:ScriptFileSize={True | False} False 控制將檔案加入至檔案群組時是否指定大小。
/p:ScriptNewConstraintValidation={True | False} True 指定是否在發行結束時,將所有條件約束當做單一集合進行驗證,避免檢查或外部索引鍵條件約束在發行動作進行中導致資料錯誤。如果這個選項是 False,則會發行條件約束,但不檢查對應的資料。
/p:ScriptRefreshModule={True | False} True 指定是否在發行指令碼的結尾包含重新整理陳述式。
/p:Storage={File | Memory} Memory 指定在建置資料庫模型時,如何儲存項目。基於效能考量,預設值為 InMemory。若為非常龐大的資料庫,則需要 File-backed 儲存體。
/p:TreatVerificationErrorsAsWarnings={True | False} False 指定是否將發行驗證期間所發生的錯誤視為警告。系統會先針對產生的部署計畫執行檢查,之後再針對目標資料庫執行計畫。計畫驗證會偵測出遺漏僅限於目標的物件 (例如索引) 這類必須卸除後才能進行變更的問題。驗證也會偵測因為參考複合專案而有相依性 (例如資料表或檢視) 存在,但是卻不存在目標資料庫中的情況。您可以選擇將驗證錯誤視為警告,以取得所有問題的清單,而不讓發行動作在第一次錯誤時就停止。
/p:UnmodifiableObjectWarnings={True | False} True 指定在無法修改的物件中發現差異時 (例如檔案的檔案大小或檔案路徑不同) 是否產生警告。
/p:VerifyCollationCompatibility={True | False} True 指定是否驗證定序相容性。
/p:VerifyDeployment={True | False} True 指定是否在發行前執行檢查,以便在出現阻止發行成功的問題時停止發行動作。例如,如果因為目標資料庫的外部索引鍵不存在資料庫專案中,而在發行期間成錯誤,則您的發行動作就可能會停止。

SQLCMD 變數

下表描述可用來覆寫在發行動作期間所用 SQL 命令 (sqlcmd) 變數值之選項的格式。命令列上指定的變數值會覆寫指派給變數的其他值 (例如在發行設定檔中)。

參數 預設值 說明
/Variables:{PropertyName}={Value} 指定動件特有變數的名稱/值組:{VariableName}={Value}。DACPAC 檔案包含有效 SQLCMD 變數的清單。如果未針對每一個變數提供值,則將產生錯誤。

Export 參數和屬性

SqlPackage.exe Export 動作可將即時資料庫從 SQL Server 或 Windows Azure SQL 資料庫匯出到 BACPAC 套件 (.bacpac 檔案)。依預設,所有資料表的資料將包括在 .bacpac 檔案中。您可以選擇性地只指定要匯出資料的資料表子集。驗證 Export 動作,可確保 Windows Azure SQL 資料庫相容於完整目標資料庫,即使已指定資料表子集進行匯出也一樣。

參數

來源:Export 支援所有 來源參數,但 /SourceFile 除外:

目標:Export 的唯一有效目標參數為 /TargetFile:{string},其中 {string} 是磁碟上將寫入 .bacpac 檔案的檔案路徑。

限制:

  • 僅使用者資料表支援匯出資料表資料。

  • 針對匯出指定的資料表必須位於封閉集。使用者資料表不能包括範圍超出指定之資料表集的傳入或傳出外部索引鍵。

當您使用 SqlPackage.exe 來指定 Export 動作時,也可以使用下列參數:

參數 簡短形式 必要項? 說明
/TargetFile:{string} /tf:{string} Y 指定將產生已匯出之 .bacpac 檔案的檔案路徑。檔案路徑必須是現有目錄,而且字串必須包括檔案名稱,其中包括 .bacpac 副檔名。路徑名稱不能超過 256 個字元的 Windows 檔案路徑限制。

屬性

下表指定 SqlPackage.exe 針對匯出 BACPAC 檔案所提供的命令列屬性。

屬性 預設值 說明
/p:CommandTimeout = { integer } 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:TableData={string} 不適用 此屬性用來指定要包括做為 Export 動作一部分的個別使用者資料表。資料表是使用兩部分資料表名稱來指定。
/p:Storage={File|Memory} Memory 指定在建置資料庫模型時,如何儲存項目。基於效能考量,預設值為 Memory。若為非常龐大的資料庫,則需要 File-backed 儲存體。

Import 參數和屬性

SqlPackage.exe Import 動作可將結構描述和資料表資料從 BACPAC 套件 (.bacpac 檔案) 匯入至 SQL Server 或 Windows Azure SQL 資料庫中新的或空的資料庫。在對現有資料庫進行匯入作業時,目標資料庫不能包含任何使用者定義的結構描述物件。

參數

來源:僅 /SourceFile:{string} 參數適用於 Import,其中 {string} 是磁碟上來源 .bacpac 檔案所在的檔案路徑。

目標:所有 目標參數 都適用於 Import,但 /TargetFile 除外。

當您使用 SqlPackage.exe 來指定 Import 動作時,也可以使用下列其他目標參數:

參數 簡短形式 必要項? 說明
/SourceFile:{string} /sf:{string} Y 指定來源檔案所在的檔案路徑。字串必須包括目標檔案名稱,其中包括 .bacpac 副檔名。路徑名稱不能超過 256 個字元的 Windows 檔案路徑限制。

屬性

下表指定 SqlPackage.exe 針對匯出 BACPAC 檔案所提供的命令列屬性。

屬性 預設值 說明
/p:CommandTimeout = {Integer} 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:ImportContributorArguments = { String } 不適用 指定部署參與者的部署參與者參數。這應該是以分號區隔的值清單。
/p:ImportContributors = { String } 不適用 指定匯入 bacpac 時應該執行的部署參與者。這應該是以分號區隔的完整組建參與者名稱或識別碼清單。
/p:Storage={File | Memory} Memory 指定在建置資料庫模型時,如何儲存項目。基於效能考量,預設值為 Memory。若為非常龐大的資料庫,則需要 File-backed 儲存體。

DeployReport 參數與屬性

SqlPackage.exe 報表動作會建立發行動作所做變更的 XML 報表。

參數

來源:只有 /SourceFile: 參數適用於 DeployReport。

目標:所有 目標參數 都適用於 DeployReport。

當您使用 SqlPackage.exe 來指定 DeployReport 動作時,也可以使用下列其他目標參數:

參數 簡短形式 必要項? 說明
/OutputPath:{string} /op:{string} Y 指定 XML 輸出檔案產生位置的檔案路徑。

屬性

下表指定 SqlPackage.exe 針對變更 DeployReport 動作作用所提供的命令列屬性。

屬性 預設值 說明
/p:AdditionalDeploymentContributorArguments={String} 不適用 為部署參與者指定其他部署參與者引數。這應該是以分號區隔的值清單。
/p:AdditionalDeploymentContributors={String} 不適用 指定部署 dacpac 時應該執行的其他部署參與者。這應該是以分號區隔的完整組建參與者名稱或識別碼清單。
/p:AllowDropBlockingAssemblies={True | False} False 這個屬性是供 SqlClr 部署用來使任何封鎖的組件會在部署計畫中卸除。根據預設,如果必須卸除任何參考組件,則該封鎖/參考組件會封鎖組件更新。
/p:AllowIncompatiblePlatform={True | False} False 指定儘管 SQL Server 平台可能不相容,是否仍要進行報表動作。
/p:BackupDatabaseBeforeChanges={True | False} False 在部署任何變更之前,先備份資料庫。
/p:BlockOnPossibleDataLoss={True | False} True 指定如果發行作業可能導致資料遺失,就應該終止發行事件。
/p:BlockWhenDriftDetected={True | False} True 指定是否封鎖更新結構描述不再符合註冊或已取消註冊的資料庫。
/p:CommandTimeout = {Integer} 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:CommentOutSetVarDeclarations={True | False} False 指定在產生的發行指令碼中是否應該將 SETVAR 變數的宣告標記為註解。如果您計畫在使用 SQLCMD.EXE 等工具進行發行時在命令列指定值,就可以選擇這種作法。
/p:CompareUsingTargetCollation={True | False} False 這個設定表示資料庫的定序於部署期間的處理方式。如果目標資料庫的定序不符合來源所指定的定序,預設會更新目標資料庫的定序。當設定這個選項時,則應該使用目標資料庫 (或伺服器) 的定序。
/p:CreateNewDatabase={True | False} False 指定當您發行至資料庫時,應該更新目標資料庫或應該卸除並重新建立目標資料庫。
/p:DeployDatabaseInSingleUserMode={True | False} False 如果為 true,則資料庫會在設定為單一使用者模式後部署。
/p:DisableAndReenableDdlTriggers={True | False} True 指定是否在發行程序開始時停用資料定義語言 (DDL) 觸發程序,並在發行動作結束時重新啟用。
/p:DoNotAlterChangeDataCaptureObjects={True | False} False 如果為 true,則不會改變異動資料擷取物件。
/p:DoNotAlterReplicatedObjects={True | False} True 指定驗證期間是否識別有複寫的物件。
/p:DoNotDropObjectType ={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。
/p:DoNotDropObjectTypes= { string } 不適用 以分號區隔的物件類型清單,列出當 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:DropConstraintsNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的條件約束。
/p:DropDmlTriggersNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的 DML 觸發程序。
/p:DropExtendedPropertiesNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的擴充屬性。
/p:DropIndexesNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的索引。
/p:DropObjectsNotInSource={True | False} False 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的物件。
/p:DropPermissionsNotInSource={True | False} False 指定當您發行更新至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的權限。
/p:DropRoleMembersNotInSource={True | False} False 指定當您發行更新至資料庫時,是否要從目標資料庫中卸除資料庫快照集 (.dacpac) 檔案中沒有定義的角色成員。
/p:ExcludeObjectType={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用 部署期間應該忽略的物件類型。
/p:ExcludeObjectTypes={ string } 不適用 以分號區隔的物件類型清單,列出部署期間應該忽略的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:GenerateSmartDefaults={True | False} False 在更新含有資料且資料行不允許 null 值的資料表時,自動提供預設值。
/p:IgnoreAnsiNulls={True | False} False 指定當您發行至資料庫時,應該忽略或更新 ANSI NULLS 設定的差異。
/p: IgnoreAuthorizer={True | False} False 指定當您發行至資料庫時,應該忽略或更新授權者的差異。
/p:IgnoreColumnCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料行定序的差異。
/p:IgnoreComments={True | False} False 指定當您發行至資料庫時,應該忽略或更新註解順序的差異。
/p:IgnoreCryptographicProviderFile={True | False} True 指定當您發行至資料庫時,應該忽略或更新密碼編譯提供者檔案路徑的差異。
/p:IgnoreDdlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料定義語言 (DDL) 觸發程序順序的差異。
/p:IgnoreDdlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DDL 觸發程序之啟用或停用狀態的差異。
/p:IgnoreDefaultSchema={True | False} False 指定當您發行至資料庫時,應該忽略或更新預設結構描述的差異。
/p:IgnoreDmlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序順序的差異。
/p:IgnoreDmlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序之啟用或停用狀態的差異。
/p:IgnoreExtendedProperties={True | False} False 指定當您發行至資料庫時,應該忽略或更新擴充屬性的差異。
/p:IgnoreFileAndLogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案和記錄檔之路徑的差異。
/p:IgnoreFilegroupPlacement={True | False} True 指定當您發行至資料庫時,應該忽略或更新 FILEGROUP 位置的差異。
/p:IgnoreFileSize={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案大小的差異。
/p:IgnoreFillFactor={True | False} True 指定當您發行至資料庫時,應該忽略或更新填滿因數的差異。
/p:IgnoreFullTextCatalogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新全文檢索索引檔案之路徑的差異。
/p:IgnoreIdentitySeed={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之種子的差異。
/p:IgnoreIncrement={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之增量的差異。
/p:IgnoreIndexOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新索引選項的差異。
/p:IgnoreIndexPadding={True | False} True 指定當您發行至資料庫時,應該忽略或更新索引填補的差異。
/p:IgnoreKeywordCasing={True | False} True 指定當您發行至資料庫時,應該忽略或更新關鍵字大小寫的差異。
/p:IgnoreLoginSids={True | False} True 指定當您發行至資料庫時,應該忽略或更新安全性識別碼 (SID) 的差異。
/p:IgnoreNotForReplication={True | False} False 指定當您發行至資料庫時,應該忽略或更新不可複寫設定。
/p:IgnoreObjectPlacementOnPartitionScheme={True | False} True 指定當您發行至資料庫時,應該忽略或更新物件在資料分割配置上的位置。
/p:IgnorePartitionSchemes={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料分割配置和函數的差異。
/p:IgnorePermissions={True | False} False 指定當您發行至資料庫時,應該忽略或更新權限的差異。
/p:IgnoreQuotedIdentifiers={True | False} False 指定當您發行至資料庫時,應該忽略或更新引號識別項設定的差異。
/p:IgnoreRoleMembership={True | False} False 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreRouteLifetime={True | False} True 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreSemicolonBetweenStatements={True | False} True 指定當您發行至資料庫時,應該忽略或更新 Transact-SQL 陳述式之間的分號差異。
/p:IgnoreTableOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料表選項的差異。
/p:IgnoreUserSettingsObjects={True | False} False 指定當您發行至資料庫時,應該忽略或更新使用者設定選項的差異。
/p:IgnoreWhitespace={True | False} True 指定當您發行至資料庫時,應該忽略或更新空白字元的差異。
/p:IgnoreWithNocheckOnCheckConstraints={True | False} False 指定當您發行至資料庫時,應該忽略或更新檢查條件約束之 WITH NOCHECK 子句值的差異。
/p:IgnoreWithNocheckOnForeignKeys={True | False} False 指定當您發行至資料庫時,應該忽略或更新外部索引鍵之 WITH NOCHECK 子句值的差異。
/p:IncludeCompositeObjects={True | False} False 指定是否將所有複合項目包含在單一發行作業中。
/p:IncludeTransactionalScripts={True | False} False 指定當您發行至資料庫時,是否應該盡可能使用交易陳述式。
/p:NoAlterStatementsToChangeClrTypes={True | False} False 指定發行在發現差異時一定要卸除並重新建立組件,而不是發出 ALTER ASSEMBLY 陳述式。
/p:PopulateFilesOnFilegroups={True | False} True 指定在目標資料庫中建立新 FileGroup 時,是否一併建立新檔案。
/p:RegisterDataTierApplication={True | False} False 指定結構描述是否向資料庫伺服器註冊。
/p:RunDeploymentPlanExecutors={True | False} False 指定當執行其他作業時,是否應該執行 DeploymentPlanExecutor 參與者。
/p:ScriptDatabaseCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料庫定序的差異。
/p:ScriptDatabaseCompatibility={True | False} True 指定當您發行至資料庫時,應該忽略或更新資料庫相容性的差異。
/p:ScriptDatabaseOptions={True | False} True 指定當您發行至資料庫時,應該設定或更新目標資料庫屬性。
/p:ScriptFileSize={True | False} False 控制將檔案加入至檔案群組時是否指定大小。
/p:ScriptNewConstraintValidation={True | False} True 指定是否在發行結束時,將所有條件約束當做單一集合進行驗證,避免檢查或外部索引鍵條件約束在發行動作進行中導致資料錯誤。如果這個選項是 False,則會發行條件約束,但不檢查對應的資料。
/p:ScriptDeployStateChecks={True | False} False 指定是否在發行指令碼中產生陳述式,來驗證資料庫名稱和伺服器名稱是否符合資料庫專案中指定的名稱。
/p:ScriptRefreshModule={True | False} True 指定是否在發行指令碼的結尾包含重新整理陳述式。
/p:Storage={File | Memory} Memory 指定在建置資料庫模型時,如何儲存項目。基於效能考量,預設值為 InMemory。若為非常龐大的資料庫,則需要 File-backed 儲存體。
/p:TreatVerificationErrorsAsWarnings={True | False} False 指定是否將發行驗證期間所發生的錯誤視為警告。系統會先針對產生的部署計畫執行檢查,之後再針對目標資料庫執行計畫。計畫驗證會偵測出遺漏僅限於目標的物件 (例如索引) 這類必須卸除後才能進行變更的問題。驗證也會偵測因為參考複合專案而有相依性 (例如資料表或檢視) 存在,但是卻不存在目標資料庫中的情況。您可以選擇將驗證錯誤視為警告,以取得所有問題的清單,而不讓發行動作在第一次錯誤時就停止。
/p:UnmodifiableObjectWarnings={True | False} True 指定在無法修改的物件中發現差異時 (例如檔案的檔案大小或檔案路徑不同) 是否產生警告。
/p:VerifyCollationCompatibility={True | False} True 指定是否驗證定序相容性。
/p:VerifyDeployment={True | False} True 指定是否在發行前執行檢查,以便在出現阻止發行成功的問題時停止發行動作。例如,如果因為目標資料庫的外部索引鍵不存在資料庫專案中,而在發行期間成錯誤,則您的發行動作就可能會停止。

DriftReport 參數

SqlPackage.exe 報表動作會建立自從上次註冊以來已經對註冊資料庫所做變更的 XML 報表。

參數

來源:不適用

目標:所有目標參數 都適用於 DriftReport,但 TargetFile 除外。

當您使用 SqlPackage.exe 來指定 DriftReport 動作時,可以使用下列目標參數:

參數 簡短形式 必要項? 說明
/OutputPath:{string} /op:{string} Y 指定輸出檔案產生位置的檔案路徑。

指令碼參數與屬性

SqlPackage.exe Script 動作建立的 Transact-SQL 累加更新指令碼會更新目標資料庫的結構描述,使其符合來源資料庫的結構描述。

參數

來源:只有 /SourceFile: 參數適用於 Script。

目標:所有 目標參數 都適用於 DeployReport。

當您使用 SqlPackage.exe 來指定 Script 動作時,可以使用下列其他目標參數:

參數 簡短形式 必要項? 說明
/OutputPath:{string} /op:{string} Y 指定輸出檔案產生位置的檔案路徑。

屬性

下表指定 SqlPackage.exe 針對變更 Script 動作作用所提供的命令列屬性。

屬性 預設值 說明
/p:AdditionalDeploymentContributorArguments={String} 不適用 為部署參與者指定其他部署參與者引數。這應該是以分號區隔的值清單。
/p:AdditionalDeploymentContributors={String} 不適用 指定部署 dacpac 時應該執行的其他部署參與者。這應該是以分號區隔的完整組建參與者名稱或識別碼清單。
/p:AllowDropBlockingAssemblies={True | False} False 這個屬性是供 SqlClr 部署用來使任何封鎖的組件會在部署計畫中卸除。根據預設,如果必須卸除任何參考組件,則該封鎖/參考組件會封鎖組件更新。
/p:AllowIncompatiblePlatform={True | False} False 指定儘管 SQL Server 平台可能不相容,是否仍要進行報表動作。
/p:BackupDatabaseBeforeChanges={True | False} False 在部署任何變更之前,先備份資料庫。
/p:BlockOnPossibleDataLoss={True | False} True 指定如果發行作業可能導致資料遺失,就應該終止發行事件。
/p:BlockWhenDriftDetected={True | False} True 指定是否封鎖更新結構描述不再符合註冊或已取消註冊的資料庫。
/p:CommandTimeout = {Integer} 60 以秒為單位指定對 SQL Server 執行查詢時的命令逾時。
/p:CommentOutSetVarDeclarations={True | False} False 指定在產生的發行指令碼中是否應該將 SETVAR 變數的宣告標記為註解。如果您計畫在使用 SQLCMD.EXE 等工具進行發行時在命令列指定值,就可以選擇這種作法。
/p:CompareUsingTargetCollation={True | False} False 這個設定表示資料庫的定序於部署期間的處理方式。如果目標資料庫的定序不符合來源所指定的定序,預設會更新目標資料庫的定序。當設定這個選項時,則應該使用目標資料庫 (或伺服器) 的定序。
/p:CreateNewDatabase={True | False} False 指定當您發行至資料庫時,應該更新目標資料庫或應該卸除並重新建立目標資料庫。
/p:DeployDatabaseInSingleUserMode={True | False} False 如果為 true,則資料庫會在設定為單一使用者模式後部署。
/p:DisableAndReenableDdlTriggers={True | False} True 指定是否在發行程序開始時停用資料定義語言 (DDL) 觸發程序,並在發行動作結束時重新啟用。
/p:DoNotAlterChangeDataCaptureObjects={True | False} True 如果為 true,則不會改變異動資料擷取物件。
/p:DoNotAlterReplicatedObjects={True | False} True 指定驗證期間是否識別有複寫的物件。
/p:DoNotDropObjectType={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。
/p:DoNotDropObjectTypes= { string } 不適用 以分號區隔的物件類型清單,列出當 DropObjectsNotInSource 為 true 時,不應該捨棄的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:DropConstraintsNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的條件約束。
/p:DropDmlTriggersNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的 DML 觸發程序。
/p:DropExtendedPropertiesNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的擴充屬性。
/p:DropIndexesNotInSource={True | False} True 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的索引。
/p:DropObjectsNotInSource={True | False} False 指定當您發行至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的物件。
/p:DropPermissionsNotInSource={True | False} False 指定當您發行更新至資料庫時,是否要從目標資料庫中卸除不存在資料庫快照集 (.dacpac) 檔案中的權限。
/p:DropRoleMembersNotInSource={True | False} False 指定當您發行更新至資料庫時,是否要從目標資料庫中卸除資料庫快照集 (.dacpac) 檔案中沒有定義的角色成員。
/p:ExcludeObjectType={ Aggregates | ApplicationRoles | Assemblies | AsymmetricKeys | BrokerPriorities | Certificates | Contracts | DatabaseRoles | DatabaseTriggers | Defaults | ExtendedProperties | Filegroups | FileTables | FullTextCatalogs | FullTextStoplists | MessageTypes | PartitionFunctions | PartitionSchemes | Permissions | Queues | RemoteServiceBindings | RoleMembership | Rules | ScalarValuedFunctions | SearchPropertyLists | Sequences | Services | Signatures | StoredProcedures | SymmetricKeys | Synonyms | Tables | TableValuedFunctions | UserDefinedDataTypes | UserDefinedTableTypes | ClrUserDefinedTypes | Users | Views | XmlSchemaCollections | Audits | Credentials | CryptographicProviders | DatabaseAuditSpecifications | Endpoints | ErrorMessages | EventNotifications | EventSessions | LinkedServerLogins | Routes | ServerAuditSpecifications | ServerRoleMembership | ServerRoles | ServerTriggers } 不適用 部署期間應該忽略的物件類型。
/p:ExcludeObjectTypes={ string } 不適用 以分號區隔的物件類型清單,列出部署期間應該忽略的物件類型。有效物件類型名稱為 Aggregates、ApplicationRoles、Assemblies、AsymmetricKeys、BrokerPriorities、Certificates、Contracts、DatabaseRoles、DatabaseTriggers、Defaults、ExtendedProperties、Filegroups、FileTables、FullTextCatalogs、FullTextStoplists、MessageTypes、PartitionFunctions、PartitionSchemes、Permissions、Queues、RemoteServiceBindings、RoleMembership、Rules、ScalarValuedFunctions、SearchPropertyLists、Sequences、Services、Signatures、StoredProcedures、SymmetricKeys、Synonyms、Tables、TableValuedFunctions、UserDefinedDataTypes、UserDefinedTableTypes、ClrUserDefinedTypes、Users、Views、XmlSchemaCollections、Audits、Credentials、CryptographicProviders、DatabaseAuditSpecifications、Endpoints、ErrorMessages、EventNotifications、EventSessions、LinkedServerLogins、LinkedServers、Logins、Routes、ServerAuditSpecifications、ServerRoleMembership、ServerRoles、ServerTriggers。
/p:GenerateSmartDefaults={True | False} False 在更新含有資料且資料行不允許 null 值的資料表時,自動提供預設值。
/p:IgnoreAnsiNulls={True | False} False 指定當您發行至資料庫時,應該忽略或更新 ANSI NULLS 設定的差異。
/p: IgnoreAuthorizer={True | False} False 指定當您發行至資料庫時,應該忽略或更新授權者的差異。
/p:IgnoreColumnCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料行定序的差異。
/p:IgnoreComments={True | False} False 指定當您發行至資料庫時,應該忽略或更新註解順序的差異。
/p:IgnoreCryptographicProviderFile={True | False} True 指定當您發行至資料庫時,應該忽略或更新密碼編譯提供者檔案路徑的差異。
/p:IgnoreDdlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料定義語言 (DDL) 觸發程序順序的差異。
/p:IgnoreDdlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DDL 觸發程序之啟用或停用狀態的差異。
/p:IgnoreDefaultSchema={True | False} False 指定當您發行至資料庫時,應該忽略或更新預設結構描述的差異。
/p:IgnoreDmlTriggerOrder={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序順序的差異。
/p:IgnoreDmlTriggerState={True | False} False 指定當您發行至資料庫時,應該忽略或更新 DML 觸發程序之啟用或停用狀態的差異。
/p:IgnoreExtendedProperties={True | False} False 指定當您發行至資料庫時,應該忽略或更新擴充屬性的差異。
/p:IgnoreFileAndLogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案和記錄檔之路徑的差異。
/p:IgnoreFilegroupPlacement={True | False} True 指定當您發行至資料庫時,應該忽略或更新 FILEGROUP 位置的差異。
/p:IgnoreFileSize={True | False} True 指定當您發行至資料庫時,應該忽略或更新檔案大小的差異。
/p:IgnoreFillFactor={True | False} True 指定當您發行至資料庫時,應該忽略或更新填滿因數的差異。
/p:IgnoreFullTextCatalogFilePath={True | False} True 指定當您發行至資料庫時,應該忽略或更新全文檢索索引檔案之路徑的差異。
/p:IgnoreIdentitySeed={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之種子的差異。
/p:IgnoreIncrement={True | False} False 指定當您發行至資料庫時,應該忽略或更新識別欄位之增量的差異。
/p:IgnoreIndexOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新索引選項的差異。
/p:IgnoreIndexPadding={True | False} True 指定當您發行至資料庫時,應該忽略或更新索引填補的差異。
/p:IgnoreKeywordCasing={True | False} True 指定當您發行至資料庫時,應該忽略或更新關鍵字大小寫的差異。
/p:IgnoreLoginSids={True | False} True 指定當您發行至資料庫時,應該忽略或更新安全性識別碼 (SID) 的差異。
/p:IgnoreLockHintsOnIndexes={True | False} False 指定當您發行至資料庫時,應該忽略或更新索引之鎖定提示的差異。
/p:IgnoreNotForReplication={True | False} False 指定當您發行至資料庫時,應該忽略或更新不可複寫設定。
/p:IgnoreObjectPlacementOnPartitionScheme={True | False} True 指定當您發行至資料庫時,應該忽略或更新物件在資料分割配置上的位置。
/p:IgnorePartitionSchemes={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料分割配置和函數的差異。
/p:IgnorePermissions={True | False} False 指定當您發行至資料庫時,應該忽略或更新權限的差異。
/p:IgnoreQuotedIdentifiers={True | False} False 指定當您發行至資料庫時,應該忽略或更新引號識別項設定的差異。
/p:IgnoreRoleMembership={True | False} False 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreRouteLifetime={True | False} True 指定當您發行至資料庫時,應該忽略或更新登入之角色成員資格的差異。
/p:IgnoreSemicolonBetweenStatements={True | False} True 指定當您發行至資料庫時,應該忽略或更新 Transact-SQL 陳述式之間的分號差異。
/p:IgnoreTableOptions={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料表選項的差異。
/p:IgnoreUserSettingsObjects={True | False} False 指定當您發行至資料庫時,應該忽略或更新使用者設定選項的差異。
/p:IgnoreWhitespace={True | False} True 指定當您發行至資料庫時,應該忽略或更新空白字元的差異。
/p:IgnoreWithNocheckOnCheckConstraints={True | False} False 指定當您發行至資料庫時,應該忽略或更新檢查條件約束之 WITH NOCHECK 子句值的差異。
/p:IgnoreWithNocheckOnForeignKeys={True | False} False 指定當您發行至資料庫時,應該忽略或更新外部索引鍵之 WITH NOCHECK 子句值的差異。
/p:IncludeCompositeObjects={True | False} False 指定是否將所有複合項目包含在單一發行作業中。
/p:IncludeTransactionalScripts={True | False} False 指定當您發行至資料庫時,是否應該盡可能使用交易陳述式。
/p:NoAlterStatementsToChangeClrTypes={True | False} False 指定發行在發現差異時一定要卸除並重新建立組件,而不是發出 ALTER ASSEMBLY 陳述式。
/p:PopulateFilesOnFilegroups={True | False} True 指定在目標資料庫中建立新 FileGroup 時,是否一併建立新檔案。
/p:RegisterDataTierApplication={True | False} False 指定結構描述是否向資料庫伺服器註冊。
/p:RunDeploymentPlanExecutors={True | False} False 指定當執行其他作業時,是否應該執行 DeploymentPlanExecutor 參與者。
/p:ScriptDatabaseCollation={True | False} False 指定當您發行至資料庫時,應該忽略或更新資料庫定序的差異。
/p:ScriptDatabaseCompatibility={True | False} True 指定當您發行至資料庫時,應該忽略或更新資料庫相容性的差異。
/p:ScriptDatabaseOptions={True | False} True 指定當您發行至資料庫時,應該設定或更新目標資料庫屬性。
/p:ScriptFileSize={True | False} False 控制將檔案加入至檔案群組時是否指定大小。
/p:ScriptNewConstraintValidation={True | False} True 指定是否在發行結束時,將所有條件約束當做單一集合進行驗證,避免檢查或外部索引鍵條件約束在發行動作進行中導致資料錯誤。如果這個選項是 False,則會發行條件約束,但不檢查對應的資料。
/p:ScriptDeployStateChecks={True | False} False 指定是否在發行指令碼中產生陳述式,來驗證資料庫名稱和伺服器名稱是否符合資料庫專案中指定的名稱。
/p:ScriptRefreshModule={True | False} True 指定是否在發行指令碼的結尾包含重新整理陳述式。
/p:Storage={File | Memory} Memory 指定在建置資料庫模型時,如何儲存項目。基於效能考量,預設值為 InMemory。若為非常龐大的資料庫,則需要 File-backed 儲存體。
/p:TreatVerificationErrorsAsWarnings={True | False} False 指定是否將發行驗證期間所發生的錯誤視為警告。系統會先針對產生的部署計畫執行檢查,之後再針對目標資料庫執行計畫。計畫驗證會偵測出遺漏僅限於目標的物件 (例如索引) 這類必須卸除後才能進行變更的問題。驗證也會偵測因為參考複合專案而有相依性 (例如資料表或檢視) 存在,但是卻不存在目標資料庫中的情況。您可以選擇將驗證錯誤視為警告,以取得所有問題的清單,而不讓發行動作在第一次錯誤時就停止。
/p:UnmodifiableObjectWarnings={True | False} True 指定在無法修改的物件中發現差異時 (例如檔案的檔案大小或檔案路徑不同) 是否應該產生警告。
/p:VerifyCollationCompatibility={True | False} True 指定是否驗證定序相容性。
/p:VerifyDeployment={True | False} True 指定是否應該在發行前執行檢查,以便在出現阻止發行成功的問題時停止發行動作。例如,如果目標資料庫的外部索引鍵不存在資料庫專案中,因而在您發行時造成錯誤,則發行動作可能會停止。

請參閱

資料庫生命週期管理