SQL 2005 Distributed Transactions From WCF

Jan 22, 2008



Hello,

I've been redirected here from the Transaction Programming forum becuase I have e peculiar issue with SQL 2005 running INSERT stored procs from multiple WCF services all withing a TransactionScope.

The original post is http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2720665&SiteID=1&mode=1

The story goes, I have SRVC A with starts a TransactionScope which in turn calls SRVC B & C in sequence based on processing rules.

SRVC A is a Sequential Workflow which Starts and Completes the TransactionScope
SRVC B Creates a new Customer into the database
SRVC C Creates new Accounts for that Customer and Initialises the accounts with funds


The DB Tables underneath are Customer, Account and AccountLog

DDL




Code Block
CREATE TABLE [Member].[Customers](

[CustomerId] [int] IDENTITY(1,1) NOT NULL,
[Name] [varchar](32) NOT NULL,
[CreatedUtc] [datetime] NOT NULL ,


CONSTRAINT [PK_Customer] PRIMARY KEY CLUSTERED
(

[CustomerId] ASC
)

CREATE TABLE [Bank].[Accounts](

[AccountId] [int] IDENTITY(1,1) NOT NULL,
[CustomerId] [int] NOT NULL,
[CurrentBalance] [money] NOT NULL,
[LastUpdateDate] [datetime] NULL,
[CreatedDate] [datetime] NOT NULL,
[timestamp] [timestamp] NOT NULL,
CONSTRAINT [PK_Bank_Account] PRIMARY KEY CLUSTERED
(

[AccountId] ASC
)

) ON [PRIMARY]
GO
ALTER TABLE [Bank].[Accounts] WITH CHECK ADD CONSTRAINT [FK_Account_Customer] FOREIGN KEY([CustomerId])
REFERENCES [Member].[Customers] ([CustomerId])

CREATE TABLE [Bank].[AccountLog](

[AccountLogId] [int] IDENTITY(1,1) NOT NULL,
[AccountId] [int] NOT NULL,
[Amount] [money] NOT NULL,
[UtcDate] [datetime] NOT NULL,
CONSTRAINT [PK_Bank_AccountLog] PRIMARY KEY CLUSTERED
(

[AccountLogId] ASC
)
) ON [PRIMARY]
GO
ALTER TABLE [Bank].[AccountLog] WITH CHECK ADD CONSTRAINT [FK_AccountLog_Account] FOREIGN KEY([AccountId])
REFERENCES [Bank].[Accounts] ([AccountId])






NB. I've removed most fields not essential for this example.

So from SRVC A I invoke SRVC B and the Customer is created, however when I get to SRVC C and the accounts are to be created I get a lock. Only when the Transaction aborts due to timeout, do I see in SQL Profiler that the call to the SP that created the Account is executed but eventually rolls back as it is part of the distributed transaction.

Now, If I set the Isolation level in the TransactionScope to ReadUncommitted (urgh) the problem remains. When I set the IsolationLevel to Read Uncommitted in the SP that creates the account the problem remains but when I remove the FK constraint the problem disappers. The other curious thing is that with the Customer -> Account FK removed and when SRVC C calls to insert funds into the AccountLog which also updates an aggregated total in the Account from within the same transaction scope and with Account -> AccountLog FK constraints in place there is no locking even with Isolation Serializable.

I'm quite at a loss as to what could be causing these issues. If anyone has any suggestions I would greatly appreciate any help.

Thanks

Andy

View 1 Replies


ADVERTISEMENT

SQL 2005 Service Pack 2 Distributed Transactions And Mirroring

Jun 4, 2007

Is it possible to use DTC (or cross database queries) with mirroring on SQL 2005 Service Pack 2?



Thnx,

GoranP

View 2 Replies View Related

How To Distributed Transactions

May 6, 2004

Hello,

does the .NET framework support distributed transactions somehow?

The SqlConnection/SqlTransaction classes doesn't seem to support them...

TIA. -julio

View 2 Replies View Related

Distributed Transactions

May 24, 2001

Hi to everyone!
Any experience handling a Store Procedure that has distribution transactions?
Here is a story.

We have a store procedure #1 that inserts or updates data in two tables A and B on SQL Server 7.0 then it calls another store procedure #2 that:
1. updates C table in the same database on SQL Server from Oracle Server
2. deletes that record on Oracle Server
3. inserts a record on Oracle from table A
4. inserts the same record into table D on SQL Server from Oracle Server.

People who wrote store procedure #1 put Commit Tran before executing #2.
The questions are:
1. Is it correct that we don't have Commit Tran for #2?
2. What do you think about Nested Begin - Commit Tran?

Any help is highly appreciated.
Sima

View 2 Replies View Related

Distributed Transactions

Aug 3, 1998

Does SQL Server actually support distributed transactions over, say, two tables in different databases but that reside on the same server? When I try to execute such a transaction in which one part of the transaction violates referential integrity and hence should not be executed, causing the rest of the transaction to, supposedly, rollback, the transaction does not roll back but instead produces an error message and executes the second, valid half of the transaction anyway.
Any help or suggestions gratefully accepted.

View 1 Replies View Related

Distributed Transactions ?

Mar 27, 2006

Hi There

I realize this is probably a basic question or at least i hope so but i cannot get distributed transactions working.

BOL is just driving me in circles.
I am running SS2000, MSDTC is up and running on the server.

I have added a trigger to a table where on insert or update the triggers fires and inserts a row to a remote server.

When i execute the update or insert i get the error:
Cannot start a distributed transaction.

I have tried stating BEGIN DISTRIBUTED TRANSACTION before the update but i get the same error, i have also read up on SET REMOTE_PROC_TRANSACTIONS, but this is not a remote sp.

Can anyone please reccomend a good link as to how to get distributed transactions to work.

Thanx

View 3 Replies View Related

Heterogeneous Distributed Transactions.

Dec 12, 2001

I am using SQL server 7.0 and i have created oracle8i linked server(Using MSDAORA as provider) in it.
When i run distributed queries between SQl server and Oracle server it works fine.But when i try to run distributed transaction between two servers ( BEGIN DISTRIBUTED TRANSACTION..)it reports an error saying Distributed transactions are not supported by MSDAORA.

My question is; is it possible to run distributed transaction between SQL server and oracle server (where oracle server is a linked server in my SQL server)?


Actually i want to run this transaction in DTS package which updates and transfers data amongst various servers.


Thanx


Regards,

Rahul

View 1 Replies View Related

Distributed Transactions In SQL 2000

Nov 10, 2004

We just upgraded from SQL 7 to 2000 and for some reason I am unable to perform distributed transactions. I keep getting the following error:

OLE DB error trace [OLE/DB Provider 'MSDASQL' ITransaction Join:: JoinTransaction returned 0x8004d00a]. Operation could not be performed because the OLE DB provider 'MSDASQL' was unable to begin a distributed transaction

I tried a few of the fixes recommended on the microsoft website but they did not solve the problem. We are still using the same O/S (Windows 2000 Pro), so the only thing that has changed is the server.

Any help would be appreciated.

View 6 Replies View Related

Oracle Distributed Transactions

Nov 5, 2001

I am attempting to update an oracle table from a insert trigger on my SQL table. When using a trigger to run a sql command against the ole db oracle client (linked server) a distributed transaction is initiated and i get a message stating. "The operation could not be performed because the OLE DB provider 'MSDAORA' was unable to begin a distributed transaction."

I can update the oracle table through a query however just not throught a distributed transaction.

However according to all the documentation i can find it states that I should be able to perform this.

Can anyone shed any insight?

View 4 Replies View Related

Distributed Transactions Between Servers On Different VLANs

Oct 18, 2006

Hi there,

I have two SQL servers, SERVERA and SERVERB. They are on two different VLAN's within our corporate network. They are physically only about 5 feet apart. SERVERA is SQL2005 while SERVERB is SQL2000. I am running a distruted transaction as a result of an insert on SERVERA which then causes a Stored procedure stored on SERVERA to insert a record on a table on SERVERB. I know my syntax is correct, 'cause I can get the Process to work between two servers (one SQL2000 and the other SQL2005) on the same VLAN. But when I run it in the problem environment, I get the following error message:

SQL Execution Error

Executed SQL Statement: INSERT INTO Tablea(recordid, recordtext) values(3, 'Testagain')

Error source: .Net SQLClient Data Provider

Error Message: The operation could not be performed because OLE DB provider "SQLNCL1" for linked server "SERVERB" was unable to being a distributed transaction.



I have checked to make sure that MSDTC is running and it is on both servers.

Any help would be greatly appreciated. Thanks! - Eric-



View 5 Replies View Related

Distributed Transactions Between SQL2005 And SQL2000

Oct 17, 2006

Hi there,

We have two servers, one (we'll call 'SERVERA') has SQL2005 running on it. The second (we'll call 'YELLOWSTEONE') is running both SQL2000 and SQL2005 on it. The SQL instances on YELLOWSTONE are 'YELLOWSTONESQL2000' and 'YELLOWSTONESQL2005'. As a linked server, I have an entry for YELLOWSTONE which then links to the SQL Server of YELLOWSTONESQL2000 on the server network name of YELLOWSTONE. By them selves they seem to run fine. However, if I have trigger that Runs on SERVERA to do a distributed transaction on 'YELLOWSTONESQL2000', I get the following error:

OLE DB provider "SQLNCLI" for linked server "YELLOWSTONE" returned message "Login timeout expired".

OLE DB provider "SQLNCLI" for linked server "YELLOWSTONE" returned message "An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.".

Msg 2, Level 16, State 1, Line 0

Named Pipes Provider: Could not open a connection to SQL Server [2].

If You can provide me any assistance, I would greatly appreciate it. Thanks! - Eric -

View 1 Replies View Related

Managing Distributed Transactions With ADO.NET 2.0 Using TransactionScope Gives Error Message

Nov 14, 2007

 Hi, I am working  on vs2005 with sql server 2000. I  have used TransactionScope class. Example Reference: http://www.c-sharpcorner.com/UploadFile/mosessaur/TransactionScope04142006103850AM/TransactionScope.aspx   The code is given below.  using System.Transactions;   protected void Page_Load(object sender, EventArgs e)    {  System.Transactions.TransactionOptions transOption = new System.Transactions.TransactionOptions();         transOption.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;         transOption.Timeout = new TimeSpan(0, 2, 0);         using (System.Transactions.TransactionScope tranScope = new System.Transactions.TransactionScope(TransactionScopeOption.Required,transOption))         {            using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["nwConnString"].ConnectionString))            {                int i;                con.Open();                SqlCommand cmd = new SqlCommand("update products set unitsinstock=100 where productid=1", con);                i = cmd.ExecuteNonQuery();                if (i > 0)                {                    using (SqlConnection conInner = new SqlConnection(ConfigurationManager.ConnectionStrings["pubsConnString"].ConnectionString))                    {                        conInner.Open();                        SqlCommand cmdInner = new SqlCommand("update Salary set sal=5000 where eno=1", conInner);                        i = cmdInner.ExecuteNonQuery();                        if (i > 0)                        {                            tranScope.Complete(); // this statement commits the executed query.                        }                    }                }            }            //  Dispose TransactionScope object, to commit or rollback transaction.        } } It gives error like
 "The partner transaction manager has disabled its support for remote/network transactions. (Exception from HRESULT: 0x8004D025)" The database I have used is northwind database and pubs database which is by default in sql server 2000. So, Kindly let me know how to proceed further.  Thanks in advance,Arun. 

View 1 Replies View Related

SQL 2012 :: Transaction Isolation Level And Distributed Transactions

Mar 5, 2015

I vaguely remember reading somewhere that all distributed transactions are executed at Serializable Isolation Level "under the covers."

1. Is this true?
2. What does "under the covers" mean in this case; i.e. will I not see the isolation level represented accurately in requests?

View 9 Replies View Related

Distributed Transactions With Multiple Instances Of Microsoft SQL Server

Jul 23, 2005

Hi,I'm having a problem running a distributed transaction between twolinked servers that both have multiple instances of SQL Serverinstalled on them. This is the error message that I receive:"The operation could not be performed because the OLE DB provider'SQLOLEDB' was unable to begin a distributed transaction.[OLE/DB provider returned message: New transaction cannot enlist in thespecified transaction coordinator. ]OLE DB error trace [OLE/DB Provider 'SQLOLEDB'ITransactionJoin::JoinTransaction returned 0x8004d00a]."The query follows the format:"BEGIN DISTRIBUTED TRANUPDATE [LINKEDSERVER1INSTANCE_NAME].DB.OWNER.TABLENAMESET fieldname = alias2.fieldnameFROM tablename alias2JOIN [LINKEDSERVER1INSTANCE_NAME].DB.OWNER.TABLENAME alias1on alias2.urn=alias1,urn"[color=blue]>From what I can gather from various sources the SQL Server must be[/color]named the same as the computer which it is installed on. However, if Ihave two instances of SQL Server, they cannot both be named the same asthe computer. Does anyone know of a way around this or whether I'mbarking up the wrong tree completely?Many thanks.

View 2 Replies View Related

Seeking Testing Volunteers W2K MTS/DTC To VMS DECdtm Distributed 2PC Transactions

Jul 20, 2005

Hi,I am seeking the help of volunteers to test some software that I'vedeveloped which facilitates distributed two-phase commit transactions,encompassing any resource manager (e.g. SQL/Server or Oracle) controlled byMicrosoft's Distributed Transaction Coordinator in a Windows2000environment, with any resource manager under the control of DECdtm (e.g. Rdb(or Oracle via the XA Veneer)) in a VMS environment.[Yes, at some stage, I hope to sell this software and make money out of it,so unless you have a large philanthropic streak or are simply a techie wholikes to stay on top of Windows<->VMS connectivity issues, then you may wishto look away now. But if you do choose to participate, then rest assuredthat I have no interest in your personal or company details. (Just yourwork-rate :-)]What differentiates my Transaction Manager software from existingTransaction Monitor packages that are already in the marketplace (and whyyou should be interested) is that it is based on the Transaction InternetProtocol TIP standard. (RFC 2372) For those of you who don't know, thebeauty of TIP's "Two-Pipe" strategy is it's application-pipe (or middleware)neutrality. Whereas most XA implementations mandate homogenous TransactionMonitor deployments (such as Tuxedo everywhere, Encina everywhere, MQSerieseverywhere, ACMSxp everywhere and so on . . .), hotTIP from TIER3 Softwaregives you complete freedom to choose the middleware product(s) that bestsuite your particular application and heterogeneous network needs.Would you like to talk to VMS with TIER3 Sockets, COM or DCE/RPC? BEAMessageQ, IBM MQSeries or HTML? The choice is yours and yours alone. Butonce you realize that you need to encase your critical transactions withinthe ACID properties of a true Heterogeneous Two-Phase Commit then you willcome to the conclusion that you need a Transaction Manager that looks a lotlike this.Another drawback of traditional "One-Pipe" strategies is that they precludethe run-time determination of transaction participants. (Functionalitywhich may be advantageous in a wide-area or Internet based application.)Anyway, this is what I have: -On the Windows side, you need absolutely *NO* additional software! I'llreply to this note with a brief description of the COM+ and DTC functionsthat you would need to invoke in order to successfully push a MTS/DTCtransaction to VMS. NB: These are standard Windows APIs that are fullydocumented on MSDN.On the VMS side, I have a VMSINSTAL saveset that (all zipped up) is some150KB that I'm happy to e-mail to you along similar lines to the VMShobbyists (non-commercial use) license. I'll reply to this note with anInternet Daemon (INETd) example of code that uses my software to cedetransactional control, over an SQL insert into a Rdb database, to MTS/DTC.It's under 500 lines long and contains all of the DCL, 3GL, SQL required toproduce a working example of a TIP-2PC capable TCP/IP auxiliary server. Thisexample will insert a row into the MF_PERSONNEL.Employees table on the VMSside in co-operation with Windows2000 MTS/DTC client that is inserting a rowinto the NORTHWIND.Employee table. Commit them all or roll them all back.So, in summary, If you'd like to volunteer to put hotTIP through it's pacesthen simply reply to this mail.Regards Richard MaherPS. The following are a few functionality restrictions with the currentversion of my software that may effect your decision to participate: -1) Transaction has to be started/mastered/coordinated by W2K MTS/DTC2) Transactions cannot be PULLed from VMS and must be PUSHed from W2K3) No cluster-wide recovery.(If a txn falls over after being prepared then you have to wait for thatspecific node to become contactable again even though that lovely RDMrecovery job is sitting on another node protecting the database until myhotTIP TM tells it to commit or abort.)4) There is currently no Alpha or Itanium version available. The Alpha portis currently in progress but, for the time being, you'll either need a VAXor a VAX emulator on your PC.

View 7 Replies View Related

DB Engine :: Distributed Transactions Fail On Linked Server

Feb 12, 2009

We get the below error while performing a distributed transaction on linked server. We have several linked servers configured in the source server and all of them succeed with the distributed transaction except on one.
 
We did all the basic troubleshooting and moreover the distributed transactions work fine if we use a remote server instead.

Error:
OLE DB provider "SQLNCLI10" for linked server "SERVERNAME.REDMOND.CORP.MICROSOFT.COM" returned message "No transaction is active.".
Msg 7391, Level 16, State 2, Line 3
The operation could not be performed because OLE DB provider "SQLNCLI10" for linked server "SERVERNAME.REDMOND.CORP.MICROSOFT.COM" was unable to begin a distributed transaction.
 
 Test code:
begin distributed transaction
select top 10 * from [SERVERNAME.REDMOND.CORP.MICROSOFT.COM].master.sys.objects
 ROLLBACK
 
Source server :   
Microsoft SQL Server 2008 (RTM) - 10.0.1779.0 (X64)
       Nov 12 2008 12:10:04
       Copyright (c) 1988-2008 Microsoft Corporation
       Enterprise Edition (64-bit) on Windows NT 6.0 <X64> (Build 6001: Service Pack 1) (VM)
 
Target server :   
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86)
       Jul  9 2008 14:43:34
       Copyright (c) 1988-2008 Microsoft Corporation
       Enterprise Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2)

