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

Select and Update statement causing deadlock

$
0
0
Hi experts,
am facing deadlock issues i.e Index/Key lock, please find the below details

Victim Process,
Object -> production_table , lock mode: Update (U), index: production_table_Non Cluster-index
select * from production_table where col1 = 1 and col2 = 2

Winning Process,
Object -> production_table , lock mode: Exclusive (X), index: production_table Cluster-index
Update production_table set col1 =1 where col2 =2

When I check the Query plan,
select statement uses production_table Cluster-index
Update statement uses production_table Cluster-index to identify the row and then updates both cluster and non-cluster index.
The above are the details occurring, My question is
1) Why does a select statement issue a (U) lock in Non-cluster index, though in query plan it uses only uses cluster Index.
2) How to stop this deadlock
I restricted to avoid NOLOCK hint
Thanks

Best Regards Moug


CHECKDB found 0 allocation errors and 1 consistency errors in table 'sys.syscolpars' (object ID 41)

$
0
0

Msg 2511, Level 16, State 2, Line 1
Table error: Object ID 41, index ID 1, partition ID 281474979397632, alloc unit ID 281474979397632 (type In-row data). Keys out of order on page (1:187), slots 9 and 10.
CHECKDB found 0 allocation errors and 1 consistency errors in table 'sys.syscolpars' (object ID 41).
CHECKDB found 0 allocation errors and 1 consistency errors in database 'db_name'.
repair_rebuild is the minimum repair level for the errors found by DBCC CHECKDB (adv_tvs).

Help required on the above error mentioned

While connecting to the default instance from out side of the server it's reaches to Named instance ?i

$
0
0

Hi All,

We have two named instance in "test" server. the names like test\a & test\b... The tcp\ip for test\a is dynamic and for test\b is default port 1433... Now customer requested to install the default instance...we had an issue with installation that is the default port number is in use so, the default installation failed and then i changed the settings in registry to use the dynamic port for default instance and then i manually start the sql servers...seems all are good...but when i connecting this default instance from out side of the box through SSMS it's pointing to the named instance which one having the default port number(test\b).

We can change the port number for test\b and assign that port to default instance...but the applications which are connecting to the test\b those are using the default port number...so, we don't want to disturb the connectivity...

is there any way to fix this issue with out changing the port number for test\b ?

it is urgent...we have to fix this issue ASAP.. 

Thanks in Advance,


rup

Database went to recovery mode after transaction log gets full

$
0
0

We have following version of SQL Server:

Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (X64) 

Database mentioned is in simple recovery mode.

We have one process which is deleting data from database. It executes the following set of statements:

set deadlock_priority low 
set rowcount 1000 
delete from TestTableA with(PAGLOCK) where time>= DATEADD(ss, 1357686000, '19700101') and time< DATEADD(ss, 1357772400, '19700101') 
set rowcount 0 
checkpoint

I have been following transaction log during this deletion with dbcc sqlperf(logspace) and it grows as the deletion process.

In one moment, transaction log get full(I am not sure why, but this is not point of this issue), and database go down in recovery mode with following set of errors:

