我刚刚将 .bacpac
文件恢复到本地 SQL Server 实例 (64b v12.0.4213),备份来自 azure sql 实例。
由于 OOM 异常,它失败了几次。我关闭了计算机上的所有内容,在恢复结束时,SQL Server 服务实例消耗了 700MB 文件中的 13GB 内存!
幸运的是,恢复完成了,但内存似乎没有被释放/垃圾收集。当我写这篇文章时,它的内存仍然是 12GB。
这是一个已知问题吗?有什么方法可以恢复 .bacpac
并选择要忽略的表吗?您可以通过正常的数据恢复来完成此操作,最令人反感的表是 dbo.[Logs] 表、obvs。
最佳答案
我也遇到了同样的问题;修改服务器可用的内存没有影响。
对我来说,解决方案是使用命令行 (PowerShell) 执行导入。
[string]$myBacpac = 'c:\temp\myBacpac123.bacpac'
[string]$connectionString = 'Data Source=.;Initial Catalog=MyNewCatalog; Integrated Security=true;'
[string]$action = 'Import'
[string[]]$commandParameters = @(
"/Action:`"$action`""
"/SourceFile:`"$myBacpac`""
"/TargetConnectionString:`"$connectionString`""
)
[string]$LatestSqlPackage = Get-Item 'C:\*\Microsoft SQL Server\*\DAC\bin\sqlpackage.exe' | %{get-command $_}| sort version -Descending | select -ExpandProperty source -First 1
if ($LatestSqlPackage) {
Write-Verbose "Found: $LatestSqlPackage"
& $LatestSqlPackage $commandParameters
} else {
Write-Error "Could not find SqlPackage.exe"
}
在第一次尝试时,我收到了有关不受支持的模型版本的错误:
Importing to database 'MyNewCatalog' on server '.'. Creating deployment plan Initializing deployment SqlPackage.exe : * Error importing database:Could not read schema model header information from package. At line:1 char:1 + & $sqlPackage /Action:Import /SourceFile:"c:\temp\myBacpac123.bacpac" /T ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (* Error impor...n from package.:String) [], RemoteException + FullyQualifiedErrorId : NativeCommandError The model version '3.5' is not supported.
对于该错误,我按照此处的指导进行操作:https://stackoverflow.com/a/40541210/361842 ;即安装的 Microsoft SQL Server 数据层应用程序框架 (16.4)
。重新运行一切成功。
关于sql-server - bacpac 还原到 SQL Server 的内存使用情况,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34653115/