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

SQL 2014 CU and GDR

$
0
0

There are lastest CU4 for SQL 2014 SP3

and another lastest GDR which is relase at 7 Sept

CU

SQL Server 2014 SP3 CU4 12.0.6329.1 (Latest build)KB4500181July 29, 2019
SQL Server 2014 SP3 CU312.0.6259.0KB4491539April 16, 2019

GDR

Description of the security update for SQL Server 2014 SP2 GDR: July 9, 2019

https://support.microsoft.com/en-us/help/4505422/security-update-for-sql-server-2014-sp3-cu3

So Am I correct the CU4 won't include the GDR for GDR: July 9, 2019?

And can we applied back the GDR after CU4 ??


need help in deadlock

$
0
0
Hi Experts,

We are seeing repeated deadlocks on one of our prod servers. Can anyone please tell me why deadlock is occuring and what can be done to fix or atleast minimize these deadlocks.
Attaching the deadlock graph. I tried to pull out deadlock information from system health session.

Environment details
===================
<deadlock><victim-list><victimProcess id="process237485b868" /></victim-list><process-list><process id="process237485b868" taskpriority="0" logused="0" waitresource="KEY: 34:72058363954855936 (e795f34fdfa7)" waittime="503" ownerId="9642762791" transactionname="implicit_transaction" lasttranstarted="2019-08-22T22:36:51.997" XDES="0x5c93fb6a8" lockMode="U" schedulerid="1" kpid="2388" status="suspended" spid="446" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2019-08-22T22:36:51.997" lastbatchcompleted="2019-08-22T22:36:51.870" lastattention="1900-01-01T00:00:00.870" clientapp="Microsoft JDBC Driver for SQL Server" hostname="sjc4mdmappp01.corp.service-now.com" hostpid="0" loginname="cmx_ors" isolationlevel="read committed (2)" xactid="9642762791" currentdb="34" lockTimeout="4294967295" clientoption1="671219744" clientoption2="128058"><executionStack><frame procname="adhoc" line="1" stmtstart="310" sqlhandle="0x0200000004296002253d1e77f9e6736ee848e3316b90c0000000000000000000000000000000000000000000">
UPDATE C_REPOS_APPLIED_LOCK SET LOCK_QUERY_SQL=@P0, LOCK_EXCLUSIVE_IND=@P1, JOB_TYPE_STR=@P2, MODULE_NAME=@P3, INTERACTION_ID=@P4, LAST_UPDATE_DATE=@P5, UPDATED_BY=@P6 WHERE ROWID_TABLE = @P7 AND LOCK_GROUP_STR=@P8    </frame><frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
unknown    </frame></executionStack><inputbuf>
(@P0 nvarchar(4000),@P1 bit,@P2 nvarchar(4000),@P3 nvarchar(4000),@P4 varchar(8000),@P5 datetime2,@P6 nvarchar(4000),@P7 nvarchar(4000),@P8 nvarchar(4000))UPDATE C_REPOS_APPLIED_LOCK SET LOCK_QUERY_SQL=@P0, LOCK_EXCLUSIVE_IND=@P1, JOB_TYPE_STR=@P2, MODULE_NAME=@P3, INTERACTION_ID=@P4, LAST_UPDATE_DATE=@P5, UPDATED_BY=@P6 WHERE ROWID_TABLE = @P7 AND LOCK_GROUP_STR=@P8                                                                           </inputbuf></process><process id="process237f7e6928" taskpriority="0" logused="480" waitresource="KEY: 34:72058363954659328 (838cbf52070e)" waittime="508" ownerId="9642762806" transactionname="implicit_transaction" lasttranstarted="2019-08-22T22:36:52.003" XDES="0x456415d6a8" lockMode="X" schedulerid="3" kpid="25708" status="suspended" spid="438" sbid="0" ecid="0" priority="0" trancount="2" lastbatchstarted="2019-08-22T22:36:52.003" lastbatchcompleted="2019-08-22T22:36:51.907" lastattention="1900-01-01T00:00:00.907" clientapp="Microsoft JDBC Driver for SQL Server" hostname="sjc4mdmappp01.corp.service-now.com" hostpid="0" loginname="cmx_ors" isolationlevel="read committed (2)" xactid="9642762806" currentdb="34" lockTimeout="4294967295" clientoption1="671219744" clientoption2="128058"><executionStack><frame procname="adhoc" line="1" stmtstart="40" sqlhandle="0x020000002fb7d6119a0168bacfcfccca5c361149704f8e940000000000000000000000000000000000000000">
DELETE FROM C_REPOS_APPLIED_LOCK WHERE LOCK_GROUP_STR=@P0    </frame><frame procname="unknown" line="1" sqlhandle="0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000">
unknown    </frame></executionStack><inputbuf>
(@P0 nvarchar(4000))DELETE FROM C_REPOS_APPLIED_LOCK WHERE LOCK_GROUP_STR=@P0           </inputbuf></process></process-list><resource-list><keylock hobtid="72058363954855936" dbid="34" objectname="cmx_ors.dbo.C_REPOS_APPLIED_LOCK" indexname="PK_APPLIED_LOCK" id="lock10c7de7600" mode="X" associatedObjectId="72058363954855936"><owner-list><owner id="process237f7e6928" mode="X" /></owner-list><waiter-list><waiter id="process237485b868" mode="U" requestType="wait" /></waiter-list></keylock><keylock hobtid="72058363954659328" dbid="34" objectname="cmx_ors.dbo.C_REPOS_APPLIED_LOCK" indexname="C_REPOS_ROWID_JOBTYPE_IND" id="lock4ee7479400" mode="U" associatedObjectId="72058363954659328"><owner-list><owner id="process237485b868" mode="U" /></owner-list><waiter-list><waiter id="process237f7e6928" mode="X" requestType="wait" /></waiter-list></keylock></resource-list></deadlock>