2015-04-02 08:33:06.01 spid89      Error: 9002, Severity: 17, State: 1.
2015-04-02 08:33:06.01 spid89      The transaction log for database 'TestDB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
2015-04-02 08:33:07.03 spid89      Error: 9002, Severity: 17, State: 1.
2015-04-02 08:33:07.03 spid89      The transaction log for database 'TestDB' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
2015-04-02 08:33:07.03 spid89      Error: 3314, Severity: 21, State: 4.
2015-04-02 08:33:07.03 spid89      During undoing of a logged operation in database 'TestDB', an error occurred at log record ID (410:23344:114). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.
2015-04-02 08:33:07.03 spid89      Database TestDB was shutdown due to error 9002 in routine 'XdesRMReadWrite::RollbackToLsn'. Restart for non-snapshot databases will be attempted after all connections to the database are aborted.
2015-04-02 08:33:07.03 spid89      Error: 9001, Severity: 21, State: 5.
2015-04-02 08:33:07.03 spid89      The log for database 'TestDB' is not available. Check the event log for related error messages. Resolve any errors and restart the database.
2015-04-02 08:33:07.03 spid89      Error: 3314, Severity: 21, State: 4.
2015-04-02 08:33:07.03 spid89      During undoing of a logged operation in database 'TestDB', an error occurred at log record ID (410:23944:196). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.
2015-04-02 08:33:07.03 spid89      Error: 9001, Severity: 21, State: 1.
2015-04-02 08:33:07.03 spid89      The log for database 'TestDB' is not available. Check the event log for related error messages. Resolve any errors and restart the database.
2015-04-02 08:33:07.03 spid89      Error: 3314, Severity: 21, State: 5.
2015-04-02 08:33:07.03 spid89      During undoing of a logged operation in database 'TestDB', an error occurred at log record ID (410:22984:1). Typically, the specific failure is logged previously as an error in the Windows Event Log service. Restore the database or file from a backup, or repair the database.
2015-04-02 08:33:10.38 spid35s     Starting up database 'TestDB'.
2015-04-02 08:33:13.08 spid35s     Recovery of database 'TestDB' (7) is 0% complete (approximately 158 seconds remain). Phase 1 of 3. This is an informational message only. No user action is required.

And then follows the sequence of database recovery.

The same behavior is for all databases on that server.

I have doing DBCC CHECKDB without any errors, run sqliosim to check hardware(disks) validity, also without errors.

My expectation would be that transaction log full error does not cause database to go into recovery mode.

immortal query with Oracle linked server

$
0
0

Hi, All

I have

Microsoft SQL Server 2008 R2 (SP2) - 10.50.4000.0 (X64)
    Jun 28 2012 08:36:30
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows NT 5.2 <X64> (Build 3790: Service Pack 2)

On this server linked server to Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production is configured.

Sometimes query which used this linked server hangs up. I do command "kill", but query doesn't kill and show message "query is rolled back.....Estimated rollback time is 0". In this mode query can be for unknown time.Server restart solves this problem, but I would like to find simpler way.

The question is: how to kill this "immortal query"?

Find the Security context an SP has been executed

$
0
0
is there a way to find under what Security context an SP has been executed ?

False Missing Index Suggestion by SQL Server

$
0
0

Hello All Experts,

I am facing very stange issue of false missing index suggestion by SQL Server (I guess). Here is my query.

select * --(actuall query has column list)

from aix

innerjoinb btsonix.akey=bts.akey

innerjoinc bdtonbts.aid=bdt.aidandbts.rid=bdt.rid

innerjoind wbdrsonwbdrs.rid=bts.rid

innerjoine waonbdt.ackey=wa.ackey innerjoin fbtrdon bts.bid=b.bidandbts.rid=btrd.rid

andbtrd.rnumber=(casewhensrecord=1thenbdt.sunumber

elsebdt.binumberend)

leftjoing wtblonbtrd.rod=wtbl.tkey

where

wa.iroup=ix.ibase and

bdt.retype= 209 and bdt.rectype<> 4 and bdt.char=1

andwbdrs.btype<> 27006

For above query, I have created following index.

CREATENONCLUSTEREDINDEX[c1]ON [dbo].[c] ([char] ASC, [retype]ASC, [rectype]ASC)

INCLUDE (aid,binumber,ackey,srecord,sunumber,rid)ON[PRIMARY]

GO

Now when I run the query, the query engine properly uses above index C1 and index seek I can see. However it also suggest to create following index C2.

CREATENONCLUSTEREDINDEX[c2]ON [dbo].[c]([aid] ASC,[char]ASC, retype,ridASC)

INCLUDE (binumber,[rectype],ackey,srecord,sunumber)ON[PRIMARY]

GO

Now when I create index C2 and check the execution plan, it still uses index C1 only. So new index suggested by query engine as a missing index not being used at all. Further to this, if I drop C1 and just keep C2 then it suggest for C1 index.

This is very strange behavior. Can anyone shed light on this?

Thanks in Advance.

Malkesh Sheth

