Transaction Context In Use By Another Session Error
May 12, 2006
I have written a stored procedure that calls a C# class. The sp is called by a trigger on table A. The class has 2 methods. Method 1 is the main call from the stored procedure. Inside it, it sets a connection to the db. Then it calls another private method which has it's own connection and returns a dataset so that I can close that connection by the end of the method. When I execute the sp from within sql management studio, it runs just fine. But when being called from the trigger, I get the "transaction context in use by another session error" error. I read that I needed to wrap my 2nd connection in ...
using (new TransactionScope(TransactionScopeOption.Suppress))
{
open conn here, do work, etc.
}
I've tried that and I still get the same error from the trigger. Anyone know what else I can try? Thanks.
I am using this tag <%Transaction=Required%> to do the transaction.
And it woks well, but the problem is that sometimes I get this error: "transaction context in use by another session"...
It's really weird because it only happens in the same row. If choose this row to be shown I get that message, but if choose another row I get result with no error. And if take out the tag <%Transaction... I don't get any error.
I've searched in other forums about this error, and one guy claims that there is a bug in the MTS and there is no way to solve the problem.
I have a c# stored procedure that is being called from a trigger. When I execute it from management studio, it works just fine. But, when I update a record in the table that has the trigger that calls the sp, I get the error "transaction context in use by another session error". I've tried a few of the "fixes" that I found through searching, but so far nothing seems to work. What I've tried so far is...
Removing the transaction from my code making sure my code is only using 1 connection setting XACT_ABORT ON
I have a master package that executes a series of sub packages. The master package is run from a SQL Agent job. The packages are reading from and writing to two databases on the same instance of SQL Server 2005.
If I set the Execute Package Tasks for the sub packages without any precedence constraints between them and set TransactionOption = Required at the master package level (and supported from there downwards) I get the following errors.
The event log shows me:
The SSIS Runtime has failed to enlist the OLE DB connection in a distributed transaction with error 0x8004D00A "Unable to enlist in the transaction.".
Running a SQL Profiler trace shows me:
Error: 3910, Severity: 16, State: 2 Transaction context in use by another session.
This problem is well documented and seems to go back to DTS in SQL Server 7.0 . . . see http://support.microsoft.com/?scid=kb;en-us;279857&spid=2852&sid=150
I can get round it by setting precedence between the sub packages - making them run one at a time solves the problem. But then we don't get the performance benefits of running the packages concurrently. Does anyone have any other solutions.
This procedure has a begin trans and a commit. In this procedure i'm inserting data into tables. This data is provided by an extrenal app in staging tables. On the tables i'm inserting data on i'm having triggers that again are starting a SP2. I'm using a cursor on the inserted table to achieve this. The SP2 only insert a record on a table that is on a linked server.
For testing reasons at this moment this is my dev machine too.
Im using SQL Server 2000 sp2 for ASP application on windows server 2003 sp2.
Im getting an error 'Transaction context in user by another session'.
I have not at all used BEGINTRANS / committrans , No Insert / Update statements. the kind of SQL statements that i was using in that page load is only "SELECT statements"
Can any one give me answer how to get rid of this. I have used only one connection object. and result set as a loop containing few more result sets. But I m sure they are so complex statements to block the SQL server transactions.
I'm getting this when executing the code below. Going from W2K/SQL2k SP4 to XP/SQL2k SP4 over a dial-up link.
If I take away the begin tran and commit it works, but of course, if one statement fails I want a rollback. I'm executing this from a Delphi app, but I get the same from Qry Analyser.
I've tried both with and without the Set XACT . . ., and also tried with Set Implicit_Transactions off.
set XACT_ABORT ON Begin distributed Tran update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TRANSACTIONMAIN set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.TRANSACTIONMAIN set REPFLAG = 0 where REPFLAG = 1 and DONE = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.WBENTRY set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.WBENTRY set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.FIXED set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.FIXED set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.ALTCHARGE set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.ALTCHARGE set REPFLAG = 0 where REPFLAG = 1 update OPENDATASOURCE('SQLOLEDB','Data Source=10.10.10.171;User ID=*****;Password=****').TRANSFERSTN.TSADMIN.TSAUDIT set REPFLAG = 0 where REPFLAG = 1 update TSADMIN.TSAUDIT set REPFLAG = 0 where REPFLAG = 1 COMMIT TRAN
It's got me stumped, so any ideas gratefully received.Thx
I have a design a SSIS Package for ETL Process. In my package i have to read the data from the tables and then insert into the another table of same structure.
for reading the data i have write the Dynamic TSQL based on some condition and based on that it is using 25 different function to populate the data into different 25 column. Tsql returning correct data and is working fine in Enterprise manager. But in my SSIS package it show me time out ERROR.
I have increase and decrease the time to catch the error but it is still there i have tried to set 0 for commandout Properties.
if i'm using the 0 for commandtime out then i'm getting the Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
and
Failed to open a fastload rowset for "[dbo].[P@@#$%$%%%]". Check that the object exists in the database.
Is there a way to specify a given Schema as the currently active one for a given database session ? i.e. im looking for somthing like:
Use Schema=<name>
Execute Queries / Stored Procs, etc
.....
I want all the Queries and Stored Procs to execute on the Schema set initially.
I can't use the Default_Schema on the User to do this due to certain restrictions in the way we create users and Schemas.
I know that i can always qualify the objects in the Queries with a Schema Name, but i have a requirement where the Queries need to be generic in nature and need to run on one of many identical schemas in the Database. Is this Possible in Sql Server?
I am getting this error :Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.OleDb.OleDbException: Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.have anybody idea?!
i have a sequence container in my my sequence container i have a script task for drop the existing tables. This seq. container connected to another seq. container. all these are in for each loop container when i run the package it's work fine for 1st looop but it gives me error for second execution.
Message is like this:
Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.
i am getting this error "Distributed transaction completed. Either enlist this session in a new transaction or the NULL transaction.".
my transations have been done using LINKED SERVER. when i manually call the store procedure from Server 1 it works but when i call it through Service broker it dosen't work and gives me this error.
I need some some clarifications on how Context connections and transactions inter operate in CLR.
The context connection allows for ADO objects to be " running in the same transaction space". So the association to the current transaction is implied. So as long as I set for example my SqlCommand to use the context connection I am going to be running under the same transaction.
SqlConnection sqlConn = new SqlConnection("context connection=true"); SqlCommand sqlComm = new SqlCommand("EXEC myCommand", sqlConn);
I guess my ambiguity comes from the fact that the Transaction is not specifically specified.
In addition what happens upon a trigger that for example watches and insert on a table? If the insert occurs under a transaction, I would assume that I will be also picking up that transaction in the CRL Trigger, thus the whole operation would seem atomic.
I am using VS2008 Team Edition under Vista with SQL Compact 3.5
I am trying to develop an app using C# and LINQ and take advantage of the Sync services. The problem is that everything seems to work but nothing ever really gets saved out to the local .sdf file. I have all the SQL commands logged to the the console and they seem fine. I have SubmitChanges() wrapped in a try/catch and no exceptions are thrown. When I requery the context for the data the new added rows do show up. If while the application is open, I go to VS2008 and query the file I just added to, I don't see the new rows. If I exit the application and try I still don't see them. If I restart the application the rows show up. If I exit the app and refresh the connection to the .sdf file in VS and then restart the application the inserted records are gone.
They act exactly as if when I made my connection to the database I started a transaction (which I didn't do, at least no explicitly) that I never commit. Did I miss some basic point about opening a connection to SQL compact?
I connect when the app launches and I store the context in a member variable of my class which doesn't go out of scope until the application quits. I tried creating a new connection in a local method right around the call to SubmitChanges() but it behaved the same.
Below is the console output from adding the record and then updating it (two calls to SubmitChanges() )
WHERE ([Milestone_Key] = @p0) AND ([MilestoneType_Key] = @p1) AND ([Inspection_Key] = @p2) AND ([MilestoneDate] = @p3) AND ([RowVersion] IS NULL) AND ([ModifiedOn] = @p4) AND ([ModifiedBy_Key] = @p5) AND ([CreationDate] = @p6)
That is a SqlException I got at a... at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader() Anyone an idea what THAT means? How do I cause it? How can I work around it?
I have a stored procedure 'ChangeUser' in which there is a call to another stored procedure 'LogChange'. The transaction is started in 'ChangeUser'. and the last statement in the transaction is 'EXEC LogChange @p1, @p2'. My questions is if it would be correct to check in 'LogChange' the following about this transaction: 'IF @@trancount >0 BEGIN Rollback tran' END Else BEGIN Commit END. Any help on this would be appreciated.
When i am connecting Report Manager report through our ASP.NET 2.0 application using Report Viewer control frequently we get message ASP.Net Session expired .
How can we avoid this error.While i directly opens Reports through the Report Manager reports are opening without any problem.
My .Net application Code. ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://SERVER/reportserver"); ReportViewer1.ServerReport.ReportPath = @"/myreport/reportname";
Hai, I'm having Windows XP SP2 version and I have installed SQL server 2005. Whenever I'm opening SQL server management studio in Windows Authentication Mode I get a pop message indicating that "SSPI context error message". What may be the problem and how to sort it out?
Hai, I usually connect SQL Server 2005 using Windows authentication mode (trusted connection). I have one server to which four client machines are connected and all the clients are windows XP SP2. The SQL Server 2005 I have installed is Standard Edition. When I'm connecting I get a pop message indicating that "SSPI context error message". I have seen the Troubleshooting Article ID : 811889. I was'nt able to resolve it. What may be the problem and how to sort it out ?
I usually connect SQL Server 2005 using Windows authentication mode (trusted connection). I have one server to which four client machines are connected and all the clients are windows XP SP2. The SQL Server 2005 I have installed is Standard Edition. When I'm connecting I get a pop message indicating that "SSPI context error message". I have seen the Troubleshooting Article ID : 811889. I was'nt able to resolve it. What may be the problem and how to sort it out ?
I am executing a package programmatically from ASP.NET using C#. The package is being loaded from SQL Server at runtime and then it is executed from a custom class written in C#.
Problem:
When a task fails, I'd like information on why it failed. I read about implemeting the IDTSEvents interface as a way to have my package call back to code. This works fine (I have code in the OnTaskFailed event handler), but I'm not sure how to find out why a task failed. Since my task is loading a flat file to SQL Server, failure will likely come in one of two flavors: either the file format will be wrong or the data will violate a database constraint. In etiher case, I'd like that feedback. I am looking that the TaskHost object that gets passed to my event handler and I haven't figured out how to access this information. Am I going about this the right way? If yes, how do I access the error information I am looking for?
hi guys , does anyone of you have a good solution on the Error 1413: Communications to the remote server instance failed before database mirroring was fully started issue?
I downloaded a copy of sql server and when I run the following query in the sql management studio after choosing new query , DMX I get the above error
CREATE MINING MODEL [NBSample]
(
CustomerKey LONG KEY,
Gender TEXT DISCRETE,
[Number Cars Owned] LONG DISCRETE,
[Bike Buyer] LONG DISCRETE PREDICT
)
Using Microsoft_Naive_Bayes
Also in the pane Mining Model I get the message No mining models found. The only error I get when I installed SQL server was a COM plus registration error. I am running Windows XP SP2. Can someone please help.
hi, While trying to connect to SQLSever 2000 or SQLSever 2005 from a vb.net application , a user is getting the error "Cannot generate SSPI context" while other users can still connect to the server. and moreover, this user were able to connect before. and if he restarts his computer, then try to connect after a lap of time, it will connect. but if he waits and opens other applications,and then tries to open the application,it will not work.
I have an ASP.Net (C# 2.0) application that has been using SQL Server 2005 Standard Edition with Service Pack 1 to hold the session state in a testing environment. Currently, the session state is being stored in TempDB, rather than the ASPState database. This has worked very well for us until yesterday. We installed SQL Server 2005 Service Pack 2, as well as the Critical Update for Service Pack 2 (KB933508). Once the SQL server was rebooted, I got the following error message when I tried to access the web application. The SELECT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.The SELECT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'.The INSERT permission was denied on the object 'ASPStateTempApplications', database 'tempdb', schema 'dbo'. In the web.config file for the application, I have a SQL username and password defined that can access the ASPState database. To correct this issue, I had to give this user db_datareader and db_datawriter access to tempDB.
Has anyone else run across this problem, and is it related to SQL Server 2005 Service Pack 2?
I have one drop and create procedure script in one sql session and execute the procedure in other session. Now when i am compiling the procedure in first session, it gets completed successfully.
Now when i move to other session and try to execute the procedure, it gives me error saying :
"Invalid column name 'ColumnName'."
Now when I execute the procedure in same session in which procedure was compiled, it runs successfully. Once run, I go back to my other session and it runs again.
I regularly (every month or so) get the error "The target principle name is incorrect. Cannot generate SSPI context" when trying to remotely connect to my SQL 2012 instance. The SQL service is running using a managed service account. I understand this error can occur when the service account cannot authenticate with AD properly. Looking at the properties of the managed service account, the password for the account was automatically changed this morning - just when the error started.
Hi, i am using Vista and iis6. Evertything seems to be configured ok, but when i try to open this url: http://localhost/Reports/ i get the following error:
Server Error in '/Reports' Application.
Request is not available in this context this error is when Report directory is set for "DefaultAppPool", but in "ClassicAppPool" i get another error:
Error
The attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
We are running SQL2K5 and have a Web server with a family of sites all sharing an identical connection string to enable ADO connection pooling between them. Today for about 20 minutes we had several (all?) connections from one site that uses a specific DB get a connection reuse error which showed in out SQL logs:
DESCRIPTION: The client was unable to reuse a session with SPID #, which had been reset for conection pooling. This error may have been caused by an earlier operation failing. Check the error logs for failed operations immediately before this error message.
We also have SQL Server slowdown and log in problems from other applications that seemed a symptom of this, or some third unknown cause. Note, the # means the run-time spid number was inserted. The misspelling "conection" comes right out of sys.messages (it is not our custom error):
select top 10 * from sys.messages where message_id = 18056
The immediately preceeding error in the SQL Log was always: Message Error: 18056, Severity: 20, State: 29.
Where Severity and State vary, but "Error: 18056" is consistent, although I can find no documentation on "Error: 18056" through Google or MSDN.
Also, the "The client was unable to reuse a session ..." error seems not to be referred to anywhere.
In our IIS logs, the matching entries are of the form:
[DBNETLIB][ConnectionRead (recv()).]General network error. Check your network documentation.
and
Invalid connection string attribute
My questions: Does anyone have experience with this error? We have real good history with ADO connection pooling, but can a "bad" connection be pooled, and if so can it be "flushed" or the pool "drained"?