SqlPackage.exeSqlPackage.exe

SqlPackage.exe 는 다음 데이터베이스 개발 작업을 자동화하는 명령줄 유틸리티입니다.SqlPackage.exe is a command-line utility that automates the following database development tasks:

  • 버전: SqlPackage 애플리케이션의 빌드 번호를 반환합니다.Version: Returns the build number of the SqlPackage application. 버전 18.6에 추가되었습니다.Added in version 18.6.

  • 추출: 연결된 SQL 데이터베이스의 스키마 또는 스키마와 사용자 데이터를 포함하는 데이터 계층 애플리케이션(.dacpac) 파일을 만듭니다.Extract: Creates a data-tier application (.dacpac) file containing the schema or schema and user data from a connected SQL database.

  • 게시: 원본 .dacpac 파일의 스키마와 일치하도록 데이터베이스 스키마를 증분식으로 업데이트합니다.Publish: Incrementally updates a database schema to match the schema of a source .dacpac file. 데이터베이스가 서버에 존재하지 않을 경우 게시 작업을 통해 생성됩니다.If the database does not exist on the server, the publish operation creates it. 존재하는 경우 기존 데이터베이스가 업데이트됩니다.Otherwise, an existing database is updated.

  • Export: 데이터베이스 스키마 및 사용자 데이터를 포함하여 연결된 SQL 데이터베이스를 BACPAC 파일(.bacpac)로 내보냅니다.Export: Exports a connected SQL database - including database schema and user data - to a BACPAC file (.bacpac).

  • Import: BACPAC 파일의 스키마 및 테이블 데이터를 새 사용자 데이터베이스로 가져옵니다.Import: Imports the schema and table data from a BACPAC file into a new user database.

  • DeployReport: 게시 작업으로 변경된 사항의 XML 보고서를 만듭니다.DeployReport: Creates an XML report of the changes that would be made by a publish action.

  • DriftReport: 등록된 데이터베이스가 마지막으로 등록된 후에 변경된 사항의 XML 보고서를 만듭니다.DriftReport: Creates an XML report of the changes that have been made to a registered database since it was last registered.

  • 스크립트: 대상의 스키마가 원본의 스키마와 일치하도록 업데이트하는 Transact-SQL 증분 업데이트 스크립트를 만듭니다.Script: Creates a Transact-SQL incremental update script that updates the schema of a target to match the schema of a source.

SqlPackage.exe 명령줄을 사용하면 작업별 매개 변수 및 속성과 함께 이러한 작업을 지정할 수 있습니다.The SqlPackage.exe command line allows you to specify these actions along with action-specific parameters and properties.

최신 버전 다운로드 .Download the latest version. 최신 릴리스에 대한 자세한 내용은 릴리스 정보를 참조하세요.For details about the latest release, see the release notes.

명령줄 구문Command-Line Syntax

SqlPackage.exe 는 명령줄에 지정된 매개 변수, 속성 및 SQLCMD 변수를 사용하여 지정된 작업을 시작합니다.SqlPackage.exe initiates the actions specified using the parameters, properties, and SQLCMD variables specified on the command line.

SqlPackage {parameters}{properties}{SQLCMD Variables}  

사용 예Usage examples

SQL 스크립트 출력과 함께 .dacpac 파일을 사용하여 데이터베이스 간 비교 생성Generate a comparison between databases by using .dacpac files with a SQL script output

최신 데이터베이스 변경 내용의 .dacpac 파일을 만들어 시작합니다.Start by creating a .dacpac file of your latest database changes:

sqlpackage.exe /TargetFile:"C:\sqlpackageoutput\output_current_version.dacpac" /Action:Extract /SourceServerName:"." /SourceDatabaseName:"Contoso.Database"

변경되지 않은 데이터베이스 대상의 .dacpac 파일을 만듭니다.Create a .dacpac file of your database target (that has no changes):

sqlpackage.exe /TargetFile:"C:\sqlpackageoutput\output_target.dacpac" /Action:Extract /SourceServerName:"." /SourceDatabaseName:"Contoso.Database"