View 30 Replies View Related

SQL 2012 :: Enable Promotion Of Distributed Transactions For RPC - Set To TRUE Or FALSE

May 14, 2015

It is my understanding that when having LinkedServers, the option "enable promotion of Distributed Transactions for RPC" should be set to TRUE, so we can rollback , if needed, remote transactions. At least, that's my understanding of that setting.

Having said that, the TRUE setting is affecting this particular TSQL code, inside an sproc, which I would prefer not to alter:

Insert into #TempTable
EXEC ServerB.MyDatabase.MyStoreProcedure
@param1= '',
@param2= ''
When set is set to TRUE (current setting) I get this error:

OLE DB provider "SQLNCLI11" for linked server "ServerB" returned message "The partner transaction manager has disabled its support for remote/network transactions.".
Msg 7391, Level 16, State 2, Line 28

The operation could not be performed because OLE DB provider "SQLNCLI11" for linked server "ServerB" was unable to begin a distributed transaction.

... when set to off, the error goes away.

View 8 Replies View Related

Problem With Distributed Transactions - Multiple Threads Pop The Same Message From Queue

Aug 14, 2007

Hi,

I am using distributed transactions where in I start a TransactionScope in BLL and receive data from service broker queue in DAL, perform various actions in BLL and DAL and if everything is ok call TransactionScope.Commit().