Microsoft SQL Server 2012 (SP4) (KB4018073) - 11.0.7001.0 (X64)
    Aug 15 2017 10:23:29
    Copyright (c) Microsoft Corporation
    Enterprise Edition (64-bit) on Windows NT 6.3 <X64> (Build 9600: ) (Hypervisor)


Thanks,
Sam

Theory questions on Extended Events

$
0
0

Hello,

Please help me with the following questions:

1)I created the AcquiredLocks session, ran it for ~1-2 minutes and displayed the results from both targets:

Q1: I thought the number of events would be the same for both targets but the histogram target always shows 296 and this value does not change when I restart the session (the file target displays the more and more events after each restart) - am I missing anything here?


Q2: Is it possible to save session data to pairing target in SSMS - seems there's no such option in the New Session wizard... ?

Thank you in advance,
Michael


TDE Initial Phase

$
0
0

May I know TDE is a random read/write process?

I see the IO size is about 256KB.

Any factor can speed up the TDE initial encryption ?

Stopat restore

$
0
0
To restore the database to a point of time I have been using full backup, differential backup and log backup. Storing all these backups needs space. I was thinking stopat restore could help because if we could restore to a point of time from full backup other backups would not be needed but stopat restore works only with log backup. In a sequence of full, differential and log backup each log backup contains changes after the last backup. Is it possible to take log backup since last full backup by skipping the differential and log backups?

determining impact of a new index on 6 views

$
0
0

Hi we run 2017 STD. Long story but I want to see the impact of a new index on one table (3.3 million rows) that is referenced along with 12 other tables in 6 views.

One of the other tables is gigantic, so i'm reluctant to mimic (it may be impossible) the situation in development.  But I would probably get away with copying the table that's getting the new index to a temp table in prod, building indexes over it and running the views as queries with that table substituted.

I don't know if running stats on a temp table is a valid thing but I'd probably want to do that on the temp table and its indexes if possible.

I might then run exec plans, queries etc to judge if the new index is going to impact the 6 views.

Is this a valid approach / alternative to measuring impact of a new index ?  Is there a better way in sql server to project the impact of a new index?  what if I might want to replace an existing index on the table with the new index? 

I can pretty easily measure the impact on writes to the table in question so that isn't an issue.


Extended event capture

$
0
0

Hi All,