두 .dacpac 파일의 차이점을 생성하는 SQL 스크립트를 만듭니다.Create a SQL script that generates the differences of two .dacpac files:

sqlpackage.exe /Action:Script /SourceFile:"C:\sqlpackageoutput\output_current_version.dacpac" /TargetFile:"C:\sqlpackageoutput\output_target.dacpac" /TargetDatabaseName:"Contoso.Database" /OutputPath:"C:\sqlpackageoutput\output.sql"

버전Version

sqlpackage 버전을 빌드 번호로 표시합니다.Displays the sqlpackage version as a build number. 자동화된 파이프라인뿐만 아니라 대화형 프롬프트에서도 사용할 수 있습니다.Can be used in interactive prompts as well as in automated pipelines.

sqlpackage.exe /Version

종료 코드Exit codes

다음 종료 코드를 반환하는 명령:Commands that return the following exit codes:

  • 0 = 성공0 = success
  • 0이 아닌 값 = 실패non-zero = failure

매개 변수Parameters

일부 매개 변수는 SqlPackage 작업 간에 공유됩니다.Some parameters are shared between the SqlPackage actions. 다음은 매개 변수를 요약한 표입니다. 자세한 내용을 보려면 특정 작업 페이지를 클릭하세요.Below is a table summarizing the parameters, for more information click into the specific action pages.

매개 변수Parameter 약식Short Form 추출Extract 게시Publish 내보내기Export 가져오기Import DeployReportDeployReport DriftReportDriftReport 스크립트Script
/AccessToken:/AccessToken: /at/at xx xx xx xx xx xx xx
/ClientId:/ClientId: /cid/cid xx
/DeployScriptPath:/DeployScriptPath: /dsp/dsp xx xx
/DeployReportPath:/DeployReportPath: /drp/drp xx xx
/Diagnostics:/Diagnostics: /d/d xx xx xx xx xx xx xx
/DiagnosticsFile:/DiagnosticsFile: /df/df xx xx xx xx xx xx xx
/MaxParallelism:/MaxParallelism: /mp/mp xx xx xx xx xx xx xx
/OutputPath:/OutputPath: /op/op xx xx xx
/OverwriteFiles:/OverwriteFiles: /of/of xx xx xx xx xx xx
/Profile:/Profile: /pr/pr xx xx xx
/Properties:/Properties: /p/p xx xx xx xx xx xx
/Quiet:/Quiet: /q/q xx xx xx xx xx xx xx
/Secret:/Secret: /secr/secr xx
/SourceConnectionString:/SourceConnectionString: /scs/scs xx xx xx xx xx
/SourceDatabaseName:/SourceDatabaseName: /sdn/sdn xx xx xx xx xx
/SourceEncryptConnection:/SourceEncryptConnection: /sec/sec xx xx xx xx xx
/SourceFile:/SourceFile: /sf/sf xx xx xx xx
/SourcePassword:/SourcePassword: /sp/sp xx xx xx xx xx
/SourceServerName:/SourceServerName: /ssn/ssn xx xx xx xx xx
/SourceTimeout:/SourceTimeout: /st/st xx xx xx xx xx
/SourceTrustServerCertificate:/SourceTrustServerCertificate: /stsc/stsc xx xx xx xx xx
/SourceUser:/SourceUser: /su/su xx xx xx xx xx
/TargetConnectionString:/TargetConnectionString: /tcs/tcs xx xx xx xx
/TargetDatabaseName:/TargetDatabaseName: /tdn/tdn xx xx xx xx xx
/TargetEncryptConnection:/TargetEncryptConnection: /tec/tec xx xx xx xx xx
/TargetFile:/TargetFile: /tf/tf xx xx xx xx
/TargetPassword:/TargetPassword: /tp/tp xx xx xx xx xx
/TargetServerName:/TargetServerName: /tsn/tsn xx xx xx xx xx
/TargetTimeout:/TargetTimeout: /tt/tt xx xx xx xx xx
/TargetTrustServerCertificate:/TargetTrustServerCertificate: /ttsc/ttsc xx xx xx xx xx
/TargetUser:/TargetUser: /tu/tu xx xx xx xx xx
/TenantId:/TenantId: /tid/tid xx xx xx xx xx xx xx
/UniversalAuthentication:/UniversalAuthentication: /ua/ua xx xx xx xx xx xx xx
/Variables:/Variables: /v/v xx xx

