本文介绍了无法从Windows容器中的.bak文件还原大型(4GB)MSSQL备份的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 设置: 使用Windows服务器2016年技术预览5的Azure上的VM 安装了1023 GB的其他磁盘为 F:\ 驱动器 F:\ data-dump         : 数据库转储(.bak)4GB F:\ sql                    : 将在运行时挂载到容器中 基本映像: 在此博客后创建的基本MSSQL映像, https://26thcentury.com/2016/01/03/dockerfile-to-create-sql-server-express-windows-container-image/ 构建映像 docker build -t sqlexpress。 运行容器: docker run --name sql -d -p 1433:1433 -v F:\ sql:c:\sql -v F:\ data-dump:c:\ data-dump sqlexpress docker exec -it sql cmd 内部容器 c:\  powershell.exe -command"& {&'Invoke-Sqlcmd'-ServerInstance \" localhost \ SQL \" -QueryTimeout 20000 -Query \" RESTORE DATABASE [BillingAdmin] FROM  DISK = N'C:\ data-dump \BillingAdmin_30052016.bak'WITH  FILE = 1,  MOVE N'BillingAdmin_data' TO N'C:\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ',  NOUNLOAD,  STATS = 5 \"}" 错误 Invoke-Sqlcmd:磁盘卷'C:\'上的可用空间不足,无法创建数据库。数据库需要24809111552个额外的空闲字节,而只有21192884224个字节可用。 在规划RESTORE语句时发现了问题。以前的消息提供了详细信息。 RESTORE DATABASE正在异常终止 :::::::::::::: 问题: 1.我正在将容器目录"C:\ data-dump"和"C:\ sql"挂载到主机目录分别为"F:\ data-dump"和"F:\ sql"。"F:\"驱动器的空间大约为1000GB,那么为什么我的错误不足? 2.是否可以创建一个大于20GB的容器(假设!!)默认大小?如果不是现在,可能是将来? 3.是吗?是否有任何解决方法? 4。坏消息:这个数据库转储只有4GB,是我们最小的一个。有85GB到500GB的人排队等候。 : - ) 解决方案 不确定它是否与sql server的快速版本相关(如果我记得正确的话)有关数据库大小的限制) 但在尝试运行时开发者版我遇到了同样的问题,通过传递 - storage-opt size = 1024G pre> &到docker命令,例如: docker run -d --expose 1433 -e sa_password =" 2P @提供ssword" --name = QUOT; SQL" -e ACCEPT_EULA = Y --storage-opt size = 1024G -v"D:/ Restore / MSSQLBackUP":" C:/ Backup" -v"D:/ Restore / Data":"C:/ Data": microsoft / mssql-server-windows-developer Set Up:VM on Azure with Windows server 2016 Technology Preview 5Additional disk of 1023 GB mounted as F:\ driveF:\data-dump         :   Database dump (.bak) 4GBF:\sql                     :   Will be mounted to container while running Base Image:Base MSSQL image created following this blog,https://26thcentury.com/2016/01/03/dockerfile-to-create-sql-server-express-windows-container-image/Build the imagedocker build -t sqlexpress .Running The container:docker run --name sql -d -p 1433:1433 -v F:\sql:c:\sql -v F:\data-dump:c:\data-dump sqlexpressdocker exec -it sql cmdInside Containerc:\ powershell.exe -command "& {&'Invoke-Sqlcmd' -ServerInstance \"localhost\SQL\" -QueryTimeout 20000 -Query \"RESTORE DATABASE [BillingAdmin] FROM  DISK = N'C:\data-dump\BillingAdmin_30052016.bak' WITH  FILE = 1,  MOVE N'BillingAdmin_data' TO N'C:\sql\data\MSSQL12.SQL\MSSQL\DATA\BillingAdmin.mdf', MOVE N'BillingAdmin_log' TO N'C:\sql\data\BillingAdmin_log.LDF',  NOUNLOAD,  STATS = 5\"}"ErrorInvoke-Sqlcmd: There is insufficient freespace on disk volume 'C:\' to create the database. The Database requires 24809111552 additional free bytes, while only 21192884224 bytes are available.Problems were identified while planning for the RESTORE statement.Previous messages provide details.RESTORE DATABASE is terminating abnormally::::::::::::::Questions:1. I am mounting container directories "C:\data-dump" and "C:\sql" to host directory "F:\data-dump" and "F:\sql" respectively. "F:\" drive has around 1000GB space, so why Am I getting insufficient error?2. Is it possible to Create a Container with Bigger size than 20GB(assuming!!) default size? if not now, may be in future?3. Is there any work around?4. Bad news: this database dump is just 4GB, smallest one we have. There are few with 85GB to 500GB waiting in queue. :-) 解决方案 Not sure if it is related to express edition of sql server (which if I remember correct has limitations about database size)But while trying to run developers edition I got into same issue, which was successully workarounded by passing--storage-opt size=1024G to the docker command e.g.:docker run -d --expose 1433 -e sa_password="P@ssword" --name="sql" -e ACCEPT_EULA=Y --storage-opt size=1024G -v "D:/Restore/MSSQLBackUP":"C:/Backup" -v "D:/Restore/Data":"C:/Data" microsoft/mssql-server-windows-developer 这篇关于无法从Windows容器中的.bak文件还原大型(4GB)MSSQL备份的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-29 21:31