I have to find locks which have been caused by some particular users before the scheduled jobs kick off and kill the locked processes so that the scheduled job executes without failing. How to do this in SQL server? please help
I've got an INSERT that's selecting data from a linked server and attempting to push 10 million rows into the blank table. More or less, it looks like this:
The instance of the SQL Server Database Engine cannot obtain a LOCK resource at this time. Rerun your statement when there are fewer active users. Ask the database administrator to check the lock and memory configuration for this instance, or to check for long-running transactions. There are no other active users. I ran it again and monitored the following DMO to watch the growth of locks for that spid:
SELECT request_session_id, COUNT (*) num_locks -- select * FROM sys.dm_tran_locks --where request_session_id = 77 GROUP BY request_session_id ORDER BY count (*) DESC
The number of locks started small and held for a while around 4-7 locks, but at about 5 minutes in the number of locks held by that spid grew dramatically to more than 8 million before finally erroring again with the same message. Researching, I can't figure out why it's not escalating from row locks to table locks at the appropriate threshold. The threshold in was set to 0 at first (Server Properties > Advanced > Parallelism > Locks). I set it to 5000, and it still didn't seem to work. Rewriting the INSERT to include a WITH (TABLOCK) allows it to finish successfully in testing. My problem is that it's coming out of an ETL with source code that I can't edit. I need to figure out how to force it to escalate to locking the entire table via table or server level settings.
A colleague suggested that installing service packs may take care of it (the client is running SQL Server 2008 R2 (RTM)), but I haven't found anything online to support that theory.
We are migrating our database(s) from ORACLE to SQL. In Oracle we were able to issue a SELECT statement and see all of the locks (Blocking and Non-Blocking) currently in the system. The query also included the Process ID of the process we needed to kill in order to get rid of the lock.
We now need to create the same type of query for Microsoft SQL Server 2012. I have seen postings on different sites saying that this info can be obtained using SP_WHO2 or using the SQL Server Management Studio Activity Monitor's PROCESSES tab, but we are looking for a SELECT statement that will give us similar information.
I'm trying to kill a bunch of processes in SQL 6.5 and I can't. I'm running the only machine with SQL tools installed on it (the server) and it won't let me kill them. I try the GUI screens and the Kill statement in ISQL_w. Is there any way around this?
I've stopped the SQL Server and rebooted the NT Server. Is there anyway I can get rid of these processes. They are locking some tables and keeping me from inserting data within my code. Very frustrating.
Dear, Our ASP.NET scripts send SQL statements (as inline SQL or SP) to process the requested job. After the job execution, the process ID stays in the server and waits for next command with sleeping status.Since this process does not go away, next job adds another process and eventually, the server is overloaded with these processes and dies. How can I kill this sleeping processes?Regards,Echo
Hi! I have a small problem , but it's still a problem. I have a SQL Server Agent job that runs a .cmd file. This CMD is logged to a textfile. This process is locked, waiting for me to type a password, but I have nowhere to type that pass.
What I want to do is kill the process that i locking the logfile, because since the logfile is locked, the job cannot be started again (and it's a scheduled job). The jobs status is 'Not Running'. I have solved the problem by making the cmd write to another logfile, so the schedule will work, but the file is still locked, and I don't want to restart the server since it's a productionserver.
How to I find the process that is initialized from SQL Agent, and kill it?
Anyway I want to know if there is a way to get SQL Server to release a lock without using the kill command. My reason for asking is because this morning I was investigating some deadlocks and thought it would be nice if SQL Server upon identifying a deadlock instead of killing the victim SPID would simply force the victim SPID to release the lock causing the deadlock so that the other SPID could continue and the victim would simply have to wait longer.That lead me to wonder if there was a T-SQL command or DBCC to force SQL Server to release a lock that I specify.
So, any way to get SQL Server to release a lock without using the kill command?
I want to implement "Auto disconnection" (or kill) of user session that exceed a specified idle duration in SQL Server 2005.
I know how do that in oracle by creating a profile and set the IDLE_TIME paramter and asign that profile to all users. But in SQL Server i don't know how to do it.
Hi all I use 64 bit 2005 server with 8cpu and 8G of memory. This server is accessed by large number of intensive or not so intensive programs. I had eliminated all inefficient queries by means of sql profiler. What I see now is 30 procs or so runining in 1 second. They are all pretty simple and as I said use indexes. cpu column for most show 0, reads show 10 - 50 - pretty good. But... my cpu utilization is 75% in avg. across of all 8 cpu's. I really can't find an answer for it. If procs run so efficient, where does cpu go? Disk queue length is 0.04 or less - seems very good. Task manager shows that all of it 75% attributed to sql server. So which resources besides sql queries use so much cpu? Do I have to look at some other areas and which ones where cpu could be used besides sql queries themselves.
Everytime I try to open the design-mode of a table from enterprise mgr, I get this error 1204.--- SQL Server has run out of LOCKS. Rerun your statement when there are fewer active users, or ask the system administrator to reconfigure SQL Server with more LOCKS. There no other users but me. Locks have been configured to their max (over 200000000). Don't understand whats wrong. Please help..
We've experienced persistent hang up on our application. I tried opening the enterprise manager->management->Current Activity->Locks/Object and I've seen ridiculous entries like master.dbo.spt_values, SIS.dbo.feesclass,tempdb.dbo$##lockinfo205. I don't what this mean? does it tell us that something wrong with the application that does not release locks? please help me.
I have a simple web application using ASP.NET/C#/SQL Server 2000/Windows 2000
I'm having problems with the server "hanging" for ~15 minutes. Disk/CPU are idle so this isn't a resource issue. In Enterprise Manager, under "Current Activity" I see several processes waiting on:
LCK_M_X LCK_M_S LCK_M_S NETWORKIO
How do I investigate this? My application is so simple, I have trouble imagining how a lock-related problem could ocurr? There is absolutely no concurrent processing done on this server. There is only one user running this app and there are no separate threads spawned.
Although this problem is sporadic, this happens the most while doing the following:
- Open connection1 (for SELECT) - Open connection2 (for UPDATE) - Open SqlDataReader through connection1 with SELECT statement - Iterate through - For certain records issue UPDATE statement via connection2.
Here are some sample code snippets. Default ADO.NET options and everything should be cleaned up through C# "using" blocks without relying on garbage collection.
using (SqlConnection selectConnection = LeadsDatabase.OpenConnection()) { using (SqlConnection updateConnection = LeadsDatabase.OpenConnection()) { using (SqlCommand dbCommand = new SqlCommand(sql, selectConnection)) { using (SqlDataReader reader = dbCommand.ExecuteReader()) { while (reader.Read()) { using (SqlCommand updateCommand = new SqlCommand(sql, updateConnection)) { updateCommand.ExecuteNonQuery();
I am task with identifying the source database name, id, and server name for each staging table that I create. I need to add this to a derived column on all staging tables created from merging same tables on different servers together.
When doing a Merge Join, there is no way to identify the source of data so I would like to see if data came from one database more than the other servers or if their are duplicates across servers.
The thing that bugs me about SSIS Data Flow task is there is no way to do an easy Execute SQL Task after I select my ADO.NET Source to get this information because my connection string is dynamic and there is no way of know which data source is being picked up at runtime.
For Example I have Products table on Server 1 and 2:
Server 2 has more Products and would like to join the two together to create a staging table.
Is it possible to view the Connection String information of a remote login/session? I want to know if the login is looking-up the database server via IP address, servername (NetBIOS name) or fully-qualified domain name (FQDN).
Using these DMVs I can get a lot of relevant information:
sys.dm_exec_sessions Program Name (eg. Microsoft SQL Server Management Studio), Client Interface Name (eg. .Net SqlClient Data Provider) sys.dm_exec_connections Net Transport (eg. TCP), Client Net Address and TCP Port
but not how the server's IP address was resolved. Is the connection string ever sent by the client to the server, or just used for DNS lookup?
I don't wnat SQL's Identify column's format ( which is 1�2�3 ...)I want my Prikey column is looks like starts in 0000000001�0000000002�0000000003....I set the Prikey columns type is Char(10) not nullis it possible to setting my identify column as I want?
Hi, i have installed sql 7.0 sp1 on a server that frecuently report the error: 1024
"SQL Server has run out of LOCKS. Rerun your statement when there are fewer active users, or ask the system administrator to reconfigure SQL Server with more LOCKS.."
I reconfiguered the locks twice, but the error persist.
Situation: When I ran a query and bumped into a message that is "SQL server has run out of LOCKS. Re-run your command when there are fewer active ussers. or ask your system administratroe to reconfigyre SQL Server with more LOCKS." Then, I tried to reconfigure/increase the locks. It could not let me do it. So, I tried to relog on the server, then I kept getting the same message as above.
Questions: Is there a way to log on the server and reconfigure the locks? Do I have reinstall the SQL server?
I am getting the following message from the SQL Server 7.0. I have increased the locks but still it is getting messages on few days.
Coould you please advise me what is the main reason for ran out of locks and how can solve this problem otherthan increase the locks.If needs to be increased what is the calculation method to arrive at the number of locks.
Thanks >RAvi
" SQL Server Alert System: 'Demo: Sev. 19 Errors' occurred on CSQWBDB1
DESCRIPTION:Error: 1204, Severity: 19, State: 1 SQL Server has run out of LOCKS. Rerun your statement when there are fewer active users, or ask the system administrator to reconfigure SQL Server with more LOCKS. "
ColA ColB ----- ----- 21 A 22 A 23 A 24 B 25 B 26 D
What I want is to be able to identify a set sequence (1,2,3) based upon ColB such that I'd get the following result:
ColA ColB ColC ----- ----- ----- 21 A 1 22 A 1 23 A 1 24 B 2 25 B 2 26 D 3
I know that I should be able to get it using ROW_NUMBER() OVER (PARTITION BY ColB ORDER BY ColA), but instead of getting the sequence (1,1,1,2,2,3) I get (1,2,3,1,2,1). Using DENSE_RANK gave me the same results.
Microsoft SQL Server 2005 - 9.00.1399.06 (X64) Oct 14 2005 00:35:21 Copyright (c) 1988-2005 Microsoft Corporation Developer Edition (64-bit) on Windows NT 5.2 (Build 3790: Service Pack 1)
how to determine that i have installed sql server service pack 2
do i have to restart the server to see the effect, how will it show that it is service pack 2
We are doing a review of a SQL 2008 server. Though we can identify what are the linked servers to the database.
However is there a sure shot way to identify, incoming DB links to the database server. I know the successful connections are easy to identify, but I wish to know all possible incoming DB links to server.
Will the DB logs support in identifying all attempted and successful DB link connections.
Hi All, I am frequently getting an error of Unable to acquire a LOCK at this time. Something about too many users logged in. What is the limit of LOCKS in MS SQL 2005 ? When I switch the cluster nodes, the LOCK issue goes away. The issue only occurs when someone tries a DDL command. Advice.
I want to identify rows that go negative but only for 2 cents or more as well as identify rows that 2 or more.
I have this expression that does not work how I want it to work:
CASE WHEN (SUM(FavUnfavCostChange) < (2/100) THEN 'Less' WHEN SUM(FavUnfavCostChange) > (2/100) THEN 'More' ELSE NULL END AS 'Flag'
But I get:
0.00000815000000000000More -- this is not more than 2 cents, is just a positive number -0.00094700000000000000Less -- this is not less than 2 cents, is just negative number -0.00222000000000000000Less -- this is not less than 2 cents, is just negative number -0.00012250000000000000Less -- this is not less than 2 cents, is just negative number 0.00000000000000000000NULL -- this is zero so null is fine 0.01188576000000000000More -- this is not more than 2 cents, is just a positive number
I'm using MS SQL Server 2008 and I'm trying to figure out if it is possible to identify what tables / columns contain specific records.
In the example below information generated for the end user, so the column headers (Customer ID, Customer, Address, Phone, Email, Account Balance, Currency) are not necessarily the field names from the relevant tables, they are simply more identifiable headers for the user.
Customer ID CustomerAddress Phone Email Account Balance Currency js0001 John Smith123 Nowhere Street555-123-456 jsmith@nowhere.com-100 USD jd2345 Jane Doe 61a Down the road087-963258 jdoe@downthe road.com-2108 GBP mx9999 Mr X Whoknowsville 147-852369 mrx@whoknows.com0 EUR
In reality the column headers may be called eg (CustID, CustName, CustAdr, CustPh, CustMail, CustACBal, Currency).
As I am not the generator of this report, I would like to know whether or not it is possible to identify the field names and / or what tables they exist in, if I were to used the report info to search for it. For example, could I perhaps find out the field name and table for "jd2345" or for "mrx@whoknows.com", because the Customer ID or Email may not be what the actual fields are called.
I'm not a DB admin and I don't have rights to do a stored procedure on the server. I'm guessing what I want is not so simple to do, but is it possible to do via a query?
I am in process to develop TSql code to identify change in data.
I read about Binary_checksum and hashbyte. Some people say hashbyte is better than binay_checksum as chances of collision are less.
But if we may consider following, chances exist in hashbyte too. My question is what is the best way to compare data to identify change (I can't configure CDC) ?
I have an application wrote in Power Builder 11 and use OLEDB connection for SQL SERVER 2005 DB. it works excellent till multiple users access the application. 2 seconds passes and locks appears and blocks all the DB! I realy don't know what is the reason. In past I used SQL Native driver and it works well with the same application!!! (other reasons caused me to change the connection. not this). Does someone can help me????????