Quantcast
Channel: SQL Server Database Engine forum
Viewing all 12554 articles
Browse latest View live

SQL Agent Jobs failure count Mismatch

$
0
0

Hi All,

I need some help in the below query. There are 2 queries.

1st query which will tell me the monthly wise job report which includes columns such as TotalJobExecutions, Success Count, Failure count, Retry count, Cancel count.

2nd query, is completly concentrated on Failure count. Here i wanted to find out the reasons for the job failures.

These 2 queries is showing correct output on my local instance. bascially, I installed a sql instance and created 3 jobs and made them fail for few runs. On my local instance, the queries and counts are matching perfectly. But, when I run the set of queries, the counts are mismatching. i.e. The sum(failure count) column in the 1st output doesnt match up with the Sum(totalCount) in the 2nd output.

Note: also I am considering only last 3 months worth data.i.e. i am interested in last 3 months job failures. Please check with WHERE clause conditions.
Now I wanted to understand when I ran the same 2 queries in PROD server, why there is count mistmatch. I am completely not able to understand. How can I fix this? Is there anything am I missing in the 2nd query. Also, in the 2nd query I am considering step id =0 (i.e. job outcome) like I did in 1st query.Instead, to get the exact error message, I am considering the failed step to know the exact error message and I am joining the messageid to sys.sysmessages dmv to know the actual reasons for the job failures. (stepid<>0)

Is there any special scenario or extra condition I am missing in the 2nd query. I am literally confused here. does running rerunning any failed step from point of failure will that a make a difference in the counts? I have also tested that case as well still counts show me correct on local instant but on prod where we have around 100 jobs which is showing wrong results.
or else if a job is has multiple schedules does it make any difference????

All I am looking for is, if I sum up the values of "FailureCount" column values, that should match if I sum TotalCount column values in the 2 query output.

Can anybody help ?

Query 1
==============
use msdb
go
;
with MyCte
as
(
SELECT j.name JobName,
h.run_status,
msdb.dbo.agent_datetime(h.run_date, h.run_time) rundatetime,
case h.run_status when 0 then 'failed'
when 1 then 'Succeded'
when 2 then 'Retry'
when 3 then 'Cancelled'
when 4 then 'In Progress'
end as ExecutionStatus
--h.message MessageGenerated
FROM sysjobhistory h inner join sysjobs j
ON j.job_id = h.job_id
where h.step_id = 0
and msdb.dbo.agent_datetime(h.run_date, h.run_time) between '2016-06-01 00:00:00.000' and '2016-09-21 23:59:59.000'
)
select
@@servername AS Servername, --//CHANGE THE SERVERNAME
[Month]=cast(month(rundatetime) as varchar(2))+'/'+cast(year(rundatetime) as varchar(4)) ,
[TotalExecutions] = count(*)
,SuccessCount = sum(case when ExecutionStatus = 'Succeded' then 1 else 0 end)
,FailureCount = sum(case when ExecutionStatus = 'failed' then 1 else 0 end)
,RetryCount = sum(case when ExecutionStatus = 'Retry' then 1 else 0 end)
,CancelledCount = sum(case when ExecutionStatus = 'Cancelled' then 1 else 0 end)
from MyCte
group by cast(month(rundatetime) as varchar(2))+'/'+cast(year(rundatetime) as varchar(4))
go


Query 2
==============
;
with FailureReasons
AS
(
SELECT [JobName] = JOB.name,
msdb.dbo.agent_datetime(HIST.run_date, HIST.run_time) as RunDateTime,
[Step id] = HIST.step_id,
[StepName] = HIST.step_name,
HIST.run_status,
[Status] = CASE WHEN HIST.run_status = 0 THEN 'Failed'
WHEN HIST.run_status = 1 THEN 'Succeeded'
WHEN HIST.run_status = 2 THEN 'Retry'
WHEN HIST.run_status = 3 THEN 'Canceled'
END,
HIST.sql_severity,
HIST.sql_message_id,
HIST.message

FROM sysjobs JOB
INNER JOIN sysjobhistory HIST ON HIST.job_id = JOB.job_id
where HIST.run_status = 0 -- means only failed
and msdb.dbo.agent_datetime(HIST.run_date, HIST.run_time) between '2016-06-01 00:00:00.000' and '2016-09-21 23:59:59.000'
and step_id <> 0
)
SELECT t1.sql_message_id "Error #",t2.[Description], [TotalCount] = COUNT(1)
from FailureReasons t1
inner join sys.sysmessages t2 on (t1.sql_message_id = t2.error)
where t2.msglangid = 1033
group by t1.sql_message_id,t2.[Description]
ORDER BY [TotalCount] DESC

Sample output


Thanks,

Sam


Shrinking logs without taking backup

$
0
0

Hi guys, I've got one package that fills one huge table every night. Everything works, the only problem is that the package creates something like 200 GB of logs every time. So what I do is taking a back up and shrink the log in order to save space (I am very strict). The question is: what happens if I don't take the backup and I shrink the log?

Thanks

job step id not found

$
0
0

Hi experts,

I have seen this process blocking many of my executions... when I hit on details it points me to a 'stored procedure' that is NOT part of any job... so I try to investigate it, but I searched the Id on every table in msdb, and couldnt find it... what's this? can a deleted job, be still being executed?

SQL Server Upgrade Certification Exam

$
0
0

Hi All,

         I have completed myMCTS 2008 SQL Server Examination in 2012, then last year I wrote MCSA:70-457 SQL Server Upgrade Part 1, Now I was planning to write MCSA:70-458 SQL Server Upgrade Part 2. But this exam is now retired. I want to earn MCSA SQL Server 2012.

 How can i get MCSA SQL Server 2012 now?

UNICODE, table option for all the existing char/varchar columns

$
0
0

Hi guys,