Generate Scripts in SQL Server 2008 R2 producing Error "Item has already been added.:

$
0
0

I am trying to run a Generate Scripts Task on a Database to generate a script for every object in the DB including tables, SPs, UDFs, FKs, PKs, with the settings for Schema Only, Script Drop and Create, Script "if not Exists", use database, and Object level permissions. 

I have used generate scripts before to generate this database about 5 months ago and every thing worked fine. 

Today I first tried to generate it out on a server where I only have "db_Owner" for several databases.  This failed with the error.

Microsoft.SqlServer.Management.Smo.FailedOperationException:

Discover dependencies failed. ---> System.ArgumentException:

Item has already been added. Key in dictionary:

'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name=

'VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']'

Key being added: 'Server[@Name='DLINHD007557\SQL_2008R2_64']/Database[@Name=

'VFS_ProcurementTracking']/UnresolvedEntity[@Name='prc_ContractFatInfo']'

at System.Collections.SortedList.Add(Object key, Object value) at

Microsoft.SqlServer.Management.Smo.DependencyTree..ctor(Urn[] urns,

DependencyChainCollection dependencies, Boolean fParents, Server server)

So I tried tto do this on a local version of the database where I have sa rights.  Same error.

Can someone advise me on what is going on here and how do I fix it?


Edward R. Joell MCSD MCDBA


Microsoft parallel data warehouse reporting

$
0
0
Hello everyone – does anybody know if Microsoft PDW has any reporting capabilities? I thinkit has database and ETL components but I am able to find any document etc. that talks about reporting. For example, does it offer something like ssrs? any direction, advise etc will be much appreciated.

Automatically restoring a database from prod to test server - restore test strategy

$
0
0
Hello
I am working towards automating the process of testing our backups. For the meantime, I do it all manually - I copy the backup files (full + transaction logs) to our test server and then run the restore script. Once database restored I run the DBCC CheckDB. The results of checkdb I manually upload to our Sharepoint portal as proof that the backup file is intact with no errors. 

here are some ideas I have but have not yet tested:
Create a maintenance plan with each 3 jobs:
--> Powershell script to copy the files from Prod server to Test server - add this scrip to Job1
--> Powershell script to restore databases files - add this script to Job2 
--> Run the DBCC in powershell (yet to find if possible in PS) - add this script to Job3
I would like to use seperate jobs as to get a report on the duration and status of each job
Would also like to get the results of the DBCC Checkdb as proof that no errors were found for upload to our Sharepoint portal. Dont know if possile via the job

Do anyone of you have other solutions or have a strategy already in place?

Thank you in advance
 

Impact of Query performance when we Create huge number of Partition on single table in SQL Server

$
0
0

What is impact on select query and index view, if I create around 500 partition on a single table say RegionId. If the select query not use   region id in where condition.

 

What is the best practices if we create a partition on single table.

 

Regards,

Manish

SQL Server not releasing memory

$
0
0

Hello,

I have created one stored procedure, which inserts data into 1 table.

It inserts around 1 million records at a time using XML input.

Problem is with SQL server memory I think. When I run this stored procedure and check the performance in the morning when server is not so busy, it finishes with less than 10 seconds.\

However, if I continuously test this stored procedure multiple times, it gives huge variation in performance.

Also, I call this stored procedure from C# front and there I have made sure that I am disposing Connection object every time.

After few runs, I have to restart my server computer as it doesn't allow me to run any of the query on that server.

So my question is :

  1. What is that which occupies whole server memory?
  2. Is there any thing which I can write in stored procedure to release memory once it is done?

Please assist me on this.

Thank you,

Mittal.

TempDB full (Unable to shrink)

$
0
0

Hi experts,

The drive holding tempDB is full. I confirmed that there are no transactions open and tried to shrink the tempDB. I would not shrink at!

I tried that several times and waited to see.

any ideas?


ebro

