我有一个带有Windows 2012 R2和SQLServer2014EnterpriseEdition的Azure。我已经启用了IFI (添加了Server用户NTSERVICE\MSSQLSERVER以“执行卷维护任务”)。
我尝试恢复一个3GB的数据库与文件上的C驱动器(SSD),这需要大约40分钟完成。检查恢复进度,大约20分钟后,它就100%完成了。
在还原过程中,我让PREEMPTIVE_OS_WRITEFILEGATHER不断地出现在我的还原中。
对于3GB的数据库来说,40分钟太长了。
文件在C驱动器(不好)和所有其余的活动,在C驱动器-会有这种影响,我的恢复坏到40分钟,考虑到这仍然是一个SSD驱动器?
我还能找些什么来找出是什么让它花了那么长时间吗?
编辑:到目前为止,我已经检查了以下内容:
1-使用EXEC xp_cmdshell "whoami /priv"进行检查,我得到了SeManageVolumePrivilege Perform volume maintenance tasks Enabled -所以sql server用户确实有权限。
2-在下面的答案之后重新启动sqlservice,这是肯定的。
检查创建一个带有跟踪标志3004,3605 ON的新数据库,它只记录ldf的零值,而不是MDF -所以IFI是打开的
发布于 2015-12-16 15:12:22
wBob是正确的钱,你需要一个服务重新启动。我想加强他的回答,并给出一个脚本,也将验证,如果我确实是启用。
这将决定是否需要启动服务以允许本地策略使用。
USE MASTER;
SET NOCOUNT ON
-- *** WARNING: Undocumented commands used in this script !!! *** --
--Exit if a database named DummyTestDB exists
IF DB_ID('DummyTestDB') IS NOT NULL
BEGIN
RAISERROR (
'A database named DummyTestDB already exists, exiting script'
,20
,1
)
WITH LOG
END
--Temptable to hold output from sp_readerrorlog
IF OBJECT_ID('tempdb..#SqlLogs') IS NOT NULL
DROP TABLE #SqlLogs
GO
CREATE TABLE #SqlLogs (
LogDate DATETIME2(0)
,ProcessInfo VARCHAR(20)
,TEXT VARCHAR(MAX)
)
--Turn on trace flags 3004 and 3605
DBCC TRACEON (
3004
,3605
,- 1
)
WITH NO_INFOMSGS
--Create a dummy database to see the output in the SQL Server Errorlog
CREATE DATABASE DummyTestDB
GO
--Turn off trace flags 3004 and 3605
DBCC TRACEOFF (
3004
,3605
,- 1
)
WITH NO_INFOMSGS
--Remove the DummyDB
DROP DATABASE DummyTestDB;
--Now go check the output in the SQL Server Error Log File
--This can take a while if you have a large errorlog file
INSERT INTO #SqlLogs (
LogDate
,ProcessInfo
,TEXT
)
EXEC sp_readerrorlog 0
,1
,'Zeroing'
IF EXISTS (
SELECT *
FROM #SqlLogs
WHERE TEXT LIKE 'Zeroing completed%'
AND TEXT LIKE '%DummyTestDB.mdf%'
AND LogDate > DATEADD(HOUR, - 1, LogDate)
)
BEGIN
PRINT 'We do NOT have instant file initialization.'
PRINT 'Grant the SQL Server services account the ''Perform Volume Maintenance Tasks'' security policy.'
END
ELSE
BEGIN
PRINT 'We have instant file initialization.'
END发布于 2015-12-16 03:47:05
您重新启动服务了吗?只有在Server服务重新启动之后,即时文件初始化才会生效。
https://dba.stackexchange.com/questions/123721
复制相似问题