I have a problem where in if i run multiple instances of the same app ( each app creates one thread ), the threads pop out the same message and I get a deadlock upon commit.

My dequeue SP is as follows:

CREATE PROC [dbo].[queue_dequeue]
@entryId int OUTPUT
AS
BEGIN
DECLARE @conversationHandle UNIQUEIDENTIFIER;
DECLARE @messageTypeName SYSNAME;
DECLARE @conversationGroupId UNIQUEIDENTIFIER;

GET CONVERSATION GROUP @conversationGroupId FROM ProcessingQueue;
if (@conversationGroupId is not null)
BEGIN
RECEIVE TOP(1) @entryId = CONVERT(INT, [message_body]), @conversationHandle = [conversation_handle], @messageTypeName = [message_type_name] FROM ProcessingQueue WHERE conversation_group_id=@conversationGroupId
END

if @messageTypeName in
(
'http://schemas.microsoft.com/SQL/ServiceBroker/EndDialog',
'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
)
begin
end conversation @conversationHandle;
end
END

Can anyone explain to me why the threads are able to pop the same message ? I thought service broker made sure this cannot happen?

View 11 Replies View Related

Problem With Distributed Trans 2000 To 2005

Apr 13, 2007

I have a test environment setup consisiting of one SQL Server 2000 32 bit instance on one box and one SQL Server 2005 64 bit edtion on another box. Nearly everything works fine but have found this one snag...