I want to capture deadlock information and associated batch and tsql stmts . I tried setting up extended event session.
I was able to reproduce the deadlock error but not sure why xml deadlock graph was not getting captured in the .xel file.
Am I doing anything wrong here? Is track_causality option = ON is doing something wrong? Please suggest.

CREATE EVENT SESSION [xe_deadlocks] ON SERVER
ADD EVENT sqlserver.error_reported(
    ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id,sqlserver.database_name,sqlserver.plan_handle,sqlserver.query_plan_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.transaction_id)
    WHERE ([sqlserver].[database_name]=N'testdb' AND [sqlserver].[is_system]=(0))),
ADD EVENT sqlserver.rpc_completed(
    ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id,sqlserver.database_name,sqlserver.plan_handle,sqlserver.query_plan_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.transaction_id)
    WHERE ([sqlserver].[database_name]=N'testdb' AND [sqlserver].[is_system]=(0))),
ADD EVENT sqlserver.sp_statement_completed(
    ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id,sqlserver.database_name,sqlserver.plan_handle,sqlserver.query_plan_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.transaction_id)
    WHERE ([sqlserver].[database_name]=N'testdb' AND [sqlserver].[is_system]=(0))),
ADD EVENT sqlserver.sql_batch_completed(
    ACTION(sqlserver.client_app_name,sqlserver.client_hostname,sqlserver.database_id,sqlserver.database_name,sqlserver.plan_handle,sqlserver.query_plan_hash,sqlserver.server_principal_name,sqlserver.session_id,sqlserver.sql_text,sqlserver.transaction_id)
    WHERE ([sqlserver].[database_name]=N'testdb' AND [sqlserver].[is_system]=(0))),
ADD EVENT sqlserver.xml_deadlock_report(
    WHERE ([sqlserver].[database_name]=N'testdb' AND [sqlserver].[is_system]=(0)))
ADD TARGET package0.event_file(SET filename=N'z:\xevents\xe_deadlocks.xel',max_file_size=(1024),max_rollover_files=(4))
WITH (MAX_MEMORY=4096 KB,
EVENT_RETENTION_MODE=ALLOW_SINGLE_EVENT_LOSS,
MAX_DISPATCH_LATENCY=30 SECONDS,
MAX_EVENT_SIZE=0 KB,
MEMORY_PARTITION_MODE=NONE,
TRACK_CAUSALITY=ON
,STARTUP_STATE=OFF
)
GO

I was trying to pull deadlock information using below sql stmts.But I dont see deadlock information is getting logged.

 drop table #results
CREATE TABLE #results
(RowID INT IDENTITY PRIMARY KEY,
event_data XML);
 
go
 
DECLARE @Filename VARCHAR(255) = N'z:\xevents\xe_deadlocks*.xel';
-- note: get the path from above  serverproperty('errorlogfilename') . This is where system_health session log files are resided
 
 
 
INSERT INTO #results (event_data)
-- Cast the target_data to XML
SELECT CAST(event_data AS XML) AS event_data
FROM sys.fn_xe_file_target_read_file(@Filename, null, null, null)
 
go

select * from #results

 
/* Output Deadlock Graphs */
SELECT
    event_data.value('(event/@timestamp)[1]', 'DATETIME2') AS eventtimestamp,
    event_data.query('(event/data/value/deadlock)[1]') AS DeadlockGraph
FROM #results
WHERE event_data.exist('event[@name="xml_deadlock_report"]') = 1
ORDER BY eventtimestamp ASC
OPTION(MAXDOP 1);

Thanks,
Sam








SQL Server database Parameter List

$
0
0

Hi Sir,

Is there any way to get ALLdatabase parameter list by using  DATABASEPROPERTYEX or any other sql.

DATABASEPROPERTYEX('AdventureWorks2012','Version') AS [Version]

Regards,

Deepak


does selecting with nolock from a replicated db increase significantly the chances of a duplicate being selected?

$
0
0

Hi we run std 2017. It only happens 2 or 3 times a month but even that seems to be more frequent than any of the anomalies I've read about that nolock brings to the "table".

