【发布时间】:2021-03-31 10:23:05
【问题描述】:
我在 Windows 10 Pro 202H 上使用 Visual Studio 2019 社区 SQL Server localdb。我一直在尝试将 WideWorldImporters 数据库从 WideWorldImporters-Full.bak(从 GitHub 下载)“恢复”到我的 localdb 实例,但没有成功。
到目前为止,这已经发生了: Qyery:(*** = 我的用户名)
USE master
RESTORE DATABASE WideWorldImporters
FROM disk = 'C:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Backup\WideWorldImporters-Full.bak'
WITH MOVE 'WWI_Primary' TO 'C:\Users\***\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\WideWorldImporters.mdf',
MOVE 'WWI_UserData' TO 'C:\Users\***\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\WideWorldImporters_UserData.ndf',
MOVE 'WWI_Log' TO 'C:\Users\***\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\WideWorldImporters.ldf',
MOVE 'WWI_InMemory_Data_1' TO 'C:\Users\***\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB\WideWorldImporters_InMemory_Data_1',
REPLACE
消息(窗格):
Processed 1464 pages for database 'WideWorldImporters', file 'WWI_Primary' on file 1.
Processed 53096 pages for database 'WideWorldImporters', file 'WWI_UserData' on file 1.
Processed 33 pages for database 'WideWorldImporters', file 'WWI_Log' on file 1.
Processed 3862 pages for database 'WideWorldImporters', file 'WWI_InMemory_Data_1' on file 1.
100% | No issues found
Executing query... (is running on and on)
Output (General) is empty
All the stuff notified in message window can be found in desitination folder:
WideWorldImportes_UserData.ndf (2 097 152 kb)
WideWorldImportes.mdf (1 048 576 kb)
WideWorldImportes.ldf ( 102 400 kb)
\WideWorldImportes_InMemory_Data_1\
filestream.hdr ( 1 kb)
\$FSLOG (empty )
\$HKv2
{1E6DC7E6-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 2 048 kb)
{3E231B6B-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 20 kb)
{4B9D83BE-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 2 048 kb)
{6E82296C-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 16 384 kb)
{6F44D507-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
{07FEB052-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 20 kb)
{7C4940C1-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
{9A77966E-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 4 096 kb)
{28CE0994-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 16 384 kb)
{63F1F945-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 2 048 kb)
{79B6C099-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 4 096 kb)
{122A2C90-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 16 384 kb)
{285FCA71-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 4 kb)
{421C57F0-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 4 096 kb)
{A54BA375-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
{C818BEE6-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 30 836 kb)
{CB6FF974-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
{F6F88B52-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
{F756E9B8-xxxx-xxxx-xxxx-xxxxxxxxxxxx}.hkckp ( 1 024 kb)
正在执行查询...(仍在运行,过去两个小时内文件大小没有变化)
【问题讨论】:
-
您可以安装WhoIsActive 并查找任何阻塞进程。
-
您是否检查过驱动器空间、tempDB 空间、日志文件增长等内容。检查 SqlServer 错误日志。
-
select * from sys.dm_exec_requests应该会给你很多信息,尤其是blocking_session_id, wait_resource, percent_complete列 -
那不是查询,那是 RESTORE 操作。
LocalDB是一个嵌入式 数据库,所以它的定义很慢。屏幕截图显示恢复已完成,服务器正在处理中断的事务(这表明备份是在繁忙时间进行的)。为什么不用 SQL Server Express?毕竟你已经安装了——LocalDB 是 SQL Server Express 的一个特性 -
或者您可以使用 SQL Server Developer,它也免费,但具有完整的企业功能集,例如默认并行和在线恢复。
标签: sql-server database visual-studio restore