As a Microsoft DBA for more that 25 years and talking from my experience, there are one issue that i'm asked to deal with from time to time, i have an idea and i wanted to ask you 'Microsoft' guys if this is a good one, at last for me it will be great.

This is the issue...

I am working with UNICODE from time to time, and as you know to have this you must use NCHAR/NVARCHAR column types, also of course to use that 'N' when doing DML's like INSERT/UPDATE, the big question is why is not enough to set an option for particular table(s) that will just 'turn' the existing CHAR/VARCHAR into UNICODE, without altering them to NCHAR/NVARCHAR, using the existing ones.

Also, i need to use that "N" and if i have DML's as mentioned as 'hard-coded' in the applications, i really have a problem, why i still need to use this 2nd thing in order to have UNICODE data ?

The same, i think that we just need an option on table(s) that will turn the CHAR's into UNICODE and that's it, all the INSERTS or UPDATES will continue to work as before the UNICODE, saving data as it should be.

Thanks,

Victor Shahar

DBA


בברכה, ויקטור שחר DBA


Some SQL jobs suddenly stop working, always "executing"

$
0
0
Hello, we have a had a few SQL jobs start executing but not finishing. Sometimes they fail after 30-40 hours, but usually we catch them and cancel them. The jobs are stored procedures that run in just a couple seconds if we just execute the SP. The jobs ran fine until a week or so ago, I don't know of any changes to the server. I do know if I run the job scheduled or manually start the job, it is always failing. If I just run the SP, it is always succeeding. Nothing appears in the error logs. The jobs say they are executing, but they never finish. I tried to force recompile on the SPs in case there was a parameter sniffing issue, but that didn't help. 

[SQL Server] Track operations history on a table

$
0
0

Hi all,

I am using SQL Server 2008 R2 and here is my problem: I would like to get all DML operations (INSERT, DELETE, UPDATE & if possible SELECT) queried on a table, and if there is a way to query this information.

E.g. I would like to know that 7 lines have been inserted in my dbo.Products table today.

I explored some leads like:

- TRIGGERS, that can enable an action after a DML action (except SELECT), BUT they seem to not have any information on the event/query triggering them. So if I put an UPDATE trigger on my target table, I don't know which line(s) have been updated.

- CDC: Change data captures, that can give me the kind of DML instruction (except SELECT) and a SLN number, BUT I still don't know the content of the change and how many lines have been deleted in such case...

Thanks a lot for your help!

Guillaume

Occasional connectivity issues.

$
0
0

Greetings. We are getting SQL Server connectivity errors on a very intermittent basis. We've looked everywhere and all the info we have is posted below from the various sources. Note that this is not occurring from just one app server but a few, and that it's also occurring on more than one SQL Server instance.

Application Error (more details lower in the thread):

The connection error occurred again last night (log message):

System.Data.SqlClient.SqlException (0x80131904): A connection was successfully established with the server, but then an error occurred during the pre-login handshake.

SQL Message Captured:

-         Interesting to note the high time to establish SSL in yellow

-         <value>Network error code 0x2746 occurred while establishing a connection; the connection has been closed. This may have been caused by client or server login timeout expiration.Time spent during login: total 12109 ms, enqueued 0 ms, network writes 1 ms, network reads 2109 ms,establishing SSL 9997 ms, network reads during SSL 9997 ms, network writes during SSL 0 ms, secure calls during SSL 0 ms, enqueued during SSL 0 ms, negotiating SSPI 0 ms, network reads during SSPI 0 ms, network writes during SSPI 0 ms, secure calls during SSPI 0 ms, enqueued during SSPI 0 ms, validating login 0 ms, including user-defined login processing 0 ms. [CLIENT: myIPAddress]</value>

Network Capture (trace file attached):