Linked Server name: SQL2005

From the SQL Server 2000 instance in Query Analyzer....

-- this works fine
Delete from [SQL2005].myDB.dbo.myTbl

-- this just hangs
Begin Tran
Delete from [SQL2005].myDB.dbo.myTbl

It doesn't make any difference what provider I use on the Linked Server.

I have tried it on a SQL Server 2000 to SQL Server 2000 configuration and, interestingly, it would only work if I used set XACT_ABORT ON. However, in the SQL Server 2000 to 2005 configuration, this doesn't help.

We have a number of DTS packages that do deletes across the linked server that are failing due to this issue so we're being stopped from continuing with the migration to SQL Server 2005.

Any suggestions?

Cilve

View 2 Replies View Related

Distributed Transaction Between 2005 &&amp; 2000 Failing

Sep 19, 2007



Hi Folks,



I have been struggling with a problem for the last couple days now regarding MSTD and distributed transactions. The main issue is that 3 servers are each sitting in a different domain. Non of the domains trust each other.

As of yesterday, I could get all the SQL 2005 chatting to each other using MSDTC without a problem. However, I have a SQL 2000 box which refuses to work. A normal query across a linked server works fine. A distributed transaction will not work. This is the case from A to B and B to A.

I have tested with DTCPing and it says all is ok.



