Hi all,I notice there is a high wait time from replication job and it spends a significant amount of time on PREEMPTIVE_OS_WAITFORSINGLEOBJECI am wondering what is PREEMPTIVE_OS_WAITFORSINGLEOBJEC and how to deal with it ?Also net backup has been failed for 2 months in that server , Not sure if this replication job is the culprit ..Any feedback are highly appreciated Thanks
↧
High wait time
↧
SQL Server 2008 R2 - randomly low performance
Hello,I'm sure that there should be a similar topic around, but with these general keyword to be searched (performance, monitoring etc) is hard to locate it, so I open a new one with the hope of some help.I have two case, in two different installations, both of them Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) (Build 7601: Service Pack 1). In both cases, from time to time, random and without any pattern the SQL server performance is degrading, it starts to be slow, lots of "Query timeout expired" messages are received and anything goes wrong, sometimes we receive unexpected deadlocks and so on. Even in sp_who2 I don't see any clear process suffocating the server, something it does. Now I want to find out what can be that "something".Is there any know tool for monitoring the SQL Server (any profile trace template or any external tool) to see post-factum what was the server activity when the slowness occurred? We are normally learn about these slowness cases after it passed (the low performance disappear after a while like it appeared, without any visible explanation), when the users complains about them. When I connect to server to verify, all looks OK... So I need to see what happened at a certain moment in the past on the server. I'm trying to understand these strange cases because (for example) I can't explain how comes that the exact same stored procedure which one thousand times is executed in 12 milliseconds, suddenly and without any (visible for me) explanation takes ~21 seconds to be executed... These kind of "hiccups" of the server are making me crazy and I can't understand what generates them. I'm sure it is a logical explanation somewhere, but I can't see it.Any ideas are welcome.Thank you,RC
↧
↧
Warning: The join order has been enforced because a local join hint is used. ( two views )
Hi Experts !I have two select statements, in between select statement taking [b]UNION ALL[/b] . I need to avoid the error [quote]Warning: The join order has been enforced because a local join hint is used. [/quote]
↧
How to return specific rows from a query
My query returns multiple records for each VisitID. I only want row number 1 and 2, based on ApgarOrder, for my final results. Is there a way to do this without using a cte or temp table?SELECT VisitID, InstanceID, ROW_NUMBER() OVER (PARTITION BY VisitID ORDER BY InstanceID) as ApgarOrder, ValueInfoFROM #Test create table #Test(VisitID varchar(30),InstanceID varchar(100),ValueInfo int)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000031269581}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000031269581}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000031269581}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000054011490}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000054011490}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160802155134536','{NB.APGAR|S|1969335.000000054011490}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160803054625870','{NB.APGAR|S|1975698.000000131279159}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160803054625870','{NB.APGAR|S|1975698.000000131279159}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160803054625870','{NB.APGAR|S|1975698.000000137411621}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160803054625870','{NB.APGAR|S|1975698.000000137411621}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804011755135','{NB.APGAR|S|1992346.000000238551251}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804011755135','{NB.APGAR|S|1992346.000000238551251}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804011755135','{NB.APGAR|S|1992346.000000258173785}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804011755135','{NB.APGAR|S|1992346.000000258173785}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804230938997','{NB.APGAR|S|2013768.000000011100979}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804230938997','{NB.APGAR|S|2013768.000000011100979}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804230938997','{NB.APGAR|S|2013768.000000028930552}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160804230938997','{NB.APGAR|S|2013768.000000028930552}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000498018663}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000498018663}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000498018663}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000556004370}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000556004370}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805064601713','{NB.APGAR|S|2013738.000000556004370}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805190000742','{NB.APGAR|S|2062895.000000978840571}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160805190000742','{NB.APGAR|S|2062895.000000997354769}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808033259104','{NB.APGAR|S|2069263.000000625999262}',6)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808033259104','{NB.APGAR|S|2069263.000000625999262}',6)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808033259104','{NB.APGAR|S|2069263.000000694647002}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808033259104','{NB.APGAR|S|2069263.000000694647002}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543569}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543569}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543569}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543657}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543657}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160808191752137','{NB.APGAR|S|2064243.000000140543657}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160813093949684','{NB.APGAR|S|2147740.000000040030265}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160813093949684','{NB.APGAR|S|2147740.000000040030265}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160813093949684','{NB.APGAR|S|2147740.000000054130337}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160813093949684','{NB.APGAR|S|2147740.000000054130337}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000252725567}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000252725567}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000252725567}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000269067265}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000269067265}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160814094822302','{NB.APGAR|S|2181609.000000269067265}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160815174127500','{NB.APGAR|S|2181653.000000129653726}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160815174127500','{NB.APGAR|S|2181653.000000141208650}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000046490073}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000046490073}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000046490073}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000060540316}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000060540316}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F0-B20160816051848289','{NB.APGAR|S|2179274.000000060540316}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160731165428243','{NB.APGAR|S|1940586.000000084739641}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160731165428243','{NB.APGAR|S|1940586.000000114604859}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859565}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859565}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859565}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859655}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859655}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801054819414','{NB.APGAR|S|1938867.000000550859655}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841281}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841281}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841281}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841281}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841350}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841350}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841350}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801074227405','{NB.APGAR|S|1942821.000000599841350}',8)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000011260354}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000011260354}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000011260354}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000011260354}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000011260354}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000014554254}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000014554254}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000014554254}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000014554254}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080023221','{NB.APGAR|S|1942287.000000014554254}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857849}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857849}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857849}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857849}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857849}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857918}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857918}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857918}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857918}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801080606546','{NB.APGAR|S|1943537.000000667857918}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000070038374}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000070038374}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000070038374}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000070038374}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000079003551}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000079003551}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000079003551}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801102457405','{NB.APGAR|S|1952683.000000079003551}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801113421165','{NB.APGAR|S|1952124.000000090052166}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801113421165','{NB.APGAR|S|1952124.000000090052166}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801113421165','{NB.APGAR|S|1952124.000000099877862}',9)insert into #Test(VisitID, InstanceID, ValueInfo) values('F1-B20160801113421165','{NB.APGAR|S|1952124.000000099877862}',9)
↧
CASE Statements.....
Ok, I put the whole query in here, now I have not done alot of CAST or CASE, so this was my first attempt. What am I missing?SET STATISTICS IO ONSET STATISTICS TIME ONDECLARE @StartDate SMALLDATETIMEDECLARE @EndDate SMALLDATETIME/**********************SET DATES HERE***************************/SET @StartDate = '2016-08-23 08:00:00.000'SET @EndDate = '2016-09-16 11:59:59.997'/***************************************************************/USE MEDTRANSELECT CONVERT(VARCHAR(10), orders.orderreceiveddate, 101) + ' ' + LTRIM(RIGHT(CONVERT(CHAR(20), orders.orderreceiveddate, 22), 11)) AS 'Order Received Date', CONVERT(VARCHAR(10), ORDERS.UdpateTimeStamp, 101) + ' ' + LTRIM(RIGHT(CONVERT(CHAR(20), ORDERS.UdpateTimeStamp, 22), 11)) AS 'Update Time Stamp', ORDERS.MemberOrderNumber AS 'PO Number', mem1.MemberName AS 'Affiliate', SNP_VENDOR.VendorName AS 'Vendor Name', SLA_CODE_DESCRIPTION.SLACodeKey AS 'SLA Code', SNP_USER.UserFirstName AS TA, CAST( CASE WHEN orders.orderreceiveddate = ORDERS.UdpateTimeStamp THEN 'NEW' ELSE 'OLD' END AS bit) AS 'CALL PO' FROM ORDERS LEFT OUTER JOIN ORDER_ACKNOWLEDGEMENT ON ORDERS.OrderId = ORDER_ACKNOWLEDGEMENT.OrderId INNER JOIN SNP_MEMBER WITH (NOLOCK) ON ORDERS.MemberId = SNP_MEMBER.MemberId LEFT OUTER JOIN SNP_VENDOR ON ORDERS.VendorId = SNP_VENDOR.VendorId INNER JOIN SNP_MEMBER AS mem1 WITH (NOLOCK) ON SNP_MEMBER.ParentMemberId = mem1.MemberId LEFT OUTER JOIN SLA_CODE_DESCRIPTION WITH (NOLOCK) ON ORDERS.SLACodeId = SLA_CODE_DESCRIPTION.SLACodeId INNER JOIN TIME_ZONE ON SNP_MEMBER.TimeZoneId = TIME_ZONE.TimeZoneId LEFT OUTER JOIN SNP_USER WITH (NOLOCK) ON ORDERS.UpdateUserId = SNP_USER.UserId WHERE (ORDERS.OrderReceivedDate >= @StartDate) AND (ORDERS.OrderReceivedDate < @EndDate) AND ORDERS.SLACodeId = 10 AND ORDERS.OrderStatusId = 8 GROUP BY ORDERS.OrderReceivedDate, mem1.MemberName, SNP_USER.UserFirstName, SNP_VENDOR.VendorName, ORDERS.MemberOrderNumber, SLA_CODE_DESCRIPTION.SLACodeKey , ORDERS.UdpateTimeStamp, ORDERS.OrderStatusIdORDER BY SNP_USER.UserFirstName ASC
↧
↧
The server principal owns one or more event notification(s) and cannot be dropped. (Microsoft SQL Server, Error: 15141)
Hi allWhen I was trying to drop a login account, I got the below error msg:-The server principal owns one or more event notification(s) and cannot be dropped. (Microsoft SQL Server, Error: 15141)While doing some research I found one useful MS article:https://social.msdn.microsoft.com/Forums/sqlserver/en-US/f68d3832-07e4-48eb-8c28-c668f3acd8a4/unable-to-delete-login-user?forum=sqlsecurityQuestion is, it is asking to drop the event notification...but unable to figure out what it is doing. Is this safe to drop it?The event name is : CaptureSecurityEvents
↧
CREATE INDEX statement rollback doesn't behave as expected
Hello everyone.Recently, I needed to apply a clustered index to a table. I first performed the operation in a Staging environment. The operation completed in about 20 minutes, so we planned for Prod to take approximately the same time, but we didn't take down any user apps. After I executed the statement, we let it run for about 4 minutes before we noticed some unanticipated blocking that was causing application queries to time out. Due to the timeouts, we decided to stop the execution, so I cancelled it.Now, I assumed that either one of two things would happen when I pressed the cancel button: 1) SQL Server would stop organizing the data on disk and leave anything it had already moved where it was, thereby causing the rollback to be almost instant.OR2) SQL Server would take the data it had already organized on disk and move it back to where it was before, thereby causing the rollback to take approximately as long as the statement had been executing. In this case, the statement had been running for 4 minutes, so the rollback should make the total time 8 minutes.Well, neither one of those things happened. The rollback actually took 20 minutes by itself, which was the amount of total time the index took to apply in Staging. This made the total time 24 minutes (execution for 4, rollback for 20).Now, I am no internals expert, but what I infer from this is that after I clicked the cancel button, SQL Server had to scan the entire index on disk to find what data it had moved, and then move it back.Does anyone have any more insight on this? Am I even in the ballpark here?FYI, the only thing different between the Staging and Prod environments is that Staging has about 1/6 of the RAM. Also, the table was around 28 million rows and was a heap. Thanks all!
↧
Indexing strategy
Dear all,I have below query:SELECT apr.POC_ID AS poc_id, DATEADD( DAY, 0, DATEDIFF( DAY, 0, DATEADD(DAY, -DAY(DATEADD(MONTH, 1, mch.mach_counter_hist_date)),DATEADD(MONTH, 1, mch.mach_counter_hist_date)))) AS end_of_month FROM dbo.machine_counter_history AS mch INNER JOIN dbo.audit_procedure_result AS apr ON apr.audit_procedure_result_id = mch.audit_procedure_result_id WHERE mch.market_code = @intMarketCode AND mch.modf_on BETWEEN @datSSISStartDate AND @datSSISEndDateIn terms of index strategy, should I create one index for mch.market_code and another for mch.audit_procedure_result_id or it is better to have a index that is composed by the two columns?thanks.
↧
SQL Server 2008R2 SP3 Internal Memory error
Running 2008R2 SP3 (64bit) with an 8GB memory max. One if our Applications is failing with this error: ERROR : (6784 | 6960) : (IS | INT_KOCPROD) : node01_KOCPROD : LM_36488 : Session task instance [s_DataSync_CNTCT_UPDT_MM2ING_STG_To_MQ] : [REP_12400 Repository Error (Microsoft SQL Server Native Client 11.0: There is insufficient system memory in resource pool 'internal' to run this query.SQL State: 42000 Native Error: 701State: 123 Severity: 17SQL Server Message: There is insufficient system memory in resource pool 'internal' to run this query.Database driver error...Function Name : ExecuteSQL Stmt : SELECT DISTINCT T.TASK_ID, T.SUBJECT_ID FROM OPB_TASK T, OPB_SESSION S, OPB_VALIDATE V, OPB_MAPPING M, OPB_WIDGET_INST I, OPB_SRC R, OPB_USER_GROUP U WHERE T.IS_VISIBLE = ? AND T.TASK_ID = S.SESSION_ID AND T.VERSION_NUMBER = S.VERSION_NUMBER AND T.TASK_ID IN (345) AND T.TASK_TYPE = 68 AND U.ID = ? AND U.TYPE = 1 AND S.MAPPING_ID = M.MAPPING_ID AND (M.IS_VISIBLE <> 2 OR (M.IS_VISIBLE = 2 AND M.CHECKOUT_USER_ID = U.ID)) AND I.MAPPING_ID = M.MAPPING_ID AND I.VERSION_NUMBER = M.VERSION_NUMBER AND I.WIDGET_TYPE = 1 AND R.SRC_ID = I.WIDGET_ID AND V.SUBJECT_ID = R.SUBJ_ID AND V.OBJECT_TYPE = I.WIDGET_TYPE AND V.OBJECT_ID = R.SRC_ID AND V.VERSION_NUMBER = R.VERSION_NUMBER AND V.INV_UTC > T.UTC_LAST_SAVED AND V.INV_TYPE = 1 AND T.IS_VALID = 1 AND (R.IS_VISIBLE <> 2 OR (R.IS_VISIBLE = 2 AND R.CHECKOUT_USER_ID = U.ID)) )]In the sql server log we are getting the following error: There is insufficient system memory in resource pool 'internal' to run this query. Error: 701, Severity: 17, State: 123.Errors in the SQL Server log at the time of the failure attached: Can anyone help?
↧
↧
Need Help with Service Broker
Hi Experts,Requirement: I have 2 databases in same server.Database1: SourceDB and Table: dbo.queue_tableDatabase2: TargetDB and Table: dbo.queue_tableFor every entry in SourceDB.dbo.queue_table I have to move the inserted records into TargetDB.dbo.queue_table. Both the tables are having same structure.I have created message_types, queue, contract and service and triggers and required procedures on both dbs. but my scripts are not working as expected ..Please find the attached script and do the needful.
↧
dynamic t query -- unable to add the string to the last column as "DBCC SHRINKFILE(<TransactionLogName>, 1)"
Hi ProctersI was trying to gather a query with data to get all the shrink tlog commands, but not working as is:Basically I want my query to produce the DBCC SHRINKFiLE ( ) string in the last column. Please have a look and suggest how to update the column with the details[code="sql"]-- create a temporary table to insert the above mentioned output against each databases.SET NOCOUNT oncreate table #db_files(DB_name VARCHAR(MAX),db_files varchar(4000),file_loc varchar(4000),filesizeMB decimal(9,2),spaceUsedMB decimal(9,2),FreespaceMB decimal(9,2),cmd varchar(4000))declare @strSQL nvarchar(2000)DECLARE @dbName varchar(MAX)DECLARE @getDBname CURSORSET @getDBname = CURSOR FORselect name FROM sys.databasesWHERE state_desc = 'ONLINE'OPEN @getDBnameFETCH NEXTFROM @getDBname INTO @dbNameWHILE @@FETCH_STATUS = 0BEGIN--PRINT @dbNameselect @strSQL = ' use ' + quotename(@dbname) + ' INSERT INTO #db_files select '''+ @dbname+''' , name , filename , convert(decimal(12,2),round(a.size/128.000,2)) as FileSizeMB , convert(decimal(12,2),round(fileproperty(a.name,''SpaceUsed'')/128.000,2)) as SpaceUsedMB , convert(decimal(12,2),round((a.size-fileproperty(a.name,''SpaceUsed''))/128.000,2)) as FreeSpaceMB , '''' from dbo.sysfiles a where groupid = 0 -- signifies log file ' --select @strSQL exec sp_executesql @strSQL UPDATE #db_files SET cmd = 'DBCC ShrinkFile(' FETCH NEXTFROM @getDBname INTO @dbNameENDCLOSE @getDBnameDEALLOCATE @getDBnameGOselect * from #db_filesORDER BY FreespaceMB DESC--DBCC SHRINKFILE(<TransactionLogName>, 1)-- drop the temporary table drop table #db_filesSET NOCOUNT OFF [/code]
↧
Wait Type PREEMPTIVE_OS_GETFILEATTRIBUTES
Can anybody tell me what the wait type PREEMPTIVE_OS_GETFILEATTRIBUTES is/means?We are having an issue with our SharePoint/SQL Server setup, specifically around backups.All backups (SQL-initiated and SharePoint-initiated) are sent to a disk (via UNC) on a backup server. All SQL and SharePoint machines are VMWare virtual machines on ESX 5.We have been getting an issue where the SharePoint-initiated backups will stall in some way. Symptoms are:* Unable to RDP to the SQL Server* Presence of active sessions with the PREEMPTIVE_OS_GETFILEATTRIBUTES wait type* Subsequent backups to UNC queue up with the same wait state (both SQL- and Sharepoint-initiated)* Unable to kill the offending SPIDs (message posted in ERRORLOG to say it's done, but that's it)* SQL Server can be stopped but not started againIn all other respects, SQL Server seems to tick along quite happily. SharePoint can talk to it and it can be managed remotely.The only fix we have got is to stop SQL Server (from a remote machine) and power cycle the VM.The disks underpinning the ESX farm are iSCSI. Just recently we have done a revamp of the environment to address known latency issues (although there are still some remaining). The network side of things is idling along nicely. The backup server has its own dedicated disks, separate from the iSCSI disks.We are pretty sure it is something OS/infrastructure related, but haven't been able to pin it down. If we knew what this wait type was, it would give us a better idea of where to look.Thanks in advance...
↧
find high availability configure in SQL server 2008 R2
Hi,How to find what high availability SQL server 2008 R2 has been set up?Like is my server is configured with Clustering or with Replication or with Mirroring or with Log shipping via Query instead of looking into IDE.How can we find those.
↧
↧
Replication: Editing of data on Client or Server
Hello together,I have a replicated DB for testworkstations. The test must run also if there is no network connectivity. For that there is a client DB on the teststations and a central DB on a server. All data are replicated with merge replication. This is running well.A test is running always on the client DB and if there are new data and a connection, data will replicated to the server and after that to the other clients. So all clients and the server have normally the same data.Up to now it was not a big risk, that master data are editetd at the same time on two workstations, but know this can happen and know we must avoid, that this happens. It´s no problem, that master data can only be edited, if there is a connection to the server. Solution 1:The master data will be edited only and direct on the server. With that MsSQL will lock taht data are edited at the same time. But I must make sure, that the test can only be started, if the data replicated to the client. What is the easiest way, to monitor this?Solution 2:I create a LockTable on the server where I enter the table and record, which I edit. The editing will be done on the client. Here I have to make shure, that the lock will be deleted earliest, if the data are replicated to the server. What is the easiest way, to monitor this?Which is the common solution?Or is there a better way to make sure, that master data can only edited from one workstation at the same time?Many thanks for your feedbackGerd
↧
SQL Express 2008 R2 to SQL 2008 Enterprise
Correct me If I'm wrong, It is possible to take a 2008k r2 express database and upload it into a full 2008 SQL enterprise database.
↧
Group Concatenate Strings?
[code="sql"]CREATE TABLE #t (a tinyint NOT NULL, b VARCHAR(10), c VARCHAR(10))GOINSERT #t (a, b,c) VALUES (1, 'ab', 'cd')INSERT #t (a, b,c) VALUES (1, 'ef', 'gh')INSERT #t (a, b,c) VALUES (2, 'ij', 'kl')INSERT #t (a, b,c) VALUES (2, 'mn', 'op')[/code]I need OUTPUT thusly:[code="sql"]a concatstringb concatstringc1 'abef' 'cdgh'2 'ijmn' 'klop'[/code]being on SQL 2008, CONCAT isn't available (if it helps), although if anyone has a solution using that I would like to see that tooNULL handling will be required, but I think I can make that do what I need if someone has a solution for the first part
↧
How to optimize my current sql query without using a sub query
In my query, I have two columns displaying a value based on a sub query. If you notice, I have two sub queries almost identical but displaying different information. I dont like the fact I'm doing the same operation but repeating it twice to display two different column information. In sub query, you can only display one expression. What is the alternate and more optmized way to display both columns in the table without running the query twice. [code="sql"]SELECT Distinct T.ticketid AS [Ticket ID], t.TType as [TicketType], (SELECT Top 1 case when Month(TaskFinish)=Month(TaskSTart) THEN Month(TaskStart) ELSE '0' END FROM queues q LEFT JOIN Response2 R ON R.QAssignID=AssignID WHERE q.ticketid = t.TicketID And TaskNameID=1 AND ttype =1 ORDER BY TaskSTart desc) [MonthSubmitted], (SELECT Top 1 Response FROM queues Q LEFT JOIN Response2 R ON R.QAssignID=AssignID WHERE Q.ticketid = t.TicketID And TaskNameID=1 AND ttype =1 ORDER BY TaskSTart desc ) [RESPONSE] FROM tickets T WHERE T.ticketstatus = 'O' AND T.globalid = '66' [/code]
↧
↧
Space Availability on a network share
Hi ExpertsPlease provide an useful script to gather the available space in the network drive.Thanks
↧
SSIS Warning - Global Shared Memory
HiI'm busy rewriting DTS packages as SSIS packages. As and when I finish a package I run it in debug mode via Microsoft Visual Studio and then examine the Exection Results to see the messages generated.Now it may or may not matter how I run the package but the following warning has been generated :-[SSIS.Pipeline] Warning: Warning: Could not open global shared memory to communicate with performance DLL; data flow performance counters are not available. To resolve, run this package as an administrator, or on the system's console.I'm one of these people who likes to run programs and get no warnings at all (if it can be helped).Can someone kindly explain what it means and if I can can get rid of it?
↧
What are the Career opportunities after Sql Server DBA Training ?
Hi ,Am a software engineer in one of the MNC's. I recently completed MS SQL Server DBA Training and I have been certified from www.intellipaat.com . Am good in SQL server tools,Clustering,Query Design etc. I want to know what are the career opportunities I have after MS SQL Server DBA Training ?
↧