我有 SQL Server 2017。那里有一个 3 TB 大小的数据库。不知何故,由于长时间运行的事务,数据库在 SQL 服务器重新启动后陷入了“恢复”模式。当我检查 sql 错误日志时,它说剩余 2 189 255 秒(第 2 阶段,共 3 阶段)已完成,将近 25 天。我的目标是即使丢失了一些数据,也能使数据库联机。
所以我运行了下面的命令,但没有运气。
USE [master]
GO
RESTORE DATABASE test WITH RECOVERY
--Msg 3101, Level 16, State 1, Line 6
--Exclusive access could not be obtained because the database is in use.
--Msg 3013, Level 16, State 1, Line 6
--RESTORE DATABASE is terminating abnormally.
ALTER DATABASE test SET EMERGENCY;
GO
--Msg 5011, Level 14, State 7, Line 13
--User does not …Run Code Online (Sandbox Code Playgroud) sql-server ×1