-         There are several retransmissions from the SQL instance to the App server (myAppServer (myIPAddress)

-         Then there is a reset request from the app server to the SQL instance

-         467         2016-07-19 08:27:00.405430160  10.7.50.10            10.7.4.125            TCP        68           44590 1433 [RST, ACK] Seq=1496031372 Ack=1496031636 Win=0 Len=0

-         Also see the below regarding SSL Self Signed Fallback.

...^......$....*....+....,....0....1.$..U......:............v,..M...K.?.....j...B..w.}./{........0...........%....&....'....'....(............[1496030773 bytes missing in capture file]...^......$....*....+....,....0....1.$..U......:............v,..M...K.?.....j...B..w.}./{.....[1496030819 bytes missing in capture file]...0...........%....&....'....'....(...............................W.......y`...3.....@..!.F...B0....*.<./.=.5...

.'.....+.#.,.$. .

.@.2.j.8.......G........

myDBServer.

...............

..................................m........`...Q..W......`.....N&. .~ot.U.zr3 .... B0....j.zO.'Q\..5..X..@q....gP...<.. ...................0...0..b...........T...Iu....0.0

. *.H..

.....0;1907..U...0.S.S.L._.S.e.l.f._.S.i.g.n.e.d._.F.a.l.l.b.a.c.k0..

160714073545Z.

460714073545Z0;1907..U...0.S.S.L._.S.e.l.f._.S.i.g.n.e.d._.F.a.l.l.b.a.c.k0..0

. *.H..

.........0.......R..H...4.....Jr.U.4rl'..?.N

.- .._k...-... q...j...[(.2'...Nc.4......WbTI..W..j.;..(+S/..U..P%..&..;.....#..Y....E....o{a.6..h5.....0

. *.H..

............/....;.u..8...... F].X..xP-.^\.H.[......@...G...lG:*......wJ...Eh......$....;.........s......f.,.n......PP#.G......->7.:............................1.XL..&....P...JM.....]D....v?N....`E{N..._?.9.OG....w..Ph.......!....5..e.m......Po.....G.../s...X..[..!]...g....*.8..K..+Y=.............P.w......"...........j...p.....,....U.. mol.D].w')..!..N.)........J2F.!.4.....C.....c..............Pf..|..

p..PC.f.7....

....~sGT...4f./.L..j...dp.....T.>............(....p......U.

All ideas are welcome, thanks!


Thanks in advance! ChrisRDBA



SQL Messages Displaying random charcaters intead of alert/message

$
0
0

Hello,

My DBA is getting some weird messages from the SQL jobs. Some of them display just fine in his iPhone, but there are some that only the title comes with readable text, but the body is just random characters.

I Wonder if it could be the Font, but where should I change that or could be IOS 9.3.4 and up.

I also tried to add my android device, but I only get the title no body.

Thanks in advance

Setting processor/IO affinity mask using sp_configure

$
0
0

Hi,

In SSMS, sql server 2014 shows 4 NumaNodes (0-3), each of them 20 CPUs. I know that this server has 4 physical cores, with 10 logical CPUs (schedulers) each. First of all, why is SSMS showing 80 CPUs, when I know that we have only 40 logical cores???

Also, we plan to set Processor/Affinity mask to use only half of CPUs (don't ask why, it is part of the test), so considering what I said about incorrect number of CPUs shown in SSMS, and fact that we have 40 Cores, what would be sp_configure 'affinity mask' value for this server to use only 24 cores (out of 40)???? I found only simple examples online (including Microsoft and BOL), where they show only i.e. 8 CPUs (i.e. 11111110 meaning 254).

This command returns 40:

select scheduler_id,cpu_id, status, is_online from sys.dm_os_schedulers where status='VISIBLE ONLINE'

...and this returns 80, 20, and 4 respectively:

select cpu_count, hyperthread_ratio, cpu_count/hyperthread_ratio as physical_cpu_count from sys.dm_os_sys_info

Thanks,



Pedja

Checkpoint duration more than 5 sec when 0 pages droped to disk

$
0
0

Dear colleagues!
We have got a problem with long executing of a command – «checkpoint».

Our server:

Microsoft SQL Server 2012 (SP3) (KB3072779) - 11.0.6020.0 (X64) 
    Oct 20 2015 15:36:27 
    Copyright (c) Microsoft Corporation
    Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: )
Sp_configure:

nameminimum maximumconfig_valuerun_value
access check cache bucket count06553600
access check cache quota0214748364700
Ad Hoc Distributed Queries010 0
affinity I/O mask-2147483648214748364700
affinity mask-2147483648214748364700
affinity64 I/O mask-2147483648214748364700
affinity64 mask-2147483648214748364700
Agent XPs0 111
allow updates010 0
backup compression default011 1
blocked process threshold (s)08640000
c2 audit mode010 0
clr enabled0 111
common criteria compliance enabled010 0
contained database authentication010 0
cost threshold for parallelism0327673276732767
cross db ownership chaining010 0
cursor threshold-12147483647-1-1
Database Mail XPs011 1
default full-text language0214748364710331033
default language099990 0
default trace enabled010 0
disallow results from triggers010 0
EKM provider enabled010 0
filestream access level020 0
fill factor (%)01000 0
ft crawl bandwidth (max)032767100100
ft crawl bandwidth (min)03276700
ft notify bandwidth (max)032767100100
ft notify bandwidth (min)03276700
index create memory (KB)704214748364700
in-doubt xact resolution020 0
lightweight pooling010 0
locks5000 21474836470 0
max degree of parallelism03276744
max full-text crawl range02564 4
max server memory (MB)1282147483647960000960000
max text repl size (B)-121474836476553665536
max worker threads1286553500
media retention03650 0
min memory per query (KB)512214748364710241024
min server memory (MB)02147483647016
nested triggers011 1
network packet size (B)5123276740964096
Ole Automation Procedures010 0
open objects0214748364700
optimize for ad hoc workloads011 1
PH timeout (s)136006060
precompute rank010 0
priority boost010 0
query governor cost limit0214748364700
query wait (s)-12147483647-1-1
recovery interval (min)03276700
remote access011 1
remote admin connections010 0
remote login timeout (s)021474836471010
remote proc trans010 0
remote query timeout (s)02147483647600600
Replication XPs010 0
scan for startup procs010 0
server trigger recursion011 1
set working set size010 0
show advanced options011 1
SMO and DMO XPs011 1
transform noise words010 0
two digit year cutoff1753999920492049
user connections03276700
user options0327671642416424
xp_cmdshell0 100




namedb_size                ownerdbidcreated       status                            compatibility_level
test7 2289686.56 MBsa         7Aug 29 2015Status=ONLINE, Updateability=READ_WRITE, UserAccess=MULTI_USER, Recovery=SIMPLE, Version=706, Collation=Cyrillic_General_CI_AS, SQLSortOrder=0, IsTornPageDetectionEnabled, IsAutoCreateStatistics110




namefileid filenamefilegroupsizemaxsizegrowthusage
gb_Data1 G:\test7.mdfPRIMARY2344536128 KBUnlimited512000 KBdata only
gb_Log2 G:\test7_log.ldf[NULL]102912 KBUnlimited102400 KBlog only


test code:

select getdate()
checkpoint
go
select getdate()
checkpoint
go
select getdate()
checkpoint
go


and every time it executed 5 sec or more.

Our server has 4 E7 processors - 4890v2 2.79Ghz
And 1Tb memory.

We set counters on the server for check response time on disks, but haven't seen anything critical on disks.
Besides haven't seen correlation between the operation checkpoint, size of the written data on a disk(pages\sec) and duration. It doesn't mater how many data would be written, or when was the last checkpoint time of execution checkpoint - 5 seconds or more.
Even if  execute 5 checkpoint in a row- each takes 5 sec.

for bigger amount of information we set a flag on the server:
dbcc traceon(3502,-1)

And have received the following records:
1.
on the working server

2016-09-22 14:04:21.41 spid1179    DBCC TRACEON 3502, server process ID (SPID) 1179. This is an informational message only; no user action is required.
2016-09-22 14:04:25.58 spid1179    Ckpt dbid 7 started 
2016-09-22 14:04:25.58 spid1179    About to log Checkpoint begin.
2016-09-22 14:04:25.59 spid1179    Ckpt dbid 7 phase 1 ended (0)
2016-09-22 14:04:26.04 Logon       Error: 18456, Severity: 14, State: 8.
2016-09-22 14:04:26.04 Logon       Login failed for user 'a.mirzoyan'. Reason: Password did not match that for the login provided. [CLIENT: 10.0.2.46]
2016-09-22 14:04:31.10 spid1179    About to log Checkpoint end.
2016-09-22 14:04:31.10 spid1179    Ckpt dbid 7 complete
2016-09-22 14:04:31.13 spid1179    Ckpt dbid 7 started 
2016-09-22 14:04:31.13 spid1179    About to log Checkpoint begin.
2016-09-22 14:04:31.14 spid1179    Ckpt dbid 7 phase 1 ended (0)
2016-09-22 14:04:35.65 spid29s     About to log Checkpoint begin.
2016-09-22 14:04:36.15 spid29s     About to log Checkpoint end.
2016-09-22 14:04:36.96 spid1179    About to log Checkpoint end.
2016-09-22 14:04:36.96 spid1179    Ckpt dbid 7 complete
2016-09-22 14:04:36.97 spid3489    Ckpt dbid 7 started 
2016-09-22 14:04:36.97 spid3489    About to log Checkpoint begin.
2016-09-22 14:04:36.98 spid3489    Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:04:42.41 spid3489    About to log Checkpoint end.
2016-09-22 14:04:42.41 spid3489    Ckpt dbid 7 complete
2016-09-22 14:04:42.68 spid3489    Ckpt dbid 7 started 
2016-09-22 14:04:42.68 spid3489    About to log Checkpoint begin.
2016-09-22 14:04:42.68 spid3489    Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:04:50.20 spid3489    About to log Checkpoint end.
2016-09-22 14:04:50.20 spid3489    Ckpt dbid 7 complete
2016-09-22 14:04:56.45 spid29s     Ckpt dbid 9 started 
2016-09-22 14:04:56.45 spid29s     About to log Checkpoint begin.
2016-09-22 14:04:56.74 spid29s     Ckpt dbid 9 phase 1 ended (0)
2016-09-22 14:05:02.37 spid29s     About to log Checkpoint end.
2016-09-22 14:05:02.37 spid29s     Ckpt dbid 9 complete

2.

2016-09-22 14:02:01.54 spid68      DBCC TRACEON 3502, server process ID (SPID) 68. This is an informational message only; no user action is required.
2016-09-22 14:02:46.80 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:46.80 spid82      About to log Checkpoint begin.
2016-09-22 14:02:46.81 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:46.94 spid82      About to log Checkpoint end.
2016-09-22 14:02:46.94 spid82      Ckpt dbid 7 complete
2016-09-22 14:02:46.98 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:46.98 spid82      About to log Checkpoint begin.
2016-09-22 14:02:46.98 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:47.09 spid82      About to log Checkpoint end.
2016-09-22 14:02:47.09 spid82      Ckpt dbid 7 complete
2016-09-22 14:02:48.75 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:48.75 spid82      About to log Checkpoint begin.
2016-09-22 14:02:48.76 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:48.87 spid82      About to log Checkpoint end.
2016-09-22 14:02:48.87 spid82      Ckpt dbid 7 complete
2016-09-22 14:02:48.89 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:48.89 spid82      About to log Checkpoint begin.
2016-09-22 14:02:48.89 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:49.00 spid82      About to log Checkpoint end.
2016-09-22 14:02:49.00 spid82      Ckpt dbid 7 complete
2016-09-22 14:02:49.83 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:49.83 spid82      About to log Checkpoint begin.
2016-09-22 14:02:49.83 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:49.94 spid82      About to log Checkpoint end.
2016-09-22 14:02:49.94 spid82      Ckpt dbid 7 complete
2016-09-22 14:02:50.20 spid82      Ckpt dbid 7 started 
2016-09-22 14:02:50.20 spid82      About to log Checkpoint begin.
2016-09-22 14:02:50.21 spid82      Ckpt dbid 7 phase 1 ended (8)
2016-09-22 14:02:50.32 spid82      About to log Checkpoint end.
2016-09-22 14:02:50.32 spid82      Ckpt dbid 7 complete

on the test server resources following:
2 processors and 256Gb memory

and we can't repeat this problem on test server.

Why time of execution checkpoint on production server is so big?

how to solve [Microsoft][SQL Server Native Client 11.0]SMux Provider: Physical connection is not usable [xFFFFFFFF].

$
0
0

Windows server 2012R2.

SQL Server 2012R2.

client windows 10. 

Error:  [Microsoft][SQL Server Native Client 11.0]SMux Provider: Physical connection is not usable [xFFFFFFFF].   Please refer this error to your database administrator or see your database documentation for further assistance.

Sql Server Audit/ Event Session

$
0
0

Hi ,

Whenever we are stopping an server audit or a event session , the server is going into hung mode , response is received only after 25 mins.  This is my analysis on this

  • Using perfmon and task manager I observed , CPU/DISK/BUFFER are all normal.
  • Only sql server affected , no other heavy OS process observed at the same time. The other OS activities responds normally .
  • Sql server does not respond to any command (sp_who2,sysprocesses ,dmv ,sp_lock etc.)
  • Even DAC goes into hung mode.
  • I ran profiler but did not found ,any other Sql statement consuming heavy resources around the same time.
  • As soon as the stop statement is completes sql server starts behaving normal. All queries start reflecting the results.
  • This does not happens when server audit or  event session is started.

The sql version is 2008 r2 , Enterprise Edition , SP3. I looked MS sites , they suggested some patch updates for SP1/SP2, but I am already on SP3.

Any suggestion/ help is appreciated .

Thanks

Aslam

 

Spread one table across multiple data files

$
0
0

Hello

Is there a way to spread the data of one table across multiple data files? As far as I know we cannot really achieve it unless we have table partitioning and place the indexes on multiple filegroups/files.

Please confirm this and let me know if there is a way to spread the data of one non-partitioned table across multiple data files.

- Satya

Can we create columnstore Index in index view

$
0
0

Hi All,

i want to create columnstore  Index  in index view is possible in SQL Server.

Regards,

Manish


Can't see the query plan for a cached plan

$
0
0

Hi all,

I've the plan_handle of an execution plan, when I try to see the plan itself with the following query:

SELECT * FROM sys.dm_exec_query_plan(0x050008004928A14A301E412B0C00000001000000000000000000000000000000000000000000000000000000)

I get this output

dbidobjectidnumberencryptedquery_plan
81252075593 10NULL

why can't I see the plan?

Appdomain Memory messages in SQL Errorlog

$
0
0
Hi Experts

Need help and guidance on an on-going memory issue on an SQL 2014 SSIS server. I am not sure how to isolate things here or where to start to avoid below memory warnings in the errorlog.

Brief Problem description :
========================
We have an Datawarehouse environment wherin a lot of ssis packages run every 15 mins as a part of SQL Agent jobs which are scheduled every 15 mins/4hours depending on source system availability.
Having said that, I am seeing some memory related messages from SQL Server ERRORLOG. More importantly, I would like to know why am I seeing appdomain errors on 64-bit servers.
Based on my knowledge, usually we used to see appdomain errors on 32 bit systems when MTL (mem-to-leave) portion is less.
Could anybody please explain why we are seeing these errors and how can I avoid or minimise such errors.

Enviroment
===========

SQL Server details
====================
Microsoft SQL Server 2014 (SP1-CU5) (KB3130926) - 12.0.4439.1 (X64)     Enterprise Edition: Core-based Licensing (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)

OS information and Memory information
========================================
OS Name                    Microsoft Windows Server 2012 R2 Datacenter
Version                         6.3.9600 Build 9600
System Manufacturer    Microsoft Corporation
System Model                   Virtual Machine
System Type                      x64-based PC
Processor                            Intel(R) Xeon(R) CPU E5-4650L 0 @ 2.60GHz, 2600 Mhz, 8 Core(s), 8 Logical Processor(s)
Time Zone                           Pacific Daylight Time
Installed Physical Memory (RAM)             56.0 GB
Total Physical Memory                  56.0 GB
Available Physical Memory          21.1 GB
Total Virtual Memory                     75.9 GB
Available Virtual Memory             38.2 GB
Page File Space                                 19.9 GB


From Errorlog ( i see a lot of below errors getting repeated every now and then)
========================
2016-09-19 07:13:40.79 spid9s      AppDomain 186 (master.sys[runtime].418) is marked for unload due to memory pressure.
2016-09-19 07:13:40.79 spid9s      AppDomain 185 (mssqlsystemresource.dbo[runtime].417) is marked for unload due to memory pressure.
2016-09-19 07:13:40.79 spid36s     AppDomain 186 (master.sys[runtime].418) unloaded.
2016-09-19 07:13:40.79 spid9s      AppDomain 184 (SSISDB.dbo[runtime].416) is marked for unload due to memory pressure.
2016-09-19 07:13:40.79 spid9s      AppDomain 185 (mssqlsystemresource.dbo[runtime].417) unloaded.
2016-09-19 07:13:40.79 spid9s      AppDomain 184 (SSISDB.dbo[runtime].416) unloaded.
2016-09-19 07:14:18.92 spid92      AppDomain 187 (SSISDB.dbo[runtime].419) created.
2016-09-19 07:14:19.02 spid92      Unsafe assembly 'microsoft.sqlserver.integrationservices.server, version=12.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91, processorarchitecture=msil' loaded into appdomain 187 (SSISDB.dbo[runtime].419).

select * from sys.assemblies
name                                                   principal_id         assembly_id       clr_name                             permission_set                permission_set_desc     is_visible              create_date       modify_date      is_user_defined
Microsoft.SqlServer.Types          4                              1                              microsoft.sqlserver.types, version=12.0.0.0, culture=neutral, publickeytoken=89845dcd8080cc91, processorarchitecture=msil             3              UNSAFE_ACCESS                1              2012-02-10 20:16:00.850                2012-02-10 20:16:01.437                0

select * from sys.dm_clr_appdomains
appdomain_address      appdomain_id   appdomain_name           creation_time   db_id    user_id state                strong_refcount               weak_refcount cost        value     compatibility_level          total_processor_time_ms                total_allocated_memory_kb      survived_memory_kb
0x00000002EC1E0200      196         SSISDB.dbo[runtime].429             2016-09-21 23:31:36.770                6              1                E_APPDOMAIN_SHARED             1              5              406918  7109194                110         2875       2125677                1118
0x0000001877BDC200     113         master.sys[runtime].233              2016-08-26 12:44:34.450                1              4                E_APPDOMAIN_SHARED             48           1              8192       168820727           120         0              643         362

select * from sys.dm_clr_loaded_assemblies
assembly_id       appdomain_address            load_time
65537                 0x00000002EC1E0200      2016-09-21 23:31:37.183

 
-- perfmon counter values
counter_name                        Mem_GB
Target Server Memory (KB)       23GB
Total Server Memory (KB)        23GB


- highest memory consumers
-- Memory Clerk Usage for instance  (Query 43) (Memory Clerk Usage)
-- Look for high value for CACHESTORE_SQLCP (Ad-hoc query plans)
SELECT TOP(10) mc.[type] AS [Memory Clerk Type],
CAST((SUM(mc.pages_kb)/(1024.0 *1024)) AS DECIMAL (15,2)) AS [Memory Usage (GB)],
       CAST((SUM(mc.pages_kb)/1024.0) AS DECIMAL (15,2)) AS [Memory Usage (MB)]
FROM sys.dm_os_memory_clerks AS mc WITH (NOLOCK)
GROUP BY mc.[type]
ORDER BY SUM(mc.pages_kb) DESC OPTION (RECOMPILE);
go

Memory Clerk Type                   Memory Usage (GB)              Memory Usage (MB)
MEMORYCLERK_SQLBUFFERPOOL           17.32                                       17738.16
MEMORYCLERK_SQLQERESERVATIONS         5.43                                        5555.73
USERSTORE_DBMETADATA                1.51                                        1550.21
CACHESTORE_SQLCP                    1.40                                        1435.45
OBJECTSTORE_LOCK_MANAGER            0.41                                        423.16
MEMORYCLERK_SQLSTORENG              0.17                                        175.15
MEMORYCLERK_SOSNODE                 0.05                                        55.57
MEMORYCLERK_SQLCLR                  0.03                                        33.36
CACHESTORE_OBJCP                    0.03                                        31.02
USERSTORE_SCHEMAMGR                 0.02                                        17.00

 

--Buffer pool distribution
-- Per database DataCache usage inside buffer pool
SELECT
CASE database_id WHEN 32767 THEN 'ResourceDB' ELSE DB_NAME(database_id) END as "DatabaseName",
COUNT(*) PageCount,
CAST(COUNT(*) * 8 / 1024.0 AS NUMERIC(10, 2))  as "Size (MB)-Only DataCache-in-BufferPool"
From sys.dm_os_buffer_descriptors
--WHERE database_id = DB_ID('DUMMY')
GROUP BY db_name(database_id),database_id
ORDER BY "Size (MB)-Only DataCache-in-BufferPool" DESC  OPTION (RECOMPILE);
go

DatabaseName PageCount          Size (MB)-Only         DataCache-in-BufferPool
SSISDB                         2004259                15658.27
Alerting                 155376                 1213.88
tempdb                           52595                  410.90
demoConfig                    34753                  271.51
msdb                             20619                  161.09
ResourceDB                       2338                   18.27
master                           370                    2.89
db1                              242                    1.89
model                            97                     0.76
db3                              32                     0.25

-- See external dll's or modules getting loaded into sql server address space
select base_address,convert(varchar(20),file_version) file_version,convert(varchar(20),product_version) product_version,convert(varchar(30),company) company,convert(varchar(42),[description]) [description],name
from sys.dm_os_loaded_modules
where company not like '%Microsoft%'
--no output

SELECT name, value_in_use
FROM sys.configurations WITH (NOLOCK)
where name in ('max server memory (MB)','min server memory (MB)','optimize for ad hoc workloads','xp_cmdshell','priority boost','lightweight pooling','clr enabled','affinity I/O mask','affinity64 I/O mask','affinity mask','affinity64 mask','max degree of parallelism','cost threshold for parallelism','fill factor (%)','network packet size (B)')
ORDER BY name OPTION (RECOMPILE);


name                                                    value_in_use
affinity I/O mask                              0
affinity mask                                      0
affinity64 I/O mask                          0
affinity64 mask                                 0
clr enabled                                          1
cost threshold for parallelism     5
fill factor (%)                                      0
lightweight pooling                         0
max degree of parallelism            1
max server memory (MB)                            24000
min server memory (MB)                             16
network packet size (B)                4096
optimize for ad hoc workloads   0
priority boost                                     0
xp_cmdshell                                      0
 

Thanks,
Sam

Faulting on SQL Server Database

$
0
0

Hi,

I recently encounter Faulting problem in my SQL Database Engine and cause the services off after the faulting. I try look for the good answer for find out the cause of the faulting but I can't find any good answer..

I wonder if there is someone help me figure it out what is the cause of my sqlservr.exe Fault and how to fix it coz it happen serveral time in a day.

here is the complete error in event viewer..

Log Name:      Application
Source:        Application Error
Date:          9/23/2016 5:00:05 PM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      RESPECT
Description:
Faulting application name: sqlservr.exe, version: 2011.110.6020.0, time stamp: 0x5626ed31
Faulting module name: combase.dll, version: 6.3.9600.18202, time stamp: 0x569e6ee3
Exception code: 0xc0000005
Fault offset: 0x000000000003baa2
Faulting process id: 0x710
Faulting application start time: 0x01d215799368fc52
Faulting application path: D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\sqlservr.exe
Faulting module path: C:\Windows\SYSTEM32\combase.dll
Report Id: 7ffd4153-8174-11e6-80c7-0050569f44b6
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Level>2</Level>
    <Task>100</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2016-09-23T10:00:05.000000000Z" />
    <EventRecordID>45920</EventRecordID>
    <Channel>Application</Channel>
    <Computer>RESPECT</Computer>
    <Security />
  </System>
  <EventData>
    <Data>sqlservr.exe</Data>
    <Data>2011.110.6020.0</Data>
    <Data>5626ed31</Data>
    <Data>combase.dll</Data>
    <Data>6.3.9600.18202</Data>
    <Data>569e6ee3</Data>
    <Data>c0000005</Data>
    <Data>000000000003baa2</Data>
    <Data>710</Data>
    <Data>01d215799368fc52</Data>
    <Data>D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\sqlservr.exe</Data>
    <Data>C:\Windows\SYSTEM32\combase.dll</Data>
    <Data>7ffd4153-8174-11e6-80c7-0050569f44b6</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>

Log Name:      Application
Source:        Application Error
Date:          9/23/2016 8:08:22 PM
Event ID:      1000
Task Category: (100)
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      RESPECT
Description:
Faulting application name: sqlservr.exe, version: 2011.110.6020.0, time stamp: 0x5626ed31
Faulting module name: ntdll.dll, version: 6.3.9600.18438, time stamp: 0x57ae642e
Exception code: 0xc0000374
Fault offset: 0x00000000000f1b70
Faulting process id: 0xebc
Faulting application start time: 0x01d21581ec9ee0f4
Faulting application path: D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\sqlservr.exe
Faulting module path: C:\Windows\SYSTEM32\ntdll.dll
Report Id: cd4af016-818e-11e6-80c7-0050569f44b6
Faulting package full name:
Faulting package-relative application ID:
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Application Error" />
    <EventID Qualifiers="0">1000</EventID>
    <Level>2</Level>
    <Task>100</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2016-09-23T13:08:22.000000000Z" />
    <EventRecordID>46490</EventRecordID>
    <Channel>Application</Channel>
    <Computer>RESPECT</Computer>
    <Security />
  </System>
  <EventData>
    <Data>sqlservr.exe</Data>
    <Data>2011.110.6020.0</Data>
    <Data>5626ed31</Data>
    <Data>ntdll.dll</Data>
    <Data>6.3.9600.18438</Data>
    <Data>57ae642e</Data>
    <Data>c0000374</Data>
    <Data>00000000000f1b70</Data>
    <Data>ebc</Data>
    <Data>01d21581ec9ee0f4</Data>
    <Data>D:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Binn\sqlservr.exe</Data>
    <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
    <Data>cd4af016-818e-11e6-80c7-0050569f44b6</Data>
    <Data>
    </Data>
    <Data>
    </Data>
  </EventData>
</Event>

Check point messages in error log

$
0
0

I am seeing below message related to check points in error log, can some help to to understand this log

FlushCache: cleaned up 3194 bufs with 1259 writes in 148817 ms (avoided 485 new dirty bufs) for db 5:0
            average throughput:   0.17 MB/sec, I/O saturation: 92, context switches 765
            last target outstanding: 6880, avgWriteLatency 12

Problem with installing SQL Server 2016 Developer edition.

$
0
0

After 3 - 4 trials with different approaches, I am still unable to figure out the issue with installation.

Below is my report log.

Overall summary:
  Final result:                  Failed: see details below
  Exit code (Decimal):           -2061893606
  Start time:                    2016-09-24 13:38:24
  End time:                      2016-09-24 13:53:20
  Requested action:              Install

Setup completed with required actions for features.
Troubleshooting information for those features:
  Next step for Polybase:        Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
  Next step for SQLEngine:       Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
  Next step for FullText:        Use the following information to resolve the error, uninstall this feature, and then run the setup process again.


Machine Properties:
  Machine name:                  PRAMAN
  Machine processor count:       4
  OS version:                    Microsoft Windows 10 Home Single Language (10.0.14393)
  OS service pack:               
  OS region:                     United States
  OS language:                   English (United States)
  OS architecture:               x64
  Process architecture:          64 Bit
  OS clustered:                  No

Product features discovered:
  Product              Instance             Instance ID                    Feature                                 Language             Edition              Version         Clustered  Configured

Package properties:
  Description:                   Microsoft SQL Server 2016 
  ProductName:                   SQL Server 2016
  Type:                          RTM
  Version:                       13
  SPLevel:                       0
  Installation location:         C:\Users\PrachiManoj\Downloads\en_sql_server_2016_developer_x64_dvd_8777069\x64\setup\
  Installation edition:          Developer

Product Update Status:
  None discovered.

User Input Settings:
  ACTION:                        Install
  ADDCURRENTUSERASSQLADMIN:      false
  AGTSVCACCOUNT:                 NT Service\SQLSERVERAGENT
  AGTSVCPASSWORD:                *****
  AGTSVCSTARTUPTYPE:             Manual
  ASBACKUPDIR:                   Backup
  ASCOLLATION:                   Latin1_General_CI_AS
  ASCONFIGDIR:                   Config
  ASDATADIR:                     Data
  ASLOGDIR:                      Log
  ASPROVIDERMSOLAP:              1
  ASSERVERMODE:                  MULTIDIMENSIONAL
  ASSVCACCOUNT:                  <empty>
  ASSVCPASSWORD:                 <empty>
  ASSVCSTARTUPTYPE:              Automatic
  ASSYSADMINACCOUNTS:            <empty>
  ASTELSVCACCT:                  <empty>
  ASTELSVCPASSWORD:              <empty>
  ASTELSVCSTARTUPTYPE:           0
  ASTEMPDIR:                     Temp
  BROWSERSVCSTARTUPTYPE:         Disabled
  CLTCTLRNAME:                   <empty>
  CLTRESULTDIR:                  <empty>
  CLTSTARTUPTYPE:                0
  CLTSVCACCOUNT:                 <empty>
  CLTSVCPASSWORD:                <empty>
  CLTWORKINGDIR:                 <empty>
  COMMFABRICENCRYPTION:          0
  COMMFABRICNETWORKLEVEL:        0
  COMMFABRICPORT:                0
  CONFIGURATIONFILE:             C:\Program Files\Microsoft SQL Server\130\Setup Bootstrap\Log\20160924_133743\ConfigurationFile.ini
  CTLRSTARTUPTYPE:               0
  CTLRSVCACCOUNT:                <empty>
  CTLRSVCPASSWORD:               <empty>
  CTLRUSERS:                     <empty>
  ENABLERANU:                    false
  ENU:                           true
  EXTSVCACCOUNT:                 <empty>
  EXTSVCPASSWORD:                <empty>
  FEATURES:                      SQLENGINE, FULLTEXT, POLYBASE, CONN, BC, SDK, BOL, SNAC_SDK
  FILESTREAMLEVEL:               0
  FILESTREAMSHARENAME:           <empty>
  FTSVCACCOUNT:                  NT Service\MSSQLFDLauncher
  FTSVCPASSWORD:                 <empty>
  HELP:                          false
  IACCEPTROPENLICENSETERMS:      false
  IACCEPTSQLSERVERLICENSETERMS:  true
  INDICATEPROGRESS:              false
  INSTALLSHAREDDIR:              C:\Program Files\Microsoft SQL Server\
  INSTALLSHAREDWOWDIR:           C:\Program Files (x86)\Microsoft SQL Server\
  INSTALLSQLDATADIR:             <empty>
  INSTANCEDIR:                   C:\Program Files\Microsoft SQL Server\
  INSTANCEID:                    MSSQLSERVER
  INSTANCENAME:                  MSSQLSERVER
  ISSVCACCOUNT:                  NT AUTHORITY\Network Service
  ISSVCPASSWORD:                 <empty>
  ISSVCSTARTUPTYPE:              Automatic
  ISTELSVCACCT:                  <empty>
  ISTELSVCPASSWORD:              <empty>
  ISTELSVCSTARTUPTYPE:           0
  MATRIXCMBRICKCOMMPORT:         0
  MATRIXCMSERVERNAME:            <empty>
  MATRIXNAME:                    <empty>
  MRCACHEDIRECTORY:              
  NPENABLED:                     0
  PBDMSSVCACCOUNT:               NT AUTHORITY\NETWORK SERVICE
  PBDMSSVCPASSWORD:              <empty>
  PBDMSSVCSTARTUPTYPE:           Automatic
  PBENGSVCACCOUNT:               NT AUTHORITY\NETWORK SERVICE
  PBENGSVCPASSWORD:              <empty>
  PBENGSVCSTARTUPTYPE:           Automatic
  PBPORTRANGE:                   16450-16460
  PBSCALEOUT:                    false
  PID:                           *****
  QUIET:                         false
  QUIETSIMPLE:                   false
  ROLE:                          
  RSINSTALLMODE:                 DefaultNativeMode
  RSSHPINSTALLMODE:              DefaultSharePointMode
  RSSVCACCOUNT:                  <empty>
  RSSVCPASSWORD:                 <empty>
  RSSVCSTARTUPTYPE:              Automatic
  SAPWD:                         <empty>
  SECURITYMODE:                  <empty>
  SQLBACKUPDIR:                  <empty>
  SQLCOLLATION:                  SQL_Latin1_General_CP1_CI_AS
  SQLSVCACCOUNT:                 NT Service\MSSQLSERVER
  SQLSVCINSTANTFILEINIT:         false
  SQLSVCPASSWORD:                *****
  SQLSVCSTARTUPTYPE:             Automatic
  SQLSYSADMINACCOUNTS:           PRAMAN\PraMan
  SQLTELSVCACCT:                 NT Service\SQLTELEMETRY
  SQLTELSVCPASSWORD:             <empty>
  SQLTELSVCSTARTUPTYPE:          Automatic
  SQLTEMPDBDIR:                  <empty>
  SQLTEMPDBFILECOUNT:            4
  SQLTEMPDBFILEGROWTH:           64
  SQLTEMPDBFILESIZE:             8
  SQLTEMPDBLOGDIR:               <empty>
  SQLTEMPDBLOGFILEGROWTH:        64
  SQLTEMPDBLOGFILESIZE:          8
  SQLUSERDBDIR:                  <empty>
  SQLUSERDBLOGDIR:               <empty>
  SUPPRESSPRIVACYSTATEMENTNOTICE: false
  TCPENABLED:                    0
  UIMODE:                        Normal
  UpdateEnabled:                 true
  UpdateSource:                  MU
  USEMICROSOFTUPDATE:            false
  X86:                           false

  Configuration file:            C:\Program Files\Microsoft SQL Server\130\Setup Bootstrap\Log\20160924_133743\ConfigurationFile.ini

Detailed results:
  Feature:                       Client Tools Connectivity
  Status:                        Passed

  Feature:                       Client Tools SDK
  Status:                        Passed

  Feature:                       Client Tools Backwards Compatibility
  Status:                        Passed

  Feature:                       PolyBase Query Service for External Data
  Status:                        Failed: see logs for details
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          0x851A001A
  Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
  Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=13.0.1601.5&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026

  Feature:                       Database Engine Services
  Status:                        Failed: see logs for details
  Reason for failure:            An error occurred during the setup process of the feature.
  Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          0x851A001A
  Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
  Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=13.0.1601.5&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026

  Feature:                       Full-Text and Semantic Extractions for Search
  Status:                        Failed: see logs for details
  Reason for failure:            An error occurred for a dependency of the feature causing the setup process for the feature to fail.
  Next Step:                     Use the following information to resolve the error, uninstall this feature, and then run the setup process again.
  Component name:                SQL Server Database Engine Services Instance Features
  Component error code:          0x851A001A
  Error description:             Wait on the Database Engine recovery handle failed. Check the SQL Server error log for potential causes.
  Error help link:               http://go.microsoft.com/fwlink?LinkId=20476&ProdName=Microsoft+SQL+Server&EvtSrc=setup.rll&EvtID=50000&ProdVer=13.0.1601.5&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026&EvtType=0xD15B4EB2%400x4BDAF9BA%401306%4026

  Feature:                       SQL Browser
  Status:                        Passed

  Feature:                       Documentation Components
  Status:                        Passed

  Feature:                       SQL Writer
  Status:                        Passed

  Feature:                       SQL Client Connectivity
  Status:                        Passed

  Feature:                       SQL Client Connectivity SDK
  Status:                        Passed

  Feature:                       Setup Support Files
  Status:                        Passed

Rules with failures:

Global rules:

Scenario specific rules:

Rules report file:               C:\Program Files\Microsoft SQL Server\130\Setup Bootstrap\Log\20160924_133743\SystemConfigurationCheck_Report.htm

Please help.

Thanks in advance!

Regards

Viewing all 12554 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>