속성Properties

일부 속성은 SqlPackage 작업 간에 공유됩니다.Some properties are shared between the SqlPackage actions. 다음은 속성을 요약한 표입니다. 자세한 내용을 보려면 특정 작업 페이지를 클릭하세요.Below is a table summarizing the properties, for more information click into the specific action pages.

속성Property 추출Extract 게시Publish 내보내기Export 가져오기Import DeployReportDeployReport 스크립트Script
AdditionalDeploymentContributorArguments=(STRING)AdditionalDeploymentContributorArguments=(STRING) xx xx xx
AdditionalDeploymentContributors=(STRING)AdditionalDeploymentContributors=(STRING) xx xx xx
AdditionalDeploymentContributorPaths=(STRING)AdditionalDeploymentContributorPaths=(STRING) xx xx xx
AllowDropBlockingAssemblies=(BOOLEAN)AllowDropBlockingAssemblies=(BOOLEAN) xx xx xx
AllowIncompatiblePlatform=(BOOLEAN)AllowIncompatiblePlatform=(BOOLEAN) xx xx xx
AllowUnsafeRowLevelSecurityDataMovement=(BOOLEAN)AllowUnsafeRowLevelSecurityDataMovement=(BOOLEAN) xx xx xx
AzureSharedAccessSignatureToken=(STRING)AzureSharedAccessSignatureToken=(STRING) xx
AzureStorageBlobEndpoint=(STRING)AzureStorageBlobEndpoint=(STRING) xx xx
AzureStorageContainer=(STRING)AzureStorageContainer=(STRING) xx xx
AzureStorageKey=(STRING)AzureStorageKey=(STRING) xx xx
AzureStorageRootPath=(STRING)AzureStorageRootPath=(STRING) xx xx
BackupDatabaseBeforeChanges=(BOOLEAN)BackupDatabaseBeforeChanges=(BOOLEAN) xx xx xx
BlockOnPossibleDataLoss=(BOOLEAN 'True')BlockOnPossibleDataLoss=(BOOLEAN 'True') xx xx xx
BlockWhenDriftDetected=(BOOLEAN 'True')BlockWhenDriftDetected=(BOOLEAN 'True') xx xx xx
CommandTimeout=(INT32 '60')CommandTimeout=(INT32 '60') xx xx xx xx xx xx
CommentOutSetVarDeclarations=(BOOLEAN)CommentOutSetVarDeclarations=(BOOLEAN) xx xx xx
CompareUsingTargetCollation=(BOOLEAN)CompareUsingTargetCollation=(BOOLEAN) xx xx xx
CreateNewDatabase=(BOOLEAN)CreateNewDatabase=(BOOLEAN) xx xx xx
DacApplicationDescription=(STRING)DacApplicationDescription=(STRING) xx
DacApplicationName=(STRING)DacApplicationName=(STRING) xx
DacMajorVersion=(INT32 '1')DacMajorVersion=(INT32 '1') xx
DacMinorVersion=(INT32 '0')DacMinorVersion=(INT32 '0') xx
DatabaseEdition=(ENUM 'Default')DatabaseEdition=(ENUM 'Default') xx xx xx xx
DatabaseLockTimeout=(INT32 '60')DatabaseLockTimeout=(INT32 '60') xx xx xx xx xx
DatabaseMaximumSize=(INT32)DatabaseMaximumSize=(INT32) xx xx xx xx
DatabaseServiceObjective=(STRING)DatabaseServiceObjective=(STRING) xx xx xx xx
DeployDatabaseInSingleUserMode=(BOOLEAN)DeployDatabaseInSingleUserMode=(BOOLEAN) xx xx xx
DisableAndReenableDdlTriggers=(BOOLEAN 'True')DisableAndReenableDdlTriggers=(BOOLEAN 'True') xx xx xx
DisableIndexesForDataPhase=(BOOLEAN 'True')DisableIndexesForDataPhase=(BOOLEAN 'True') xx
DoNotAlterChangeDataCaptureObjects=(BOOLEAN 'True')DoNotAlterChangeDataCaptureObjects=(BOOLEAN 'True') xx xx xx
DoNotAlterReplicatedObjects=(BOOLEAN 'True')DoNotAlterReplicatedObjects=(BOOLEAN 'True') xx xx xx
DoNotDropObjectType=(STRING)DoNotDropObjectType=(STRING) xx xx xx
DoNotDropObjectTypes=(STRING)DoNotDropObjectTypes=(STRING) xx xx xx
DropConstraintsNotInSource=(BOOLEAN 'True')DropConstraintsNotInSource=(BOOLEAN 'True') xx xx xx
DropDmlTriggersNotInSource=(BOOLEAN 'True')DropDmlTriggersNotInSource=(BOOLEAN 'True') xx xx xx
DropExtendedPropertiesNotInSource=(BOOLEAN 'True')DropExtendedPropertiesNotInSource=(BOOLEAN 'True') xx xx xx
DropIndexesNotInSource=(BOOLEAN 'True')DropIndexesNotInSource=(BOOLEAN 'True') xx xx xx
DropObjectsNotInSource=(BOOLEAN)DropObjectsNotInSource=(BOOLEAN) xx xx xx
DropPermissionsNotInSource=(BOOLEAN)DropPermissionsNotInSource=(BOOLEAN) xx xx xx
DropRoleMembersNotInSource=(BOOLEAN)DropRoleMembersNotInSource=(BOOLEAN) xx xx xx
DropStatisticsNotInSource=(BOOLEAN 'True')DropStatisticsNotInSource=(BOOLEAN 'True') xx xx xx
ExcludeObjectType=(STRING)ExcludeObjectType=(STRING) xx xx xx
ExcludeObjectTypes=(STRING)ExcludeObjectTypes=(STRING) xx xx xx
ExtractAllTableData=(BOOLEAN)ExtractAllTableData=(BOOLEAN) xx
ExtractApplicationScopedObjectsOnly=(BOOLEAN 'True')ExtractApplicationScopedObjectsOnly=(BOOLEAN 'True') xx
ExtractReferencedServerScopedElements=(BOOLEAN 'True')ExtractReferencedServerScopedElements=(BOOLEAN 'True') xx
ExtractUsageProperties=(BOOLEAN)ExtractUsageProperties=(BOOLEAN) xx
GenerateSmartDefaults=(BOOLEAN)GenerateSmartDefaults=(BOOLEAN) xx xx xx
IgnoreAnsiNulls=(BOOLEAN 'True')IgnoreAnsiNulls=(BOOLEAN 'True') xx xx xx
IgnoreAuthorizer=(BOOLEAN)IgnoreAuthorizer=(BOOLEAN) xx xx xx
IgnoreColumnCollation=(BOOLEAN)IgnoreColumnCollation=(BOOLEAN) xx xx
IgnoreColumnOrder=(BOOLEAN)IgnoreColumnOrder=(BOOLEAN) xx xx xx
IgnoreComments=(BOOLEAN)IgnoreComments=(BOOLEAN) xx xx xx
IgnoreCryptographicProviderFilePath=(BOOLEAN 'True')IgnoreCryptographicProviderFilePath=(BOOLEAN 'True') xx xx xx
IgnoreDdlTriggerOrder=(BOOLEAN)IgnoreDdlTriggerOrder=(BOOLEAN) xx xx xx
IgnoreDdlTriggerState=(BOOLEAN)IgnoreDdlTriggerState=(BOOLEAN) xx xx xx
IgnoreDefaultSchema=(BOOLEAN)IgnoreDefaultSchema=(BOOLEAN) xx xx xx
IgnoreDmlTriggerOrder=(BOOLEAN)IgnoreDmlTriggerOrder=(BOOLEAN) xx xx xx
IgnoreDmlTriggerState=(BOOLEAN)IgnoreDmlTriggerState=(BOOLEAN) xx xx xx
IgnoreExtendedProperties=(BOOLEAN)IgnoreExtendedProperties=(BOOLEAN) xx xx xx xx
IgnoreFileAndLogFilePath=(BOOLEAN 'True')IgnoreFileAndLogFilePath=(BOOLEAN 'True') xx xx xx
IgnoreFilegroupPlacement=(BOOLEAN 'True')IgnoreFilegroupPlacement=(BOOLEAN 'True') xx xx xx
IgnoreFileSize=(BOOLEAN 'True')IgnoreFileSize=(BOOLEAN 'True') xx xx xx
IgnoreFillFactor=(BOOLEAN 'True')IgnoreFillFactor=(BOOLEAN 'True') xx xx xx
IgnoreFullTextCatalogFilePath=(BOOLEAN 'True')IgnoreFullTextCatalogFilePath=(BOOLEAN 'True') xx xx xx
IgnoreIdentitySeed=(BOOLEAN)IgnoreIdentitySeed=(BOOLEAN) xx xx xx
IgnoreIncrement=(BOOLEAN)IgnoreIncrement=(BOOLEAN) xx xx xx
IgnoreIndexOptions=(BOOLEAN)IgnoreIndexOptions=(BOOLEAN) xx xx xx
IgnoreIndexPadding=(BOOLEAN 'True')IgnoreIndexPadding=(BOOLEAN 'True') xx xx xx
IgnoreKeywordCasing=(BOOLEAN 'True')IgnoreKeywordCasing=(BOOLEAN 'True') xx xx xx
IgnoreLockHintsOnIndexes=(BOOLEAN)IgnoreLockHintsOnIndexes=(BOOLEAN) xx xx xx
IgnoreLoginSids=(BOOLEAN 'True')IgnoreLoginSids=(BOOLEAN 'True') xx xx xx
IgnoreNotForReplication=(BOOLEAN)IgnoreNotForReplication=(BOOLEAN) xx xx xx
IgnoreObjectPlacementOnPartitionScheme=(BOOLEAN 'True')IgnoreObjectPlacementOnPartitionScheme=(BOOLEAN 'True') xx xx xx
IgnorePartitionSchemes=(BOOLEAN)IgnorePartitionSchemes=(BOOLEAN) xx xx xx
IgnorePermissions=(BOOLEAN 'True')IgnorePermissions=(BOOLEAN 'True') xx xx xx xx
IgnoreQuotedIdentifiers=(BOOLEAN 'True')IgnoreQuotedIdentifiers=(BOOLEAN 'True') xx xx xx
IgnoreRoleMembership=(BOOLEAN)IgnoreRoleMembership=(BOOLEAN) xx xx xx
IgnoreRouteLifetime=(BOOLEAN 'True')IgnoreRouteLifetime=(BOOLEAN 'True') xx xx xx
IgnoreSemicolonBetweenStatements=(BOOLEAN 'True')IgnoreSemicolonBetweenStatements=(BOOLEAN 'True') xx xx xx
IgnoreTableOptions=(BOOLEAN)IgnoreTableOptions=(BOOLEAN) xx xx xx
IgnoreTablePartitionOptions=(BOOLEAN)IgnoreTablePartitionOptions=(BOOLEAN) xx xx xx
IgnoreUserLoginMappings=(BOOLEAN)IgnoreUserLoginMappings=(BOOLEAN) xx
IgnoreUserSettingsObjects=(BOOLEAN)IgnoreUserSettingsObjects=(BOOLEAN) xx xx xx
IgnoreWhitespace=(BOOLEAN 'True')IgnoreWhitespace=(BOOLEAN 'True') xx xx xx
IgnoreWithNocheckOnCheckConstraints=(BOOLEAN)IgnoreWithNocheckOnCheckConstraints=(BOOLEAN) xx xx
IgnoreWithNocheckOnForeignKeys=(BOOLEAN)IgnoreWithNocheckOnForeignKeys=(BOOLEAN) xx xx
ImportContributorArguments=(STRING)ImportContributorArguments=(STRING) xx
ImportContributors=(STRING)ImportContributors=(STRING) xx
ImportContributorPaths=(STRING)ImportContributorPaths=(STRING) xx
IncludeCompositeObjects=(BOOLEAN)IncludeCompositeObjects=(BOOLEAN) xx xx xx
IncludeTransactionalScripts=(BOOLEAN)IncludeTransactionalScripts=(BOOLEAN) xx xx xx
LongRunningCommandTimeout=(INT32)LongRunningCommandTimeout=(INT32) xx xx xx xx xx xx
NoAlterStatementsToChangeClrTypes=(BOOLEAN)NoAlterStatementsToChangeClrTypes=(BOOLEAN) xx xx xx
PopulateFilesOnFileGroups=(BOOLEAN 'True')PopulateFilesOnFileGroups=(BOOLEAN 'True') xx xx xx
RebuildIndexesOfflineForDataPhase=(BOOLEAN 'False')RebuildIndexesOfflineForDataPhase=(BOOLEAN 'False') xx
RegisterDataTierApplication=(BOOLEAN)RegisterDataTierApplication=(BOOLEAN) xx xx xx
RunDeploymentPlanExecutors=(BOOLEAN)RunDeploymentPlanExecutors=(BOOLEAN) xx xx xx
ScriptDatabaseCollation=(BOOLEAN)ScriptDatabaseCollation=(BOOLEAN) xx xx xx
ScriptDatabaseCompatibility=(BOOLEAN)ScriptDatabaseCompatibility=(BOOLEAN) xx xx xx
ScriptDatabaseOptions=(BOOLEAN 'True')ScriptDatabaseOptions=(BOOLEAN 'True') xx xx xx
ScriptDeployStateChecks=(BOOLEAN)ScriptDeployStateChecks=(BOOLEAN) xx xx xx
ScriptFileSize=(BOOLEAN)ScriptFileSize=(BOOLEAN) xx xx xx
ScriptNewConstraintValidation=(BOOLEAN 'True')ScriptNewConstraintValidation=(BOOLEAN 'True') xx xx xx
ScriptRefreshModule=(BOOLEAN 'True')ScriptRefreshModule=(BOOLEAN 'True') xx xx xx
Storage=({File|Memory} 'File')Storage=({File|Memory} 'File') xx xx xx xx xx xx
TableData=(STRING)TableData=(STRING) xx xx
TargetEngineVersion=(ENUM 'Latest')TargetEngineVersion=(ENUM 'Latest') xx
TempDirectoryForTableData=(STRING)TempDirectoryForTableData=(STRING) xx xx
TreatVerificationErrorsAsWarnings=(BOOLEAN)TreatVerificationErrorsAsWarnings=(BOOLEAN) xx xx xx
UnmodifiableObjectWarnings=(BOOLEAN 'True')UnmodifiableObjectWarnings=(BOOLEAN 'True') xx xx xx
VerifyCollationCompatibility=(BOOLEAN 'True')VerifyCollationCompatibility=(BOOLEAN 'True') xx xx xx
VerifyDeployment=(BOOLEAN 'True')VerifyDeployment=(BOOLEAN 'True') xx xx xx
VerifyExtraction=(BOOLEAN)VerifyExtraction=(BOOLEAN) xx
VerifyFullTextDocumentTypesSupported=(BOOLEAN)VerifyFullTextDocumentTypesSupported=(BOOLEAN) xx

다음 단계Next steps