DTC - Transaction Context In Use By Another Session
May 5, 2006
Hi
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.
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.
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 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'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.
The 2.0 version of ASPSTATE is slightly different than the 1.1 version in that one table has one additional column and another table uses a different data type and size for the key. The 2.0 version also has a couple additional stored procedures.
We'd like to manage just one session state database if possible so we're trying to figure out if Microsoft supports using the new schema for 1.1 session state access (it seems to work, but our testing has been very light).
Is there any official support line on this? If not, can anyone comment on whether or not you'd expect it to work and why?
I need some solution.. When i execute a program it first deletes all datas from a 'X' table .Then fetches data from various other tables and inserts into this 'X' table.I finally generate a report from this 'X' table.
Now the problem is, USER 1 : Executes the program - Datas in 'X' table got deleted and filled up with new data.Report is getting processed..... USER 2 : Executes the same program - Datas in the same 'X' table getting deleted .. So the report process of USER 1 got affected.
Solution 1 : Using IP address of local machine i solved the problem.But i need a concrete solution for this ..something related to sessions..
How do you return the ID of an item to a Session in a ASP forum? I have a MS-SQL Server 2005 database. My table looks like this QuoteID, QuoteNumber, Date. In SQL: INSERT INTO table (QuoteNumber, Date) values ('123490WC1", '06/2/2008')DECLARE @ItemID INTSET @ItemID=IDENT_CURRENT('table') What I would like to do is return @ItemID to the ASP forum; I assume Session would be the best. After I get the @ItemID I have a Grid which I will to insert the Quote Items into. Thanks, marly
Hi, Can somebody tell me what's wrong with this statement or why the Session parameter is not working. <asp:SqlDataSource ID="datalist_SQL" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString2 %>" SelectCommand="SELECT * FROM tbl_subProduct, tbl_material, tbl_product, tbl_subCategory, tbl_topCategory, tbl_topLevelProduct WHERE [tbl_subProduct].[numProductID] = [tbl_product].[numProductID] AND [tbl_product].[numTopLevelProductID] = [tbl_topLevelProduct].[numTopLevelProductID] AND [tbl_topLevelProduct].[numSubCategoryID] = [tbl_subCategory].[numSubCategoryID] AND [tbl_subCategory].[numTopCategoryID] = [tbl_topCategory].[numTopCategoryID] AND [tbl_material].[numMaterialID] = [tbl_product].[numMaterialID] AND @fldArray "> <SelectParameters> <asp:SessionParameter Name="fldArray" SessionField="ids_array" Type="Int32" /> </SelectParameters> </asp:SqlDataSource> Many Thanks
Hi... I'm developing a web app with VS 2005 Beta and I do not know how to include a seasson variable value into my code.
This is my code:
Function GetData() As System.Data.SqlClient.SqlDataReader Dim sqlconn As System.Data.SqlClient.SqlConnection Dim SqlCommand1 As System.Data.SqlClient.SqlCommand Dim sqlRdr As System.Data.SqlClient.SqlDataReader sqlconn = New SqlConnection("SERVER=SRVR;UID=USR;Password=PWD;DATABASE=MyDatabase") sqlconn.Open() SqlCommand1 = New SqlCommand("MyStrProc", sqlconn) SqlCommand1.CommandTimeout = 1800 sqlRdr = SqlCommand1.ExecuteReader(CommandBehavior.CloseConnection) Return sqlRdr End Function
MyStrProc is:
CREATE PROCEDURE MyStrProc @MyVar int AS IF @MyVar IS NOT NULL BEGIN ................. ......t12.acct_nbr IN (@MyVar) ..... END GO
The variable @MyVar get its value from user log info in login page, and create a session variable.
My Question:
How and where to call seasson variable @MyVar, because now I'm getting this error: Procedure 'MyStrProc' expects parameter '@MyVar', which was not supplied.
I'm new on ASP.NET 2.0Can anyone tell me how to get data from SQL to Session properties? In Classic ASP, it looks very simple as below.dim connset conn = server.createobject("adodb.recordset")rssql = "select myid, mypw from mydb where myid = '"& request("myid") &"' and mypw = '"& request("mypw") &"'"set rs = conn.execute(rssql)if rs.eof = true thensession("myid") = rs("myid")session("mypw") = rs("mypw")end if How to do the same things on ASP.NET?Many thanks!
I want to open a new session/connection inside the execution of a stored procedure. Is this possible ? I ask this because I need a new sesssion with its own transaction.
Can we use session variable in reporting services.. say go to report -> properties and create a VB function that get ans set session variable.. If yes, how. If not, any workaround?
I have designed reports using SQL Server Business Intelligence Development Studio tool (Sql Server reporting service). I have uploaded these reports to report manager.
I am displaying list of reports in tree view control, in my application. I am viewing report in Report Viewer control as per the report selection in tree view control, in same page. I am getting
Server Error in '/Application_name' Application or ASP.NET session has expired error frequently while switching between various reports. Kindly provide me solution
Hi, I need to build up dynamically cursor and fetch variables in a script. I use exec(@sql) to declare the cursor and my hope was I could use the same method for doing the fetch. Unfortunately I run into a
SET @sql ='DECLARE C1 CURSOR FOR SELECT * FROM OPENROWSET(' + @apo+@int_provider_name+@apo+ ',' + @apo+@int_provider_string+@apo + ',' + @apo+@int_query_string+@apo + ') FOR READ ONLY' PRINT @sql EXEC(@SQL)
OPEN c1
set @fetch = 'FETCH c1 INTO '+@int_fetch print @fetch EXEC (@fetch)
... snippet
Output: DECLARE C1 CURSOR FOR SELECT * FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:work2007schenker.xls','SELECT * FROM [Datei$]') FOR READ ONLY
FETCH c1 INTO @c1,@c2,@c3,@c4,@c5,@c6,@c7,@c8,@c9,@c10,@c11,@c12,@c13,@c14,@c15,@c16,@c17,@c18,@c19,@c20,@c21,@c22,@c23,@c24
Msg 137, Level 15, State 2, Line 1 Must declare the scalar variable "@c1".
How can I declare the dynamically built 'fetch into' variables (@c1 etc.) so they are in the context of dynamic sql ?
Hi,I am having a SQL Server 2005 problem with my Insert statement. I amsending a command via my website to my database. It comes up with anerror I'll put below. The code is here:"INSERT INTO tblUsers (userName) VALUES ( userNameTest)"This is the error I get:The name "userNameTest" is not permitted in this context. Validexpressions are constants, constant expressions, and (in some contexts)variables. Column names are not permitted.Now, userName is a varchar field in the database. What is wrong?Kivak