The error messages are:

SQL 2000 > SQL 2005

OLE DB provider "SQLNCLI" for linked server "T-ServerTServer" returned message "No transaction is active.".

Msg 7391, Level 16, State 2, Line 2

The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "T-ServerTServer" was unable to begin a distributed transaction.

And the other way round:

[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]

OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].

Msg 7391, Level 16, State 1, Line 2

The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.

If watching the DTC monitor, it shows an active transaction then goes back to 0.

All instances are on a 4 node cluster with 3 nodes turned off for the testing.

I have run out of things to try. Most of the symptoms for the above messages are to do with DTC security, the Turn RPC Security Off reg hack. All instances and OS (W2K3) are the latest updates / patches.

As for the 3rd server, SQL 2005, it is happy to talk

Anybody got a gem which I can try?

Edit: Both SQL 2005 servers are x64 while the 2000 is x86




Cheers,
Crispin

View 3 Replies View Related

Can I : Set Up A Distributed Database System By Sql Server 2005 Express?

Oct 24, 2007

Hi, I am zeronet. I decide to set up our own web system application just like Ebay. Because of the low investment, I want to select a free DB for our data storage. For high performance, we want to set up a distributed db system. As a beginner of SQL server 2005 express, we want to know: if the SQL-server-2005-express has that ability to manage large amout data and to do with this work? I am eager to hear of your advice.
Thanks.
yours
zeronet

View 6 Replies View Related

Microsoft Distributed Blank CDs For Sqlserver 2005 And MSDN Library At Launch??

Dec 28, 2005

The SQL SERver 2005 Standard Edidtion install CD and the MSDN CD distributedat the SQLServer Launch in Chicago are blank. Has anyone else had thisproblem and or requested replacements? If so, how.thanks muchMo

View 1 Replies View Related

How Can I Make Log Transactions Using SQL 2005

May 4, 2008

Hi all,
I am have database consist of 10 tables, I want to make log transactions for this tables, So any act happened on these tables, such as adding or modifying or deleting record, I want to put this information somewhere in the database, to determine the user who has done such acts on these tables.

I would high appreciate for any assistant.

View 7 Replies View Related

SQL Server 2005 - Transactions

Jan 24, 2007

Hello guys!

I am working with SQL Server 2005 a few months, and i need your help about transactions topic.

In first, i hope you are patient with my english, i will try to explain it the best i can ;-)) and now... my question and thanks you in advance.

