显示标签为“runs”的博文。显示所有博文
显示标签为“runs”的博文。显示所有博文

2012年3月26日星期一

FlatFile connection and security

My DTS package, deployed and run from the file system, works just fine for me, but fails when someone else runs it. The only explicit error from the dtexec command is:

Error: 2005-06-24 12:35:03.33
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error

This error just started when we tried to point to a file on a network server instead of a file local to the machine running the package. The other person definitely has access rights to that network server, but the package fails anyway.

One possible solution might be to specify a username/password for the file, but I don't see how to include that in the connection string. Alternatively, this may be a more general security issue with the whole package. I first turned to BOL for some explanations and answers, but wasn't able to find anything specific to my problem.

Any help or suggestions will be greatly appreciated. Thanks!
Phil
This is because the default protection level is to encrypt with a user key. That means only a user on his/her machine can open the package.

You probably want to use Package Password here instead.|||

I am getting a similar error on a DTS package created by me and migrated by me and executed by me via Dtexec. Shouldn't ssql 2000 ownership carry over to 2005? The package is not a flat file. And, by the way, where does the "DTS Property" come in?

thanks

Ted

Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Started: 9:24:56 AM
Error: 2006-02-08 09:24:56.50
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Error: 2006-02-08 09:24:56.51
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error

|||

SSIS is a completely new product so I don't think it follows that DTS behaviour should make it into SSIS. Furthermore, there's been a very high profile tightening up of security within Microsoft products and the behaviour you're seeing here is probably as a result of that.

The reason you see references to "DTS" in various places is for legacy reasons. Alot of the product had already been built before the name change came about.

-Jamie

sql

FlatFile connection and security

My DTS package, deployed and run from the file system, works just fine for me, but fails when someone else runs it. The only explicit error from the dtexec command is:

Error: 2005-06-24 12:35:03.33
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that the correct key is available.
End Error

This error just started when we tried to point to a file on a network server instead of a file local to the machine running the package. The other person definitely has access rights to that network server, but the package fails anyway.

One possible solution might be to specify a username/password for the file, but I don't see how to include that in the connection string. Alternatively, this may be a more general security issue with the whole package. I first turned to BOL for some explanations and answers, but wasn't able to find anything specific to my problem.

Any help or suggestions will be greatly appreciated. Thanks!
PhilThis is because the default protection level is to encrypt with a user key. That means only a user on his/her machine can open the package.

You probably want to use Package Password here instead.|||

I am getting a similar error on a DTS package created by me and migrated by me and executed by me via Dtexec. Shouldn't ssql 2000 ownership carry over to 2005? The package is not a flat file. And, by the way, where does the "DTS Property" come in?

thanks

Ted

Microsoft (R) SQL Server Execute Package Utility
Version 9.00.1399.06 for 32-bit
Copyright (C) Microsoft Corp 1984-2005. All rights reserved.
NULL
Started: 9:24:56 AM
Error: 2006-02-08 09:24:56.50
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Property" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error
Error: 2006-02-08 09:24:56.51
Code: 0xC0016016
Source:
Description: Failed to decrypt protected XML node "DTS:Password" with error 0x8009000B "Key not valid for use in specified state.". You may not be authorized to access this information. This error occurs when there is a cryptographic error. Verify that
the correct key is available.
End Error

|||

SSIS is a completely new product so I don't think it follows that DTS behaviour should make it into SSIS. Furthermore, there's been a very high profile tightening up of security within Microsoft products and the behaviour you're seeing here is probably as a result of that.

The reason you see references to "DTS" in various places is for legacy reasons. Alot of the product had already been built before the name change came about.

-Jamie

2012年3月7日星期三

First time, it times-out. After that it is fine.

I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.

In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.

The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.

What is going on and how do I fix it?

Pops73

Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||

Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?

Pops73

|||

Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.

http://msdn2.microsoft.com/en-US/library/ms187762.aspx

Run these commands:

DBCC FREEPROCCACHE

GO

CHECKPOINT

GO

DBCC DROPCLEANBUFFERS

|||

Thank you for your help. This still does not reproduce the problem.

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.

running Sql Server 2005 sp1

I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem

Part of the table definition