SQL Server 2012 installation problem (error server didn't respond in timely fashion ....)

$
0
0

Hi everyone,

I am new to SQL server....I am learning C# programming using visual studio 2013 . And I want to learn SQL database language to create and practice C# database project....My computer meets all the hardware requirement for SQL installation (i.e. My computer has window 7 OS , 80 GB freen HD  and 6 GB RAM. ) Therefore I  download Microsoft SQL server express 2012 try to install it in my computer (which already has visual studio).

But during installation of SQL server  I have problem ...it says the server doesn't respond in timely fashion. When I research about it everyone were saying uninstall sql and reinstall again. I uninstall and re install but still having same problem...

The database engine  also not installed displaying same error.

I don't know how can i install sql server 2012 to use with visual studio in same computer.

Can somebody please help with SQL installation please ?

It will be great help.

Many thanks in advance 

regards

rash

Server&client encryption in Tabular Data Stream Protocol Version 4.2( how to disable login encryption)

$
0
0

Client

Server ENCRYPT_OFF

Server ENCRYPT_ON

Server ENCRYPT_NOT_SUP

ENCRYPT_OFF

ENCRYPT_OFF

ENCRYPT_REQ

ENCRYPT_NOT_SUP

ENCRYPT_ON

ENCRYPT_ON

ENCRYPT_ON

ENCRYPT_NOT_SUP (connection terminated)

ENCRYPT_NOT_SUP

ENCRYPT_NOT_SUP

ENCRYPT_REQ (connection terminated)

ENCRYPT_NOT_SUP

https://msdn.microsoft.com/en-us/library/ee320519(v=sql.105).aspx

From the URL and the table, we know both Server and Client support ENCRYPT_OFF,

Server ENCRYPT_ON, or Server ENCRYPT_NOT_SUP ,

We know the default is login only encryption,so my question is how to do the setting to make the Server/client  doesnot support encryption(doesn't support full or login only encryption), that is to say to make it return "ENCRYPT_NOT_SUP"?



Please click the Mark as Answer button if a post solves your problem!







comparatively analysis of legacy database system ?

$
0
0
please help me by explain this this is our next quiz can any 1 give detail description to this topic :O :)

Failed to initialize sqlcmd library with error number -2147467259

$
0
0

Hi

I have a procedure that works fine from SSMS but sometimes fails when running via SQL Agent. The SP sends emails

Here is the error message "Failed to initialize sqlcmd library with error number -2147467259"

any ideas ?

thanks


<p>Javier Villegas | <a href="http://www.twitter.com/javier_vill" target="_blank" title="Twitter" rel="nofollow"> @javier_vill</a> |&nbsp;<a href="http://sql-javier-villegas.blogspot.com/" rel="nofollow">http://sql-javier-villegas.blogspot.com/</a></p> Please click &quot;Propose As Answer&quot; if a post solves your problem or &quot;Vote As Helpful&quot; if a post has been useful to you

Unable to start SQL Server Browser service in Sql server 2005

$
0
0

we are unable to start the SQL browser service on one of our machine with below error.

I believe this to be the reason, why we could not connect to the instance with below error

I tried troubleshooting as mentioned here, by changing value in registry from 1 to 0, but still no luck.

SQLservices are also running.

Please help on how to resolve this!

Is there a way to decrypt the SQL login-only encryption in the netmon trace or disable the SQL login-only encryption?

$
0
0
We know by default the SQL Server use the self-signed certificate to encrypt the  SQL login information when  building the connection, my question is if there is a way to decrypt the SQL login-only encryption in the netmon trace  or disable the SQL login-only encryption?


Please click the Mark as Answer button if a post solves your problem!


SQL agent failed to start

$
0
0

hi All

I am using SQl 2008, and agent failed to start

2015-03-16 11:11:31 - ! [000] Unable to connect to server '(local)'; SQLServerAgent cannot start
2015-03-16 11:11:31 - ! [298] SQLServer Error: 18456, Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. [SQLSTATE 28000]
2015-03-16 11:11:31 - ! [382] Logon to server '(local)' failed (DisableAgentXPs)
2015-03-16 11:11:32 - ? [098] SQLServerAgent terminated (normally)

SQLserver has started~~

Viewing all 12963 articles
Browse latest View live


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