SQL Server Profiler 跟踪不断出现检索数据
用SQL Server Profiler跟踪SQL的时候,老是出现下面的执行.而且不间断,隔几秒就会出现一次,很是恼火.找了半天,发现是
ReportServer数据库里面的表.但是总不能删掉这个数据库把.后来网上找了下,关掉Report服务就行了,打开Reporting Services
配置管理器,停掉服务,总算清静了.继续优化项目.
declare @BatchID uniqueidentifier
set @BatchID = newid ()
UPDATE [ Notifications ] WITH (TABLOCKX)
SET [ BatchID ] = @BatchID ,
[ ProcessStart ] = GETUTCDATE(),
[ ProcessHeartbeat ] = GETUTCDATE()
FROM (
SELECT TOP 4 [ NotificationID ] FROM [ Notifications ] WITH (TABLOCKX) WHERE ProcessStart is NULL and
(ProcessAfter is NULL or ProcessAfter < GETUTCDATE()) ORDER BY [ NotificationEntered ]
) AS t1
WHERE [ Notifications ] . [ NotificationID ] = t1. [ NotificationID ]
select top 4
-- Notification data
N. [ NotificationID ] ,
N. [ SubscriptionID ] ,
N. [ ActivationID ] ,
N. [ ReportID ] ,
N. [ SnapShotDate ] ,
N. [ DeliveryExtension ] ,
N. [ ExtensionSettings ] ,
N. [ Locale ] ,
N. [ Parameters ] ,
N. [ SubscriptionLastRunTime ] ,
N. [ ProcessStart ] ,
N. [ NotificationEntered ] ,
N. [ Attempt ] ,
N. [ IsDataDriven ] ,
SUSER_SNAME (Owner. [ Sid ] ),
Owner. [ UserName ] ,
-- Report Data
O. [ Path ] ,
O. [ Type ] ,
SD.NtSecDescPrimary,
N. [ Version ] ,
Owner. [ AuthType ]
from
[ Notifications ] N with (TABLOCKX) inner join [ Catalog ] O on O. [ ItemID ] = N. [ ReportID ]
inner join [ Users ] Owner on N.SubscriptionOwnerID = Owner.UserID
left outer join [ SecData ] SD on O. [ PolicyID ] = SD. [ PolicyID ] AND SD.AuthType = Owner.AuthType
where
N. [ BatchID ] = @BatchID
ORDER BY [ NotificationEntered ]