We have a select (maybe 1000-2000 records) on a replicated table with nolock based on an entry date being greater than the last high entry date taken in the previous hour.  I'm sure it runs sometimes while replication is occurring.  The serially assigned PK of the replicated table guarantees dupes aren't physically stored on the table.  We have some pretty convincing evidence that duplicates are being selected now and then.  The PK isn't clustered and on the surface the index that is clustered while unique doesn't appear to be correlated to "time".  I'm looking closer at that.

Does the tandem of replication and reading with nolock increase the possibility of dupes so significantly that we might see them more often than some of the other anomalies nolock creates?

We select on the hour from 20 similar databases, about 6 at a time, all of which sit on the same server, all of which are replication targets and at first glance all seem to be on the same physical device .  As usual I'm concerned about locking if we take the nolock off. 

 




Issue shrinking "empty" file using DBCC SHRINKFILE

$
0
0

Hello all.

We could use some help with an issue that we haven't seen before.

When attempting to shrink a data file where we have migrated the tables off of the associated filegroup, we are getting the following error:

DBCC SHRINKFILE: Page 5:458510930 could not be moved because it belongs to an active online index build with LOBs.

Using DBCC PAGE to determine what this page belongs to, we find that it belongs to an object_id that doesn't actually exist in sys.objects.

So there are allocation units for a table that doesn't actually exist.

We have run DBCC CHECKDB on the database which doesn't report any corruption and we have actually backed up and restored the database to another server hoping that would clear up any "orphaned" pages, etc., but nothing has gotten us past this problem.

Any insight would helpful.

DBCC loginfo

$
0
0

I am curious on the following situation.

1. I have a database in FULL recovery mode

2 I performed database log backup.

3. there are no more active transaction or  replication

4. Check in DBCC loginfo for that database, the status of the VLF are still 2 . why is that ?

How to track the difference data column while comparing with 2 tables having same column names

$
0
0

I have 2 tables Snapshot table and temptable. temptable is holding copy of snapshot table before snapshot gets incremental load. My objective is to pull the Rowid & column and value which ever has difference compare to each other.

So I need Some code or the ways or articles to implement this.

Snapshot Table:

RowIDObject Column2 Column31            Jack   USA2            Ryan   GER

Temp Table:

RowIDObject Column2 Column31            Jack   USA2            Ryan   GER

Snapshot Table After Incremental load

RowIDObject Column2 Column31            Jack   UAE2            Ryan1   GER

I want to hold in a new table

RowID ColumnChanged ActualValue Updated Value1       Column3       USA         UAE2       Column2       Ryan        Ryan1

Note: I am using Azure SQL DB.

Open transaction issue on DB and proactive measures and suggestions needed

$
0
0

I understood that 

Seclects are not loggged in Transaction Logs; only  DML (INSERT, UPDATE, DELETE, Merge) or Any other DDL (CREATE, DROP, ALTER etc.) statements are logged.

howerver yesterday during an issue with my application user we did saw an open transaction on the DB for quite an long time ( 20 minutes), this query is an Select statement with an left outer join and my application user argues that it was an common query that is called umpteen times and was all along fine except that on that particular eventful time it was creating an issue for them they rebooted the workstation that was runnign the query but still the session was not remvoed from DB

question 1 to us is why did not the SPID got removed in the DB when the workstation that was issuing the SELECT was rebooted as we had it forefully KILLED on DB layer, where is the issue on application layer or in DB engine ??

Question 2 to us is if there is an alerting mechanism or an event ID for open transactions to be monitored and alerted via SCOM tool if so what is the Enterprise monitorinig threshold for that parameter ( application team is arguing that no open transactions should exist and should get completed in milliseconds )  

Is there any other email alert mechanism or proactive measure to alert us when the open transaction on the Db is for more time. 

Appreciate all your help on this requirement to gracefully address the concerns

Regards and Wishes

Eben

Query -


SELECT [t0].[row_version] AS [RowVersion], [t0].[organization_guid] AS [__Key], [t0].[name] AS [Name], [t0].[comments] AS [Comments], [t1].[row_version] AS [RowVersion2], [t1].[organization_guid] AS [__OrganizationKey], [t1].[site_guid] AS [__Key2], [t1].[name] AS [Name2], [t1].[person_id_type_guid] AS [__PersonIdTypeKey], [t1].[default_inbox_guid] AS [__DefaultInboxKey], [t1].[comments] AS [Comments2], [t1].[domain_name] AS [DomainName], [t1].[default_template_guid] AS [__DefaultTemplateKey], [t1].[shortcuts] AS [Shortcuts], (
    SELECT COUNT(*)
    FROM [sites_view] AS [t2]
    WHERE [t0].[organization_guid] = [t2].[organization_guid]
    ) AS [value]
FROM [organizations_view] AS [t0]
LEFT OUTER JOIN [sites_view] AS [t1] ON [t0].[organization_guid] = [t1].[organization_guid]
ORDER BY [t0].[organization_guid], [t1].[site_guid




do views automatically pick up rerun stats etc on tables and indexes

$
0
0
Hi We run 2017 std. Just to be safe I am wondering if following an index add on 2 tables and removal of an index from 1 table if the views using those tables require some sort of recompile? Before the index adds, an important search date was converted from nulls to 12/31/9999 also.   I ran stats on the tables and indexes.  Just wondering if views will pick up on the changes seamlessly.  I know estim exec plans saw the changes but that was for adhoc queries, not views.

SQL Server 2014 not connecting when TLS 1.0 is disabled

$
0
0

Hi Team,

We are unable to connect to SQL server 2014 (https://www.microsoft.com/en-us/download/details.aspx?id=51187) when TLS 1.0 is disabled in registry. Connection is successful only when TLS 1.2 is enabled in registry and TLS 1.0 registry key is not present.

Below is error which we are getting

com_error: Unspecified error;[DBNETLIB][ConnectionOpen (SECDoClientHandshake()).]SSL Security error.) “

Please suggest how to enable connection with TLS 1.0 disabled


Extended Events and Perfmon analyze together

$
0
0

In SQL 2014, I need to analyze XE files containing stored procedures/queries generating high load and see the impact on Perfmon data.

I am interested in CodePlex and/or MS tools to analyze together XE and Perfmon, but not a third-partysubscription

AFAIK there was nothing available a few years back, if no tool available then any blog/hyperlink for this? 

Thank you,



How to get information "Who has executed SQL Server Profiler"

$
0
0

Hi Folks,

I am looking information for "Who has executed SQL Server Profiler" and I want mail alert asap when someone executes SQL Server Profiler.

Looking for guidance how to achieve it.

Where to find SQL Server 2014 Developer edition download?

$
0
0

Hi!

Does anyone know if there is a link to download SQL Server 2014 developer edition?

I need to repair an instance but we no longer have a copy of the media..

Thanks,

Zoe

Could not allocate space for object 'dbo.DEF' in database 'XYZ' because the 'PRIMARY' filegroup is full

$
0
0

Hi Folks,

I am getting below error for one of my job:

Could not allocate space for object 'dbo.DEF' in database 'XYZ' because the 'PRIMARY' filegroup is full. Create disk space by deleting unneeded files, dropping objects in the filegroup, adding ...  The package execution fa...  The step failed.

We have Primary File group and secondary file group, I am not able to understand why data is not going in secondary data file.

Below are the settings and properties for database; kindly put some light where I am wrong??

Actual Execution Plan shows 48 million rows. Same query and plan, same database different day shows 0 rows

$
0
0

I have a rather large query with a UNION ALL that runs at different customer sites all over the country. Last week the query became painfully slow at one site. Analyzing the "actual" query plan with Plan Explorer shows that when it scans the Clustered Index of a table with just over 1 million rows it shows estimated rows at over 390 million and actual rows at 48 million.

Today when I run the exact query (copy/paste command text), it runs as expected and the actual rows returns 0. (Estimated rows 381 million). Comparing the two query plans shows the one "bad?" clustered index scan as the only difference. 

My question is what would cause that type of issue? Could the index or table have been corrupted? Weekend database maintenance would have rebuilt all indexes, so I'm wondering if that was the cause. 

I need to report to the customer what happened, but I'm at a loss of what to tell them. 

Viewing all 10269 articles
Browse latest View live


Latest Images

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