I am trying to set the transaction option of a foreach loop container task in run time using the Expressions option. There, I have configured the transaction option of this task with a variable value (var type int) and this variable is informed at the beginning of my dts using a script task (values: 0 for Not Supported, 1 for Supported, 2 for Required).

The problem is the transaction option gets the variable value but... the variable value by default. After, during the dts execution, the variable gets the new value but not the transaction option.

In summary, my question is ... is it possible to set the transaction option during the run time?.

Thanks for your help!

Chris.

View 7 Replies View Related

DAO, ADO Transactions With SQL Server 2005 Using Vb6

Mar 19, 2007

I have a million plus line program that uses DAO and JET/Access databases. We are modifying the code so that it will work with BOTH JET and SQL Server databases with an eye to moving to just SQL Server eventually.
Much of the code works just fine without change when using DAO and SQL server as 90+ percent of the code is accessing data READ-ONLY. (Jet's ODBC capability is used)

There are however some transactions that will not work.
When I examine the SQL Trace, I notice that after the transaction has begun, the SPID has changed. This happens often when cursors are used, BUT happens even if the only activity after a DBEngine.BeginTrans is issued DO NOT USE CURSORS as in the following code:
DBEngine.BeginTrans
strSQL = "INSERT INTO [TestTable] (MyKey,MyData, MyData2) VALUES (1,'apple','fruit')"
DB1.Execute strSQL
strSQL = "UPDATE [TestTable] SET [MyData] = 'apple2' WHERE [MyKey] = 1"
DB1.Execute strSQL
DBEngine.Committrans

The second DB1.Execute times out: [Microsoft][ODBC SQL Server Driver]Timeout expired
The trace shows a new SPID is opened when the UPDATE query is executed. A new SPID is spawned and the JET engine is sending an SELECT SQL to get the value for the MyKey:

SELECT "dbo"."TestTable"."MyKey" FROM "dbo"."TestTable" WHERE ("MyKey" = 1 )

The second SQL statement is waiting for the first one that is being done in a transaction to be completed. The program is expecting that both of these will be being done on the SAME SPID or at least the same transaction scope.
So, since I have no way of knowing how and when a new SPID will be spawned using DAO, we are not going to use it for when we do transactions.

I have tried to use ADO (Provider=SQLOLEDB.1), but ADO has the same problems as DAO as far as a new SPID being spawned in some circumstances, but it works in more situations than DAO.
The Connection Object is not guaranteed to be attached to a specific SPID - it can change at will. So Cn.Execute done twice in succession may be done on separate SPIDs.

My question is this: Is there a way to make sure that no new SPID is spawned?, Is there a way to know when a new SPID will be spawned so we can know how to avoid this situation? Is there a better way than using ADO? Keep in mind that this program has to be able to use BOTH Access/Jet databases and SQL server.

Note:
I have spent over 160 hours reading about Jet, the VB Guide to SQL Server, searching MSDN, Google etc. No article really does justice to this subject of transactions using DAO, ADO and SQL Server and the issue of the SPIDs (equivalent to a session and the session is the scope of the transaction). If you could be sure to stay on the same SPID, then you could just issue your own SQL Begin Transaction and control it all if you only plan on doing SQL statements without the need for cursors. A Microsoft article on this subject would be really helpful to all the programmers that are just now getting around to migrating to SQL Server.
Also, note, that if we did not do transactions, then we would not have to modify a single line of our code to make it work with SQL Server.
There is virtually no documentation for much of what I have written about in this Thread. I am very surprised as it seems this would have come up for thousands of programmers. I must be missing something, so thank you in advance for your help.

View 4 Replies View Related

How To Configure Distributed Transaction / XA Support Using Microsoft SQL Server 2005 JDBC Driver.

May 30, 2007

I am trying to configure distributed transaction and XA support using Microsoft SQL Server 2005 JDBC Driver. I have coppied SQLJDBC_XA.dll from XA directory and placed in my sql server binn directory and trying to run the script xa_install.sql from binn directory with command as below :

C:Program FilesMicrosoft SQL Server80ToolsBinn>
osql -U sa -n -P admin -S localhost -i C:JavaLibrariesMS SQL Driversqljdbc_1.2enuxa xa_install.sql

But I am getting error saying :
[DBNETLIB]SQL Server does not exist or access denied.
[DBNETLIB]ConnectionOpen (Connect()).

when I replaced local host with the machine name it gives error :
[Shared Memory]SQL Server does not exist or access denied.
[Shared Memory]ConnectionOpen (Connect()).

where in I am able to test connection from Websphere using the same connection.

Please help some one ....... I am in URGENT need.... I need to enable XA suport for my application to run........

Thanks ----

View 2 Replies View Related

Distributed Query From SS 2000 To Access Catalog Views On SS 2005 Via Linked Server

Aug 24, 2006

I am trying to write some admin only procedures which will collect information to one of my development server from other production and development servers.
 
I have created linked servers to access these other servers on the development server. This development server is SQL Server 2000 EE. Other servers which I want to access are 2000 and 2005 (vaious editions)
 
E.g I have another development server called PRODTEST which is SQL Server 2005 and on the development server I have created a linked server pointing to PRODTEST called TESTLINKSRV. I want to access new object catalog view (as I do not want to use sysobjects)
 
When I run the following query
 
SELECT * FROM [TESTLINKSRV].[DBNAME].[sys].[objects]
 
I get following error,
 
OLE DB error trace [Non-interface error:  OLE DB provider does not contain the table: ProviderName=' TESTLINKSRV ', TableName='" DBNAME "."sys"."objects"'].
 
Msg 7314, Level 16, State 1, Line 1
 
OLE DB provider ' TESTLINKSRV ' does not contain table '"DBNAME"."sys"."objects"'.  The table either does not exist or the current user does not have permissions on that table.
 
So I try this query
 
SELECT * FROM [TESTLINKSRV].[DBNAME].[sys.objects]
 
and I get following error
 
Msg 208, Level 16, State 1, Line 1
 
Invalid object name TESTLINKSRV.DBNAME.sys.objects'.
 
So bottom line is how do I access catalog views on a 2005 server from a 2000 server using linked server?
 
I hope someone understands what I am trying to achieve. Please let me know what is it that I am doing wrong.
Thank you

View 5 Replies View Related

Transactions/sec Behaves Much Differently In 2005

Aug 6, 2007

Our Transactions/sec counter jumped quite a bit when we moved to SQL Server 2005. The move coincided with increased load so we didn't think anything of it until recently. Upon further review, the counter just seems too high.

There was an article in SQL Server magazine a few years ago by Brian Moran where he states, "Transactions/sec doesn't measure activity unless it's inside a transaction. Batch Requests/sec measures all batches you send to the server even if they don't participate in a transaction." He goes on to say that Transactions/sec will be skewed lower because it is a subset of Batch Requests/sec. (http://www.sqlmag.com/Article/ArticleID/26380/sql_server_26380.html)

The article was written for SQL Server 2000. We conducted tests in 2000 and found what he said to be right on the money. SELECT statements increased Batch Requests/sec, but not Transactions/sec. UPDATE/INSERT/DELETE statements increased both in lockstep. Makes perfect sense so far.

We conducted the same tests in 2005 and found a radically different story. While SELECT statements behaved the same, UPDATE/INSERT/DELETE statements showed Transactions/sec skyrocket 2-10x more than Batch Requests/sec for the duration of the statement. In other words, a single transaction submitted by our application fires off exponentially more transactions than the one we submitted. I was unable to pinpoint exactly what these "hidden" transactions were actually doing. Is this something that occurred in 2000 but simply wasn't reported? Or is it new behavior in 2005?

While trying to answer these questions we noticed a second strange behavior in 2005. When no queries are being executed the Transactions/sec counter still jumps every six seconds like clockwork. And these phantom transactions number in the thousands. We tried to use profiler to capture what SQL was being executed, but nothing shows up in any SQL Statement or Batch event. However, when we turned on the SQLTransaction event we found it, sort of. An object called GhostCleanupTask runs every six seconds causing thousands of transactions. We don't know exactly what it is doing, but we noticed that it ran consistently on some databases, but never on other databases. Both sets of databases are identical and in use.

So, all of this investigation leads me with three final questions.

1. What is behind all the extra transactions caught by perfmon when I submit a single transaction?
2. What is GhostCleanupTask and why does it take so many transactions? (And why does it only run on certain databases?)
3. If a potential customer asks for our Transactions/sec count, is it accurate to give them the big number, knowing that our application is only actually submitting a fraction of that? On the other hand, the system apparently is actually doing that many transactions. (For instance, on our production server during peak, Batch Requests/sec is about 4,000, while Transactions/sec hits 26,000.

Any insight would be much appreciated.

3P

View 1 Replies View Related

Sql 2005 Database Contains Deferrd Transactions

Nov 13, 2007

Help, I had a tran log grow to it's restricted size, however the person that created this made the max size almost equal to the set max size. Needless to say I have not space to work with. SQL got bounced and my db went into recovery mode. After recovery mode was complete I tried to put my database in emergency mode but it exec's but never sets the mode. Next I tried to dbcc checkdb and I get msg 7929, level 16 state 1, line i Check statement aborted. Database contains deferred transactions. There is no back up for this database. Dev play area. I can not detatch db becase of the same error. What next? Any help would be great.

View 7 Replies View Related

Viewing Transactions In SQL Server 2005 Express

Aug 22, 2006

Hello,I'm trying to follow some sql sentences that my system send to SQL 2005express and I don't have a deep knowlegde of databases. I know thatthere's a transactions log that keeps all sentences that go intodatabase motor. Is it correct? in case yes, is there a way to look atthis archived sentences?Thanks in advanceIgnacio

View 1 Replies View Related

Changing Connection Transactions To Database Transactions

May 22, 2005

Hi there,
I have decided to move all my transaction handling from asp.net to stored procedures in a SQL Server 2000 database. I know the database is capable of rolling back the transactions just like myTransaction.Rollback() in asp.net. But what about exceptions? In asp.net, I am used to doing the following:
<code>Try   'execute commands   myTransaction.Commit()Catch ex As Exception   Response.Write(ex.Message)   myTransaction.Rollback()End Try</code>Will the database inform me of any exceptions (and their messages)? Do I need to put anything explicit in my stored procedure other than rollback transaction?
Any help is greatly appreciated

View 3 Replies View Related

The Microsoft Distributed Transaction Coordinator (MS DTC) Has Cancelled The Distributed Transaction.

Feb 29, 2008

We have a test db, a staging db and a live db. I have a stored procedure that runs fine on test and staging, but throws the following error on live.


The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.


The stored procedure uses linked servers and a transaction.
We're using the following transaction code in the stored procedure

BEGIN

BEGIN TRANSACTION

BEGIN TRY

---
procedure stuff here
---
COMMIT TRANSACTION
END TRY



BEGIN CATCH

DECLARE @ErrorSeverity INT, @ErrorNumber INT, @ErrorMessage NVARCHAR(4000), @ErrorState INT

SET @ErrorSeverity = ERROR_SEVERITY()

SET @ErrorNumber = ERROR_NUMBER()

SET @ErrorMessage = ERROR_MESSAGE()

SET @ErrorState = ERROR_STATE()



IF @ErrorState = 0

SET @ErrorState = 1



RAISERROR ('ERROR OCCURED:%d', @ErrorSeverity, @ErrorState, @ErrorNumber)

IF XACT_STATE() < 0

ROLLBACK TRANSACTION

END CATCH



END


I found the following link which seems to be the problem we're experiencinghttp://support.microsoft.com/kb/937517

The link includes a workaround which is the following:
"To prevent the SQLNCLI provider from sending an attention signal to the server, use the SQLNCLI provider to consume fully any rowsets that the OLE DB consumer creates. "


How do I use the SQLNCLI provider to fully consume any rowsets?

View 11 Replies View Related

Running A Distributed Query Against A Loopback Linked Server In SQL Server 2005 Is Not Supported

Aug 27, 2007

I receive the following error message when I run a distributed query against a loopback linked server in SQL Server 2005:
The Microsoft Distributed Transaction Coordinator (MS DTC) has cancelled the distributed transaction.

To resolve this problem, I was told that running a distributed query against a loopback linked server is not supported in SQL Server 2005. And I am suggested to use a remote server definition (sp_addserver) instead of a linked server definition to resolve this problem. (Although this is only a temporary resolution, which will deprecate in Katmai)

However, I run into another problem when I use the remote server definition. I receive the following error message:
Msg 18483, Level 14, State 1, Line 1
Could not connect to server 'ServerNameSQL2005' because '' is not defined as a remote login at the server. Verify that you have specified the correct login name.

Could anyone please help me out?
(I include the reproduce steps for the first error message, followed by my resolution that generates the second error message)
======
Reproduce steps for the first error message
======


On the ComputerAInstanceA instance, run the following statement to create a database and a table:
CREATE DATABASE DatabaseA
GO
USE DatabaseA
GO
CREATE TABLE TestTable(Col1 int, Col2 varchar(50))
GO
INSERT INTO TestTable VALUES (1, 'Hello World')
GO

On the ComputerBInstanceB instance, run the following statement to create a database and a table:
CREATE DATABASE DatabaseB
GO
USE DatabaseB
GO
CREATE TABLE TestTable (Col1 int, Col2 varchar(50))
GO

On the ComputerAInstanceA instance, create a linked server that links to the ComputerBInstanceB instance. Assume the name of the linked server is LNK_ServerB.

On the ComputerBInstanceB instance, create a linked server that links to the ComputerAInstanceA instance. Assume the name of the linked server is LNK_ServerA.

On the ComputerBInstanceB instance, run the following statement:
USE DatabaseB
GO
CREATE PROCEDURE InsertA AS
BEGIN
SELECT * from LNK_ServerA.DatabaseA.dbo.TestTable
END
GO

On the ComputerAInstanceA instance, run the following statement:
USE DatabaseA
GO
INSERT INTO TestTable
EXEC LNK_ServerB.DatabaseB.dbo.InsertA
GO
Then I receive the first error message.

=======
My resolution that generates the second error message
=======


On the ComputerBInstanceB instance, run the following statement:
sp_addserver 'ComputerAInstanceA'
GO
sp_serveroption 'ComputerAInstanceA', 'Data Access', 'TRUE'
GO
USE DatabaseB
GO
CREATE PROCEDURE InsertA AS
BEGIN
SELECT * FROM [ComputerAInstanceA].DatabaseA.dbo.TestTable
END
GO

On the ComputerAInstanceA instance, run the following statement:
USE DatabaseA
GO
INSERT INTO TestTable
EXECUTE [ComputerBInstanceB].[DatabaseB].[dbo].[InsertA]
GO
Then I receive the second error message.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved