gpt4 book ai didi

sql-server - 将快照导入 SQL Server 2019 时出错

转载 作者:行者123 更新时间:2023-12-03 21:15:20 25 4
gpt4 key购买 nike

当我想将数据从快照 (bacpac) 文件导入 SQL Server 2019 时出现错误。

它在我的两台不同的 PC 上发生了两次。

如果有任何解决方案,请帮助我。

非常感谢!

错误:

enter image description here

错误详细信息:

enter image description here

以下是错误详情:

===================================

Object reference not set to an instance of an object. (Microsoft.Data.Tools.Schema.Sql)

Program Location:

at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateFragment(Int32 operation, IModelElement element) at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.DeploymentScriptDomGenerator.GenerateSteps(Int32 operation, IModelElement element) at Microsoft.Data.Tools.Schema.Sql.Deployment.OrderedStepGenerator.Add(DeploymentScriptDomGenerator scriptDom, IModelElement element, Int32 operation) at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildDependencyOrderedSteps(Int32 operation, List1 classOrder, List1 operationOrder, Dictionary2 changes, Boolean preserveGraphs, Dictionary2& relating, Dictionary2& related)
at Microsoft.Data.Tools.Schema.Sql.Deployment.Analyzers.PlanMediator.BuildOperations()
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.OnGeneratePlan()
at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeploymentPlanGenerator.GeneratePlan(List
1 drops) at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.BuildPlan() at Microsoft.Data.Tools.Schema.Sql.Deployment.SqlDeployment.Controller.CreatePlan() at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.<>c__DisplayClass5.b__1() at Microsoft.Data.Tools.Schema.Sql.Dac.OperationLogger.Capture(Action action) at Microsoft.SqlServer.Dac.DeployOperation.<>c__DisplayClass3.b__0(Object operation, CancellationToken token) at Microsoft.SqlServer.Dac.Operation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.ReportMessageOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.CompositeOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.DeployOperation.Microsoft.SqlServer.Dac.IOperation.Run(OperationContext context) at Microsoft.SqlServer.Dac.OperationExtension.Execute(IOperation operation, DacLoggingContext loggingContext, CancellationToken cancellationToken) at Microsoft.SqlServer.Dac.DacServices.InternalDeploy(IPackageSource packageSource, Boolean isDacpac, String targetDatabaseName, DacDeployOptions options, CancellationToken cancellationToken, DacLoggingContext loggingContext, Action3 reportPlanOperation, Boolean executePlan)
at Microsoft.SqlServer.Dac.DacServices.ImportBacpac(BacPackage package, String targetDatabaseName, DacImportOptions importOptions, Nullable
1 cancellationToken) at Microsoft.SqlServer.Dac.DacServices.ImportBacpac(BacPackage package, String targetDatabaseName, DacAzureDatabaseSpecification creationDefaults, Nullable`1 cancellationToken) at Microsoft.SqlServer.Management.Dac.DacWizard.ImportDatabase.DoWork() at Microsoft.SqlServer.Management.TaskForms.SimpleWorkItem.Run()

最佳答案

我遇到了同样的问题,并且能够使用以前版本的 SSMS(SQL Server Management Studio)解决这个问题,而不是 SQL Server 版本。以前的 SSMS 版本可以在这里下载:

https://docs.microsoft.com/en-us/sql/ssms/release-notes-ssms?view=sql-server-ver15#1791

ATTOW,当前版本是18.5。它适用于 17.9.1 和 18.4 版。

这在 SQL Server 2017 和 2019 上都适用于我,这是 SSMS 的问题,而不是 SQL Server 版本的问题。

我还尝试了带有 SQL Dacpac 扩展 ( https://github.com/microsoft/azuredatastudio/tree/master/extensions/dacpac ) 的 Azure Data Studio,但它失败了,错误与最新的 SSMS 版本相同。有一个问题未解决:https://github.com/microsoft/azuredatastudio/issues/9522

或者,不安装 SSMS,而是安装 sqlpackage来自 https://docs.microsoft.com/en-us/sql/tools/release-notes-sqlpackage?view=sql-server-ver15#184-sqlpackage (版本 18.4)并手动运行命令。就像是:
sqlpackage.exe /a:Import /df:"import.log" /sf:"mybacpac-2020-04-26.bacpac" /tcs:"Server=.;Database=mybacpac;Integrated Security=true"

关于sql-server - 将快照导入 SQL Server 2019 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61338497/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com