CREATE TABLE [dbo].[TempMtrScan](

[ID] [bigint] IDENTITY(1,1) NOT NULL,

[ShovelID] [int] NOT NULL,

[DateTime] [datetime] NOT NULL,

[FHoistNDE] [float] NULL,

[FHoistDE] [float] NULL,

[FHoistIP] [float] NULL,

[FHoistFLD] [float] NULL, ............

Query 1

INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])

SELECT ShovelID, TempMtrScanName, Temperature

FROM

(SELECT ShovelID,[DateTime],

FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

FROM dbo.TempMtrScan

WHERE [Datetime] =

(SELECT MAX([datetime])

FROM dbo.TempMtrScan

WHERE ShovelID = @.ShovelID)

AND ShovelID = @.ShovelID) A

UNPIVOT (

Temperature

FOR TempMtrScanName

IN ( FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

)

) AS unpvt

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Query 2

SELECT

(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,

(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,

(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,

(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,

(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,

(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,

(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,

(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,

(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,

(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,

(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,

(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,

(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,

(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,

(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,

(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,

(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,

(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,

(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,

(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,

(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,

(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,

(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,

(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,

(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,

(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,

(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,

(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,

(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,

(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,

(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,

(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,

(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,

(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,

(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,

(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,

(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,

(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,

(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,

(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,

(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,

(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,

(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,

(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,

(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,

(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,

(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,

(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,

(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,

(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,

(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,

(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,

(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,

(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,

(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,

(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,

(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,

(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,

(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,

(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,

(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,

(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,

(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,

(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,

(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,

(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,

(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,

(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,

(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,

(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,

(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,

(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,

(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,

(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,

(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,

(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,

(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,

(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,

(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,

(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,

(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,

(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,

(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,

(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,

(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,

Max(T.DateTime) as "TemperatureTime"

FROM TempMtrScan T

JOIN Shovel S ON T.ShovelID = S.ID

WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime

Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration

order by Max(T.DateTime) asc

(1943 row(s) affected)

Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Warning: Null value is eliminated by an aggregate or other SET operation.

First time, it times out. After that it is fine.

I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.

In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.

The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.

What is going on and how do I fix it?

Pops73

Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||

Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?

Pops73

|||

Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.

http://msdn2.microsoft.com/en-US/library/ms187762.aspx

Run these commands:

DBCC FREEPROCCACHE

GO

CHECKPOINT

GO

DBCC DROPCLEANBUFFERS

|||

Thank you for your help. This still does not reproduce the problem.

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.

running Sql Server 2005 sp1

I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem

Part of the table definition

CREATE TABLE [dbo].[TempMtrScan](

[ID] [bigint] IDENTITY(1,1) NOT NULL,

[ShovelID] [int] NOT NULL,

[DateTime] [datetime] NOT NULL,

[FHoistNDE] [float] NULL,

[FHoistDE] [float] NULL,

[FHoistIP] [float] NULL,

[FHoistFLD] [float] NULL, ............

Query 1

INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])

SELECT ShovelID, TempMtrScanName, Temperature

FROM

(SELECT ShovelID,[DateTime],

FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

FROM dbo.TempMtrScan

WHERE [Datetime] =

(SELECT MAX([datetime])

FROM dbo.TempMtrScan

WHERE ShovelID = @.ShovelID)

AND ShovelID = @.ShovelID) A

UNPIVOT (

Temperature

FOR TempMtrScanName

IN ( FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

)

) AS unpvt

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Query 2

SELECT

(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,

(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,

(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,

(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,

(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,

(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,

(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,

(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,

(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,

(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,

(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,

(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,

(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,

(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,

(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,

(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,

(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,

(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,

(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,

(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,

(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,

(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,

(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,

(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,

(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,

(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,

(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,

(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,

(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,

(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,

(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,

(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,

(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,

(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,

(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,

(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,

(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,

(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,

(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,

(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,

(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,

(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,

(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,

(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,

(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,

(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,

(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,

(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,

(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,

(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,

(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,

(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,

(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,

(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,

(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,

(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,

(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,

(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,

(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,

(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,

(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,

(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,

(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,

(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,

(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,

(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,

(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,

(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,

(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,

(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,

(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,

(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,

(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,

(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,

(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,

(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,

(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,

(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,

(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,

(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,

(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,

(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,

(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,

(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,

(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,

Max(T.DateTime) as "TemperatureTime"

FROM TempMtrScan T

JOIN Shovel S ON T.ShovelID = S.ID

WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime

Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration

order by Max(T.DateTime) asc

(1943 row(s) affected)

Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Warning: Null value is eliminated by an aggregate or other SET operation.

First time it times out after that it is fine

I have a stored procedure that runs slowly and takes over 60 seconds sometimes, but almost all of the time it takes only one or two seconds. In both cases the same input data is used and there have been no changes to the table. The slow running is after the query has not been run for several days.

In the background 16 records are inserted every minute. The table has 5 million records. There are two indexes on the table one is clustered the other is unclustered. They are very well tuned. The record contains a two integers and 90 floats.

The stored procedure gets one record from the database which is the latest record for a particular entity. If I go to the web site after a few days the page times out. If I go to Mgmt Studio, and run the sp form there it takes a very long time but eventually comes back with the correct answer. If execute the stored procedure after that the response is a second or two using the same input data. If I change the input data the response is equally as fast. The web site also works very quickly too.

What is going on and how do I fix it?

Pops73

Try running the SP with SET STATISTICS IO ON, then look at the messages tab. It sounds like the first time you run the query, it is having to do physical reads as opposed to logical reads. The second time you run it, it is doing logical reads, which would be much, much faster.|||

Thank you for the response and it sounds reasonable. I restarted the server which I thought would clear the buffer cache and cause the problem to occur. But it didn't after the restart the timeout did not occur. Response was good. Is the buffer cache saved through a restart of a server? How can I clear the cache to easily reproduce the problem and gather the statistics?

Pops73

|||

Restarting the server does clear the the buffer cache. You can run the command DBCC FREEPROCCACHE to clear out the procedure cache, and DBCC DROPCLEANBUFFERS to flush the data cache.

http://msdn2.microsoft.com/en-US/library/ms187762.aspx

Run these commands:

DBCC FREEPROCCACHE

GO

CHECKPOINT

GO

DBCC DROPCLEANBUFFERS

|||

Thank you for your help. This still does not reproduce the problem.

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

More info -- I moved the indexes. I have the data in one file group with three files and the indexes in another file group with two files. I still saw the problem.

running Sql Server 2005 sp1

I had the problem yesterday in another db instance of the same applicaiton on another machine. This table only had one record instead of 5 million. Two different queries will show the same problem

Part of the table definition

CREATE TABLE [dbo].[TempMtrScan](

[ID] [bigint] IDENTITY(1,1) NOT NULL,

[ShovelID] [int] NOT NULL,

[DateTime] [datetime] NOT NULL,

[FHoistNDE] [float] NULL,

[FHoistDE] [float] NULL,

[FHoistIP] [float] NULL,

[FHoistFLD] [float] NULL, ............

Query 1

INSERT INTO @.TempMtrScanUnpivot ([ShovelID],[TempMtrScanName], [Temperature])

SELECT ShovelID, TempMtrScanName, Temperature

FROM

(SELECT ShovelID,[DateTime],

FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

FROM dbo.TempMtrScan

WHERE [Datetime] =

(SELECT MAX([datetime])

FROM dbo.TempMtrScan

WHERE ShovelID = @.ShovelID)

AND ShovelID = @.ShovelID) A

UNPIVOT (

Temperature

FOR TempMtrScanName

IN ( FHoistNDE,FHoistDE,

RHoistNDE,RHoistDE,

CrowdNDE,CrowdDE,

SwingNDE,SwingDE,

RearSwingNDE,RearSwingDE,

RPropelNDE,RPropelDE,

LPropelNDE,LPropelDE,

LFrontSwingNDE,LFrontSwingDE,

RFrontSwingNDE,RFrontSwingDE,

TransPhaseA,TransPhaseB,TransPhaseC,

DriveInletTemp1,DriveInletTemp2,DriveInletTemp3,DriveInletTemp4,

DriveInletTemp5,DriveInletTemp6,DriveInletTemp7,DriveInletTemp8,

CwdMotorTemp,CwdMotorWindABTemp,CwdMotorWindBCTemp,CwdMotorWindCATemp,

PplRhtMtrMotorTemp,PplRhtMtrMotorWindABTemp,PplRhtMtrMotorWindBCTemp,PplRhtMtrMotorWindCATemp,

SwgLFntMtrMotorTemp,SwgLFntMtrMotorWindABTemp,SwgLFntMtrMotorWindBCTemp,SwgLFntMtrMotorWindCATemp,

HstRearMtrMotorTemp,HstRearMtrMotorWindABTemp,HstRearMtrMotorWindBCTemp,HstRearMtrMotorWindCATemp,

PplLftMtrMotorTemp,PplLftMtrMotorWindABTemp,PplLftMtrMotorWindBCTemp,PplLftMtrMotorWindCATemp,

SwgRFntMtrMotorTemp,SwgRFntMtrMotorWindABTemp,SwgRFntMtrMotorWindBCTemp,SwgRFntMtrMotorWindCATemp,

HstFntMtrMotorTemp,HstFntMtrMotorWindABTemp,HstFntMtrMotorWindBCTemp,HstFntMtrMotorWindCATemp,

SwgRearMtrMotorTemp,SwgRearMtrMotorWindABTemp,SwgRearMtrMotorWindBCTemp,SwgRearMtrMotorWindCATemp,

SwgFntMtrMotorTemp, SwgFntMtrMotorWindABTemp, SwgFntMtrMotorWindBCTemp, SwgFntMtrMotorWindCATemp, ACS800Temp,

TempDiffPhsU, TempDiffPhsV, TempDiffPhsW

)

) AS unpvt

Table '#7F0FE051'. Scan count 0, logical reads 21, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 1, logical reads 8, physical reads 3, read-ahead reads 607, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Query 2

SELECT

(max(T.FHoistNDE)* 1.8 + 32) as "FHoistNDE" ,

(max(T.FHoistDE)* 1.8 + 32) as "FHoistDE" ,

(max(T.FHoistIP)* 1.8 + 32) as "FHoistIP" ,

(max(T.FHoistFLD)* 1.8 + 32) as "FHoistFLD" ,

(max(T.RHoistNDE)* 1.8 + 32) as "RHoistNDE" ,

(max(T.RHoistDE)* 1.8 + 32) as "RHoistDE" ,

(max(T.RHoistIP)* 1.8 + 32) as "RHoistIP" ,

(max(T.RHoistFLD)* 1.8 + 32) as "RHoistFLD" ,

(max(T.CrowdNDE)* 1.8 + 32) as "CrowdNDE" ,

(max(T.CrowdDE) * 1.8 + 32) as "CrowdDE" ,

(max(T.CrowdIP) * 1.8 + 32) as "CrowdIP" ,

(max(T.CrowdFLD) * 1.8 + 32) as "CrowdFLD" ,

(max(T.SwingNDE)* 1.8 + 32) as "SwingNDE" ,

(max(T.SwingDE) * 1.8 + 32) as "SwingDE" ,

(max(T.SwingIP) * 1.8 + 32) as "SwingIP" ,

(max(T.SwingFLD)* 1.8 + 32) as "SwingFLD" ,

(max(T.RearSwingNDE)* 1.8 + 32) as "RearSwingNDE" ,

(max(T.RearSwingDE) * 1.8 + 32) as "RearSwingDE" ,

(max(T.RearSwingIP) * 1.8 + 32) as "RearSwingIP" ,

(max(T.RearSwingFLD)* 1.8 + 32) as "RearSwingFLD" ,

(max(T.RPropelNDE) * 1.8 + 32) as "RPropelNDE" ,

(max(T.RPropelDE)* 1.8 + 32) as "RPropelDE" ,

(max(T.RPropelIP) * 1.8 + 32) as "RPropelIP" ,

(max(T.RPropelFLD) * 1.8 + 32) as "RPropelFLD" ,

(max(T.LPropelNDE) * 1.8 + 32) as "LPropelNDE" ,

(max(T.LPropelDE) * 1.8 + 32) as "LPropelDE" ,

(max(T.LPropelIP) * 1.8 + 32) as "LPropelIP" ,

(max(T.LPropelFLD) * 1.8 + 32) as "LPropelFLD" ,

(max(T.LFrontSwingNDE)* 1.8 + 32) as "LFrontSwingNDE" ,

(max(T.LFrontSwingDE)* 1.8 + 32) as "LFrontSwingDE" ,

(max(T.LFrontSwingIP) * 1.8 + 32) as "LFrontSwingIP" ,

(max(T.LFrontSwingFLD) * 1.8 + 32) as "LFrontSwingFLD" ,

(max(T.RFrontSwingNDE) * 1.8 + 32) as "RFrontSwingNDE" ,

(max(T.RFrontSwingDE) * 1.8 + 32) as "RFrontSwingDE" ,

(max(T.RFrontSwingIP)* 1.8 + 32) as "RFrontSwingIP" ,

(max(T.RFrontSwingFLD) * 1.8 + 32) as "RFrontSwingFLD" ,

(max(T.TransPhaseA)* 1.8 + 32) as "TransPhaseA" ,

(max(T.TransPhaseB)* 1.8 + 32) as "TransPhaseB" ,

(max(T.TransPhaseC)* 1.8 + 32) as "TransPhaseC" ,

(max(T.DriveInletTemp1)* 1.8 + 32) as "DriveInletTemp1" ,

(max(T.DriveInletTemp2)* 1.8 + 32) as "DriveInletTemp2" ,

(max(T.DriveInletTemp3)* 1.8 + 32) as "DriveInletTemp3" ,

(max(T.DriveInletTemp4)* 1.8 + 32) as "DriveInletTemp4" ,

(max(T.DriveInletTemp5)* 1.8 + 32) as "DriveInletTemp5" ,

(max(T.DriveInletTemp6)* 1.8 + 32) as "DriveInletTemp6" ,

(max(T.DriveInletTemp7)* 1.8 + 32) as "DriveInletTemp7" ,

(max(T.DriveInletTemp8)* 1.8 + 32) as "DriveInletTemp8" ,

(max(T.CwdMotorTemp)* 1.8 + 32) as "CwdMotorTemp" ,

(max(T.CwdMotorWindABTemp)* 1.8 + 32) as "CwdMotorWindABTemp" ,

(max(T.CwdMotorWindBCTemp)* 1.8 + 32) as "CwdMotorWindBCTemp" ,

(max(T.CwdMotorWindCATemp)* 1.8 + 32) as "CwdMotorWindCATemp" ,

(max(T.PplRhtMtrMotorTemp)* 1.8 + 32) as "PplRhtMtrMotorTemp" ,

(max(T.PplRhtMtrMotorWindABTemp)* 1.8 + 32) as "PplRhtMtrMotorWindABTemp" ,

(max(T.PplRhtMtrMotorWindBCTemp)* 1.8 + 32) as "PplRhtMtrMotorWindBCTemp" ,

(max(T.PplRhtMtrMotorWindCATemp)* 1.8 + 32) as "PplRhtMtrMotorWindCATemp" ,

(max(T.SwgLFntMtrMotorTemp)* 1.8 + 32) as "SwgLFntMtrMotorTemp" ,

(max(T.SwgLFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindABTemp" ,

(max(T.SwgLFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgLFntMtrMotorWindBCTemp" ,

(max(T.SwgLFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgLFntMtrMotorWindCATemp" ,

(max(T.HstRearMtrMotorTemp)* 1.8 + 32) as "HstRearMtrMotorTemp" ,

(max(T.HstRearMtrMotorWindABTemp)* 1.8 + 32) as "HstRearMtrMotorWindABTemp" ,

(max(T.HstRearMtrMotorWindBCTemp)* 1.8 + 32) as "HstRearMtrMotorWindBCTemp" ,

(max(T.HstRearMtrMotorWindCATemp)* 1.8 + 32) as "HstRearMtrMotorWindCATemp" ,

(max(T.PplLftMtrMotorTemp)* 1.8 + 32) as "PplLftMtrMotorTemp" ,

(max(T.PplLftMtrMotorWindABTemp)* 1.8 + 32) as "PplLftMtrMotorWindABTemp" ,

(max(T.PplLftMtrMotorWindBCTemp)* 1.8 + 32) as "PplLftMtrMotorWindBCTemp" ,

(max(T.PplLftMtrMotorWindCATemp)* 1.8 + 32) as "PplLftMtrMotorWindCATemp" ,

(max(T.SwgRFntMtrMotorTemp)* 1.8 + 32) as "SwgRFntMtrMotorTemp" ,

(max(T.SwgRFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindABTemp" ,

(max(T.SwgRFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRFntMtrMotorWindBCTemp" ,

(max(T.SwgRFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgRFntMtrMotorWindCATemp" ,

(max(T.HstFntMtrMotorTemp)* 1.8 + 32) as "HstFntMtrMotorTemp" ,

(max(T.HstFntMtrMotorWindABTemp)* 1.8 + 32) as "HstFntMtrMotorWindABTemp" ,

(max(T.HstFntMtrMotorWindBCTemp)* 1.8 + 32) as "HstFntMtrMotorWindBCTemp" ,

(max(T.HstFntMtrMotorWindCATemp)* 1.8 + 32) as "HstFntMtrMotorWindCATemp" ,

(max(T.SwgRearMtrMotorTemp)* 1.8 + 32) as "SwgRearMtrMotorTemp" ,

(max(T.SwgRearMtrMotorWindABTemp)* 1.8 + 32) as "SwgRearMtrMotorWindABTemp" ,

(max(T.SwgRearMtrMotorWindBCTemp)* 1.8 + 32) as "SwgRearMtrMotorWindBCTemp" ,

(max(T.SwgRearMtrMotorWindCATemp)* 1.8 + 32) as "SwgRearMtrMotorWindCATemp" ,

(max(T.SwgFntMtrMotorTemp)* 1.8 + 32) as "SwgFntMtrMotorTemp" ,

(max(T.SwgFntMtrMotorWindABTemp)* 1.8 + 32) as "SwgFntMtrMotorWindABTemp" ,

(max(T.SwgFntMtrMotorWindBCTemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.SwgFntMtrMotorWindCATemp)* 1.8 + 32) as "SwgFntMtrMotorWindBCTemp" ,

(max(T.ACS800Temp)* 1.8 + 32) as "ACS800Temp" ,

(max(T.TempDiffPhsU)* 1.8 + 32) as "TempDiffPhsU" ,

(max(T.TempDiffPhsV)* 1.8 + 32) as "TempDiffPhsV" ,

(max(T.TempDiffPhsW)* 1.8 + 32) as "TempDiffPhsW" ,

Max(T.DateTime) as "TemperatureTime"

FROM TempMtrScan T

JOIN Shovel S ON T.ShovelID = S.ID

WHERE (S.ID =@.ShovelID) AND T.DATETIME <= @.EndTime AND T.DATETIME >= @.StartTime

Group by ShovelID, datepart(yy,T.DateTime), datepart(dy,T.DateTime),datepart(hh,T.DateTime),datepart(mi,T.DateTime)/@.Duration

order by Max(T.DateTime) asc

(1943 row(s) affected)

Table 'Shovel'. Scan count 0, logical reads 2, physical reads 2, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'TempMtrScan'. Scan count 3, logical reads 38911, physical reads 493, read-ahead reads 736, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.

Warning: Null value is eliminated by an aggregate or other SET operation.

2012年2月26日星期日

First INSERT in the transaction is not being committed

Hi All
I am having a strange problem. I have an excel sheet from which I fetch
the data using ADODB. I hava a loop which runs through all rows in the
excel sheet and calls a stored procedure to insert the rows into the
database.
The problem is when the statement oConn.CommitTrans is called, the
first row is not being inserted into the database.
But I am able to see the call to the stored procedure in the SQL
Profiler for the first row in addition to the other rows.
One more thing is, in the SQL Profiler, after the call to the stored
procedure for the first row, I am seeing the following:
SET NO_BROWSETABLE ON
SET FMTONLY ON EXEC spInsert ' ', ' ' SET FMTONLY OFF
set fmtonly off
SET NO_BROWSETABLE OFF
Please help me.
Thanks in advanceI think that SET FMTONLY ON is doing no results appearing. Put on
"hbase19-all@.yahoo.co.in" wrote:

> Hi All
> I am having a strange problem. I have an excel sheet from which I fetch
> the data using ADODB. I hava a loop which runs through all rows in the
> excel sheet and calls a stored procedure to insert the rows into the
> database.
> The problem is when the statement oConn.CommitTrans is called, the
> first row is not being inserted into the database.
> But I am able to see the call to the stored procedure in the SQL
> Profiler for the first row in addition to the other rows.
> One more thing is, in the SQL Profiler, after the call to the stored
> procedure for the first row, I am seeing the following:
> SET NO_BROWSETABLE ON
> SET FMTONLY ON EXEC spInsert ' ', ' ' SET FMTONLY OFF
> set fmtonly off
> SET NO_BROWSETABLE OFF
> Please help me.
> Thanks in advance
>|||It looks like your XL sheet does not have a header row. Try adding a header
row. SET FMTONLY will only return meta-data to the client and it looks like
this call is being made to determine the structure.
--
HTH,
SriSamp
Email: srisamp@.gmail.com
Blog: http://blogs.sqlxml.org/srinivassampath
URL: http://www32.brinkster.com/srisamp
<hbase19-all@.yahoo.co.in> wrote in message
news:1136794436.468218.270140@.g47g2000cwa.googlegroups.com...
> Hi All
> I am having a strange problem. I have an excel sheet from which I fetch
> the data using ADODB. I hava a loop which runs through all rows in the
> excel sheet and calls a stored procedure to insert the rows into the
> database.
> The problem is when the statement oConn.CommitTrans is called, the
> first row is not being inserted into the database.
> But I am able to see the call to the stored procedure in the SQL
> Profiler for the first row in addition to the other rows.
> One more thing is, in the SQL Profiler, after the call to the stored
> procedure for the first row, I am seeing the following:
> SET NO_BROWSETABLE ON
> SET FMTONLY ON EXEC spInsert ' ', ' ' SET FMTONLY OFF
> set fmtonly off
> SET NO_BROWSETABLE OFF
> Please help me.
> Thanks in advance
>|||Thanks for the reply
The line "SET FMTONLY ON" is appearing automatically. I am not calling
that statement.
Also I found in ms web site that the statement "SET FMTONLY ON" starts
an implicit transaction even if we call "SET implicit_transactions
off". So they suggested MDAC 2.6 latest service pack. I did that. But
even then the problem is persistent.
I copied the series of statements (from BEGIN TRANSACTION to COMMIT
TRANSACTION) from SQL profiler and ran them in SQL Query Analyzer. An
error occurred saying
"The COMMIT TRANSACTION request has no corresponding BEGIN
TRANSACTION".
So I commented out the lines
SET NO_BROWSETABLE ON
SET FMTONLY ON EXEC spInsert ' ', ' ' SET FMTONLY OFF
set fmtonly off
SET NO_BROWSETABLE OFF
and ran the TRANSACTION statements. It worked fine. So the problem
might be in those 4 lines.
Please help me

2012年2月24日星期五

Firewall settings for msde

hi all,
i'm testing some of my applications w/c runs on MSDE on the new Windows XP Service Pack2, which actually entails newer & more secure firewall settings.
my application run on both the server & workstations only w/ the firewall switched off.
but the problem comes w/n i have the firewall settings switched on. the applications runs on the server but the workstation applications cannot.
how do i configure my workstations to be in the exception list on the firewall so they can access the server?
i'll already added the workstation's IP address & subnet but still i can't get it connect.
how do i configure my network to use TCP/IP protocol w/ a static port so i can add the workstations to the firewall's exceptions list.
thanks.
herbert
hi Herbert,
"herbert" <praetorean.tech@.graffiti.net> ha scritto nel messaggio
news:EAE41221-4DE2-458E-84D7-B24A0531F1A1@.microsoft.com...
> hi all,
> i'm testing some of my applications w/c runs on MSDE on the new Windows XP
Service Pack2, which actually entails newer & more secure firewall settings.
> my application run on both the server & workstations only w/ the firewall
switched off.
> but the problem comes w/n i have the firewall settings switched on. the
applications runs on the server but the workstation applications cannot.
> how do i configure my workstations to be in the exception list on the
firewall so they can access the server?
> i'll already added the workstation's IP address & subnet but still i can't
get it connect.
> how do i configure my network to use TCP/IP protocol w/ a static port so i
can add the workstations to the firewall's exceptions list.
>
you have to manually open TCP/IP port 1433, if MSDE instance you are running
is listening on the default port.. or the port you are using to connect to
it...
as regards multi instance support, Windows XP SP2 firewall will actually
disable the benefit of dynamic port detection by SQL Server... that's to say
you have to manually statically set a designed port for each instance, open
all the required ports on the Firewall and close UDP 1434 port, which is no
longer needed when dynamic detection is "disabled"..
Microsoft is developing a script for customers who need an automated
solution. If you need the script, contact msdewxp2@.microsoft.com, asking for
"script for customers who need an automated solution to enable MSDE network
connections" , as required by PSS email "Guidance for using MSDE on Windows
XP Service Pack 2"
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.7.0 - DbaMgr ver 0.53.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply