Begin And End Transaction And Transaction Log

Dec 12, 2007

Hello everyone,
This is more of an architectural question about SQL Server. Can
someone please explain why when I perform a query such as the one
below that updates a table using begin and end transaction I am unable
to programmatically truncate the transaction log. The only way I have
found to truncate the transaction log is to stop and start the SQL
Server Service. Does this transaction use the tempdb? Is that why I
am unable to truncate the transaction log? Is there a better way to
do this?

Begin trans T1

Update sometable
Set random_row = 'blah'

End trans T1

Thanks!

View 5 Replies


ADVERTISEMENT

TRANSACTIONS In SSIS (error: The ROLLBACK TRANSACTION Request Has No Corresponding BEGIN TRANSACTION.

Nov 14, 2006

I'm receiving the below error when trying to implement Execute SQL Task.

"The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION." This error also happens on COMMIT as well and there is a preceding Execute SQL Task with BEGIN TRANSACTION tranname WITH MARK 'tran'

I know I can change the transaction option property from "supported" to "required" however I want to mark the transaction. I was copying the way Import/Export Wizard does it however I'm unable to figure out why it works and why mine doesn't work.

Anyone know of the reason?

View 1 Replies View Related

How Do I Make Use Of Begin Transaction And Commit Transaction In SSIS.

Jun 1, 2007

Hi



How do I make use of begin transaction and commit transaction in SSIS.

As am not able to commit changes due to certain update commands I want to explicitly write begin and commit statements. but when i make use of begin and commit in OLEDB commnad stage it throws an error as follows:

Hresult:0x80004005

descriptionyntax error or access violation.



its definately not an syntax error as i executed it in sql server. also when i use it in execute sql task out side the dataflow container it doesnt throw any error but still this task doesnt serve my purpose of saving/ commiting update chanages in the database.



Thanks,

Prashant

View 3 Replies View Related

BEGIN TRANSACTION Or BEGIN DISTRIBUTED TRANSACTION

Jul 20, 2005

Hi have have two linked SQL Servers and I am trying to get things workingsmootly/quickly.Should I be using 'BEGIN TRANSACTION' or 'BEGIN DISTRIBUTED TRANSACTION' ?Basicly, these SPs update a local table and a remote table in the sametransaction. I cant have one table updated and not the other. Please dontsay replicate the tables either as at this time, this is is not an option.I have for example a number of stored procedures that are based around thefollowing:where ACSMSM is a remote (linked) SQL Server.procedure [psm].ams_Update_VFE@strResult varchar(8) = 'Failure' output,@strErrorDesc varchar(512) = 'SP Not Executed' output,@strVFEID varchar(16),@strDescription varchar(64),@strVFEVirtualRoot varchar(255),@strVFEPhysicalRoot varchar(255),@strAuditPath varchar(255),@strDefaultBranding varchar(16),@strIPAddress varchar(23)asdeclare @strStep varchar(32)declare @trancount intSet XACT_ABORT ONset @trancount = @@trancountset @strStep = 'Start of Stored Proc'if (@trancount = 0)BEGIN TRANSACTION mytranelsesave tran mytran/* start insert sp code here */set @strStep = 'Write VFE to MSM'updateACSMSM.msmprim.msm.VFECONFIGsetDESCRIPTION = @strDescription,VFEVIRTUALROOT = @strVFEVirtualRoot,VFEPHYSICALROOT = @strVFEPhysicalRoot,AUDITPATH = @strAuditPath,DEFAULTBRANDING = @strDefaultBranding,IPADDRESS = @strIPAddresswhereVFEID = @strVFEID;set @strStep = 'Write VFE to PSM'updateACSPSM.psmprim.psm.VFECONFIGsetDESCRIPTION = @strDescription,VFEVIRTUALROOT = @strVFEVirtualRoot,VFEPHYSICALROOT = @strVFEPhysicalRoot,AUDITPATH = @strAuditPath,DEFAULTBRANDING = @strDefaultBranding,IPADDRESS = @strIPAddresswhereVFEID = @strVFEID/* end insert sp code here */if (@@error <> 0)beginrollback tran mytranset @strResult = 'Failure'set @strErrorDesc = 'Fail @ Step :' + @strStep + ' Error : ' + @@Errorreturn -1969endelsebeginset @strResult = 'Success'set @strErrorDesc = ''end-- commit tran if we started itif (@trancount = 0)commit tranreturn 0

View 1 Replies View Related

BEGIN TRANSACTION And COMMIT TRANSACTION

Oct 11, 2000

I am executing a stored procedure something like this

Create Procedure TEST
@test1
@test2
AS
BeGIN TRANSACTION ONE
SELECT...
UPDATE..
....
....

....
TRUNCATE
etc and lot of Select,update and delete statements like this
.....
COMMIT TRANSACTION ONE


The Block of code which I have b/w BEGIN TRANSACTION AND COMMIT TRANSACTION ..Will it be rolled back
if it encounters any errors in the SELECT,UPPDATE,DELETE ..statements which I have with the transaction one.
IF not How do I roll back if it encounters any erros b/w the BEGIN TRANSACTION and END TRANSACTION.

Thanks
micky

View 1 Replies View Related

BEGIN TRANSACTION COMMIT TRANSACTION Help

Sep 24, 2007

I had thought that if any statement failed within a BEING TRANS .. COMMIT TRANS block, then all the statements would be rolled back. But I am seeing different behavior (SQL Server 2000 8.00.2039)

For instance, run these statements to set up a test:
--DROP TABLE testTable1
--DROP TABLE testTable2
CREATE TABLE testTable1 (f1 varchar(1))
CREATE TABLE testTable2 (f1 varchar(1))
CREATE UNIQUE INDEX idx_tmptmp ON testTable1 (f1)
insert into testTable1(f1) values ('a')

So table testTable1 has a unique index on it..

Now try to run these statements:

--DELETE FROM testTable2
BEGIN TRANSACTION
insert into testTable1(f1) values ('a')
insert into testTable2(f1) values ('a')
COMMIT TRANSACTION

SELECT * FROM testTable2


..the first insert fails on the unique index.. but the second insert succeeds. Shouldn't the second insert roll back? How can I make two operations atomic?

View 8 Replies View Related

Transaction Scope - The Operation Could Not Be Performed Because OLE DB Provider SQLNCLI For Linked Server XXX_LINKED_SERVER Was Unable To Begin A Distributed Transaction. OLE DB Provider SQLNCLI&a

May 15, 2008

Hello, I've a problem with a software developed in C# with the framework 2.0. This is the error I receive : The operation could not be performed because OLE DB provider "SQLNCLI" for linked server "XXX_LINKED_SERVER" was unable to begin a distributed transaction. OLE DB provider "SQLNCLI" for linked server "XXX_LINKED_SERVER" returned message "No transaction is active.". If I try directly to restart the process, it works fine. Is there someone who can help me ? This is the process 1. In C# --> Call of a Query : select from the linked server (db in sql 2005) and insert into a table SQL 2005 2. In the C# --> using (TransactionScope scope = new TransactionScope()) and insert in a table in SQL 2005 which is link server Thank in advance.

View 1 Replies View Related

Begin Transaction In Asp.net

Oct 12, 2006

Hi All,Can any one help by giving me the details/difference in using the Transaction Isolation Levels (read uncommitted, read committed, repeatable read, or serializable)in asp.net. I just want to know in which case we can use these things in begining a transaction, and will it improve the performance. thanks in advance Boo

View 3 Replies View Related

Use Of Begin/End Transaction

Apr 23, 2008

I need to copy two large tables from one database into another, via the internet. I haven't worked out exactly how yet, but the first issue which has occurred to me is that by the time the first table has been exported (via a SELECT clause?) into a suitable file, the second table (to which it is related) will be out of sync. So, how do I ensure that I end up with a snapshot of the two tables, perfectly in sync with each other? I know that BEGIN/END TRANSACTION makes sure that UPDATES to tables remain in sync, but will it work just for SELECT statements?

View 3 Replies View Related

Begin Transaction

Nov 2, 2007

Could someone tell me if this is the correct way to begin and commit a transaction:

CREATE procedure AddTitle
@title varchar(255),
@descriptions varchar(255),
@mediaId int,
@quantityowned int,
@classificationid int


AS
BEGIN Tran TranStart

Set NOCOUNT ON
declare @titleid int --declaring the titleid


INSERT INTO Titles(title, [descriptions])
values(@title,
@descriptions)


set @titleid = SCOPE_IDENTITY() --grabbing the id to be placed in the other table


INSERT INTO Resources(titleid,mediaid,quantityowned)
values(@titleid,
@mediaid,
@quantityowned)

insert into titleclassification(titleid, classificationid)
values(@titleid, @classificationid)

select @titleid as titleid -- return to caller if needed

Commit Tran Transtart
GO

Where would I put rollback transaction? Do I need it?

Thanks!

View 3 Replies View Related

C# SQLTransaction Or SQL BEGIN TRANSACTION

Dec 31, 2007

I want to know if it's a good practice to use sql-transaction in both c# and sql procedures code.

View 4 Replies View Related

Where Should I BEGIN/END Transaction? In Code Or In The SP?

Mar 30, 2006

I notice you can do a END and BEGIN trasaction in BOTH. But I hope BOTH are not needed. So where so I use them  ?
 
Or should I even use them for simple updates and inserts ?

View 3 Replies View Related

Deadlocks && BEGIN/END TRANSACTION

Jul 23, 2005

Greetings,I've been reading with interest the threads here on deadlocking, as I'mfinding my formerly happy app in a production environment suddenlydeadlocking left and right. It started around the time I decided towrap a series of UPDATE commands with BEGIN/END.The gist of it is I have a .NET app that can do some heavy reading (nowriting) from tblWOS. It can take a minute or so to read all the datainto the app, along with data from other tables.I also have a web app out on the floor where people can entertransactions which updates perhaps 5-20 records in tblWOS at a time.The issue comes when someone is loading data with the app, and someoneelse tries an update through the web app: deadlocks-ville on theapplication and/or the web app.Again, I believe it began around the time I wrapped those 5-20 recordupdates to tblWOS on the web app with BEGIN/END. The funny thing isthat the records involved are not the same ones, so I'm thinking somekind of table-level lock is going on.I've played with UPDLOCK in examples, but don't quite understand whatit's attempting to do. Since the web update is discrete and short, andit is NOT updating records that are getting loaded, I'd like theBEGIN/UPDATE/END web transaction to happen and not deadlock the loadingapplication.Any suggestions? I'd be most grateful.thanks, Leaf

View 4 Replies View Related

BEGIN And COMMIT Transaction

Feb 28, 2008

Can help me?
I have to insert BEGIN and COMMIT Transaction in my stored procedure (call to a trigger)





Code Snippet

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO

ALTER PROCEDURE [dbo].[DETTAGLIO_TURNI_DIFENSORI]

(
@tipo_albo VARCHAR(50),
@data_inizio DATETIME,
@data_fine DATETIME,
@descrizione VARCHAR(50),
@idturno INT,
@n_dif INT
)

AS


-- DICHIARAZIONE VARIABILI...
DECLARE @dett_idturno as INT
DECLARE @totale_giorni as INT
DECLARE @tipo_albo_A as VARCHAR(9)
DECLARE @tipo_albo_B as VARCHAR(9)
DECLARE @data_odierna as DATETIME
DECLARE @tot_avvocati as INT
DECLARE @avv_giorno as INT
DECLARE @avv_giornoA as INT
DECLARE @avv_giornoB as INT
DECLARE @conta_giorni as INT
DECLARE @incremento_giorni as INT
DECLARE @incr_dif_giorno as INT
DECLARE @nuovo_idturno as INT
DECLARE @idalboturno as INT
DECLARE @old_turni as INT
DECLARE @tot_giorniA as INT
DECLARE @tot_giorniB as INT
DECLARE @conta_giorni_incremento as INT
DECLARE @conta_avvocati as INT
DECLARE @avv as INT
DECLARE @altri_turni AS INT
DECLARE @neg_giorni_incremento as int
-------------------------------------------------------------------------------------------------------

-- SET VARIABILI PER EVITARE PROBLEMI CON NULL o 0
SET @totale_giorni = 0
SET @tot_avvocati = 0
SET @avv_giorno = 0
SET @conta_giorni = 0
SET @incremento_giorni = 0
SET @incr_dif_giorno = 0
SET @idalboturno = 0
SET @old_turni = 0
--------------------------------------------------------------------------------------------------------

SET @nuovo_idturno = @idturno

BEGIN TRAN

-- conta i giorni
SELECT @totale_giorni = (DATEDIFF(dd, @data_inizio, @data_fine))+1

-- select da vista avvocati per tipo difensori selezionato.. (controllare anche data_fine_iscrizione?)

create table #Tmp
(
[ID_anagrafica] varchar(50)
)

IF @tipo_albo = 'DIFO'
BEGIN
SET @tipo_albo_A = 'DIFM'
SET @tipo_albo_B = 'CPT'

-- select per contare..

SELECT @tot_avvocati = COUNT(*)
FROM VALBO_ISCRIZIONE_DIF_ORDINARI

SELECT @tot_avvocati As tot_avvocati

-- creo tabella temporanea..
INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_ORDINARI ORDER BY ID_ANAGRAFICA

END

IF @tipo_albo = 'DIFM'
BEGIN
SET @tipo_albo_A = 'DIFO'
SET @tipo_albo_B = 'CPT'

-- select per contare..
SELECT @tot_avvocati = COUNT(*)
FROM VALBO_ISCRIZIONE_DIF_MINORI

SELECT @tot_avvocati as tot_avvocati

-- creo tabella temporanea..
INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_MINORI ORDER BY ID_ANAGRAFICA
END

IF @tipo_albo = 'CPT'
BEGIN
SET @tipo_albo_A = 'DIFM'
SET @tipo_albo_B = 'DIFO'

-- select per contare..
SELECT @tot_avvocati = COUNT(*)
FROM VALBO_ISCRIZIONE_DIF_CPT

SELECT @tot_avvocati as tot_avvocati

INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_CPT ORDER BY ID_ANAGRAFICA
END

DECLARE @idanagrafica varchar(50)

-- GIORNI PER AVVOCATO
-- tot_giorni * n_dif_minimo / tot_avvocati = tot_giorni_avvocato (con intero successivo)
SET @incremento_giorni = ((@totale_giorni * @n_dif)/@tot_avvocati)
-- controllo se c'è resto..
IF ((@totale_giorni * @n_dif)%@tot_avvocati) <> 0
BEGIN
SET @incremento_giorni = @incremento_giorni + 1
END

-- ogni avvocato deve essere difensore per almeno 2 giorni di seguito..
-- quindi se l'incremento è minore di 2 deve essere uguale a 2
IF @incremento_giorni < '2'
BEGIN
SET @incremento_giorni = '2'
END

-- AVVOCATI AL GIORNO
-- numero variabile.. prendere in considerazione il primo intero e l'intero successivo..
SET @avv_giorno = (@incremento_giorni * @tot_avvocati)/@totale_giorni
SET @avv_giornoB = @avv_giorno

-- controllo il resto della divisione.. se <> 0 @avv_giornoB = @avv_giorno + 1..
-- altrimenti i due valori sono uguali..

IF ((@incremento_giorni * @tot_avvocati)%@totale_giorni) <> 0
BEGIN
SET @avv_giornoA = @avv_giorno + 1
END
ELSE
BEGIN
set @avv_giornoA = @avv_giorno
END

-- conteggi giorni totali difensori...
-- giorni con N difensori
SET @tot_giorniB = ((@avv_giornoB * @incremento_giorni)/@totale_giorni)
-- giorni con M difensori
SET @tot_giorniA = @totale_giorni - @tot_giorniB

declare @totale as int
declare @conta_inseriti as int
set @conta_inseriti = 0
set @totale = (@avv_giornoA * @tot_giorniA) + (@avv_giornoB * @tot_giorniB)

-- ciclo per totale dei giorni
SET @conta_giorni = 1
SET @conta_giorni_incremento = 0
SET @conta_avvocati = 0
WHILE @conta_giorni <= @totale_giorni BEGIN

-- ogni giorno @avv deve essere ZERO
SET @avv = 0

IF @conta_giorni <= @tot_giorniA
BEGIN
SET @avv_giorno = @avv_giornoA
END
ELSE
BEGIN
SET @avv_giorno = @avv_giornoB
END

-- ciclo per ogni giorno per totale di avvocati/giorno
SET @incr_dif_giorno = 0

WHILE (@incr_dif_giorno < @avv_giorno) AND EXISTS(SELECT TOP 1 ID_anagrafica FROM #Tmp) BEGIN

SET @conta_avvocati = @conta_avvocati + 1

SET @data_odierna = DATEADD(dd, (@conta_giorni-1), @data_inizio)

SET @neg_giorni_incremento = -1 * @conta_giorni_incremento

SET @old_turni = 0
SET @altri_turni = 0

SELECT TOP 1 @idanagrafica = ID_anagrafica from #Tmp
DELETE #Tmp WHERE ID_anagrafica = @idanagrafica

-- query che controlla i turni già assegnati per altre liste...

SELECT @old_turni = COUNT(*)
FROM Albo_Turno_Dettaglio CROSS JOIN
ALBO_TURNO
WHERE
Albo_Turno_Dettaglio.idalbo = @idanagrafica
AND
(
ALBO_TURNO.Tipo = @tipo_albo_A --- probabile problema con trigger
OR
ALBO_TURNO.Tipo = @tipo_albo_B
)
AND
(
Albo_Turno_Dettaglio.Data
BETWEEN
DATEADD(dd, (@neg_giorni_incremento + 1), @data_odierna)
AND
DATEADD(dd, (@incremento_giorni-@conta_giorni_incremento), @data_odierna)
)

SELECT @old_turni AS old_turni

-- (nel caso in cui il ciclo ricominci..) controllare che questo avvocato non abbia
-- già un set di giorni in questo turno...

-- passato il primo controllo.. deve passare anche questo..

SELECT @altri_turni = COUNT(*)
FROM Albo_Turno_Dettaglio
WHERE
Albo_Turno_Dettaglio.idalbo = @idanagrafica
AND
Albo_Turno_Dettaglio.idturno = @nuovo_idturno

SELECT @altri_turni AS altri_turni

IF @old_turni = NULL
BEGIN
SET @old_turni = 0
END

IF @ALTRI_TURNI = NULL
BEGIN
SET @ALTRI_TURNI = 0
END

IF (@old_turni = 0 AND (@altri_turni = 0 OR @altri_turni < (@incremento_giorni)))
BEGIN
-- se non ci sono turni sovraposti assegna il turno all'avvocato x N giorni (incremento_giorni)
-- seleziono il dettaglio con idturno max per aumentare di uno...
SET @idalboturno = 1
SET @dett_idturno = 1
SELECT @dett_idturno = MAX(idalboturno)
FROM Albo_Turno_Dettaglio

if (@dett_idturno) = null
begin
set @dett_idturno = 0
end

SET @idalboturno = @dett_idturno + 1

BEGIN TRAN

INSERT Albo_Turno_Dettaglio
(
idalboturno,
idalbo,
idturno,
data
)
VALUES
(
@idalboturno,
@idanagrafica, -- da cursore
@nuovo_idturno,
@data_odierna -- problemi inserimento data??
)

COMMIT
-- valorizza il numero degli avvocati del giorno + 1
SET @incr_dif_giorno = @incr_dif_giorno + 1
END
ELSE
BEGIN
-- non incrementare la variabile...
SET @incr_dif_giorno = @incr_dif_giorno
END

END -- END WHILE AVVOCATI PER GIORNI

SET @conta_giorni_incremento = (@conta_giorni_incremento + 1)
IF @conta_giorni_incremento < @incremento_giorni
BEGIN
--DEVO RIPOPOLARE LA TABELLA PERCHE' OGNI AVVOCATO DEVE AVERE X GIORNI..
-- cancello tutti i record e poi inserisco di nuovo..
DELETE FROM #Tmp
IF @tipo_albo = 'DIFO'
BEGIN

INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_ORDINARI ORDER BY ID_ANAGRAFICA
END

IF @tipo_albo = 'DIFM'
BEGIN

INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_MINORI ORDER BY ID_ANAGRAFICA
END

IF @tipo_albo = 'CPT'
BEGIN

INSERT INTO #Tmp
SELECT [ID_anagrafica]
FROM VALBO_ISCRIZIONE_DIF_CPT ORDER BY ID_ANAGRAFICA
END

END
ELSE
BEGIN
set @conta_giorni_incremento = 0
END

SET @conta_giorni = @conta_giorni + 1
END

DROP TABLE #TMP

COMMIT TRAN


GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO

View 9 Replies View Related

Unable To Begin A Distributed Transaction

Jun 20, 2008

I have this code
 DECLARE @tempTableName VarChar(50)SET @tempTableName = NEWID()
CREATE TABLE #@tempTableName( State Char(2), Billed Money, AslCode VarChar(10))INSERT INTO #@tempTableName EXEC GetRecords '2/1/2008'
which gives me this error when I run
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 the specified transaction coordinator. ]OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].
GetRecords does a select * from a linked server's table. Which is working fine but if I try to do an insert (into temp table) then I get the error.
Any help?

View 1 Replies View Related

Unable To Begin A Distributed Transaction (Msg 7391)

Apr 6, 2007

I am receiving the following error when I run a stored procedure:Server: Msg 7391, Level 16, State 1, Procedure spXXXXThe SP inserts data into a local (sql 2000) table from a remote sql2000 database. The SP works fine until I add a trigger to thedestination. The contents of the trigger do not appear to matter, as Ihave tried removing everything but one line, which is just a declarestatement. Updating the table with the trigger (even the full trigger)in place does not cause an error. Running the SP without the triggeron the table does not cause the error.I have the exact same setup on another server. Both the SP and thetrigger are IDENTICAL. This setup works on one server, but not theother. The only difference I can see is that the non-working server isWindows 2000 Server, while the working server is Windows 2003 Server.Any idea what's going on here?Thanks in advance.Eric

View 3 Replies View Related

Begin Tran In An Sp Executed Fom Within A Transaction Scope

Jan 28, 2008

we have an update sp that must call an insert sp after the update. The update and insert must act like a transaction, ie all or none.

We believe that wrapping most of the update (including call to insert sp) sp in a begin tran block would guarantee the all or none behavior.

However, we're not sure what would happen if one of our developers calls the update sp from within a transaction scope that expects yet something additional to be included in the transaction. Would the begin tran block (assuming no errors in that block) in the sp commit both the update and insert regardless of what happens in the rest of the .net tran scope?

View 2 Replies View Related

'SQLOLEDB' Was Unable To Begin A Distributed Transaction

Nov 12, 2007

SQL2000 / W2K


I'm having issues with a query to a view that references a view on a linked server, that in turn references a view on a third server.

Query to view on Server A --> View on Server B --> View on Server C

I can query from A to B using the linked server.
I can query from B to C.
I can query from A to C.

All servers at the same location on the same domain.

I cannot query a view on A, that references a view on B, where the view on B references a view/table on C

Each linked server configuration uses "Be made using this security context", with the user specified being 'sa'. I was hoping to get security out of the equation for debug purposes, hence the sa use.

I have tried from Query Analyzer using both windows and sql auth.

MSDTC is running on all servers as local system.

The full error returned is:

Server: Msg 7391, Level 16, State 1, Line 1
The operation could not be performed because the OLE DB provider 'SQLOLEDB' was unable to begin a distributed transaction.
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].
[OLE/DB provider returned message: New transaction cannot enlist in the specified transaction coordinator. ]



Thanks for any support,

Chris




View 8 Replies View Related

OLE DB Provider 'MSDAORA' Was Unable To Begin A Distributed Transaction

May 4, 2006

Dear all,

I have been attempting to set up a linked server in SQL Server 2000 to point to an Oracle database (a very old Oracle database, v7!).

The linked server set up works fine. Then I created a database on the same SQL Server. Within that database I created a view which reads information from a view in the Oracle database (linked server). When I attempted to create this view in Enterprise Manager, I get the following error:

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

And so I created the view in Query Analyzer. This worked perfectly, no errors, and I can now go into Enterprise Manager and call up the view, which happily goes off to the view in the Oracle linked server and pulls back the info. BUT, when I attempt to do the same thing through an application on a different machine (using OLE Db, and a UDL to connect) the same error as above appears.

Does anyone know what this error means, and where I went wrong? Any help greatly appreciated. My view onto the linked server looks like this:

"CREATE VIEW dbo.NLPG_VIEW
AS
SELECT * from openquery(sadaslink, 'select * from NLPG_VIEW')"

Many thanks in advance for your wisdom!

P.S I wondered whether I need to check if the distributed transaction co-ordinator is running but don't know how.
Thanks,

View 8 Replies View Related

Insert ... Exec Unable To Begin A Distributed Transaction

Feb 17, 2004

I have 3 development SQL Servers A, B & C, all running SQL 2000 sp3 and Windows 2003. Servers B & C have a linked server pointing to A, and A has one pointing to B & C. The linkedservers all have RPC , RPC out enabled. I have a stored procedure called test on server A.

Create Proc test
as

Select Top 5 first_name, last_name from people

GO


--code ran on Servers B & C:

create table #tmptbl (nm varchar(100), nm2 varchar(100))

insert into #tmptbl
Exec ServerA.db1.dbo.test


When the Insert....Exec code above is ran from server B it works fine, however when I run it from Server C, I get error 7391
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 the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a]

But regular linked server calls (directly to tables) and openquery calls work fine from either server...

Eg
insert into #tmp
Select top 5 first_name, last_name from ServerA.db1.dbo.people

--and this works also

insert into #tmp
Select * from openquery(ServerA, 'Exec db1.dbo.test')


Both servers (B & C) appear to be configured the same, and
I have reconfigured MSDTC on all three boxes through control panel and component manager, have tried using SET xact_abort, SET implicit_transactions, registry hacks (TurnoffRPCsecurity), basically everything listed on Microsoft, and everything I've been able to find in these groups.

If anyone has any ideas, I'd like to hear them.

Tim.

View 3 Replies View Related

'MSDAORA' Was Unable To Begin A Distributed Transaction - Why?! (SQL &<-&> Oracle)

May 12, 2006

Hello!I have an Oracle linked server connected through MSDAORA. Linked serverqueries work perfectly - the "openquery" ones as well as the4-part-named ones.The problem I have is with embedding the queries within SQL Servertriggers.Trigger:CREATE TRIGGER tgTest ON [dbo].[test]FOR INSERT, UPDATE, DELETEASselect * from openquery(LS, 'select * from ORACLE_TEST')executing "delete from test" in SQL Query Analyzer raises this error:Server: Msg 7391, Level 16, State 1, Procedure tgTest, Line 5The operation could not be performed because the OLE DB provider'MSDAORA' was unable to begin a distributed transaction.OLE DB error trace [OLE/DB Provider 'MSDAORA'ITransactionJoin::JoinTransaction returned 0x8004d01b].I've tried almost every solution I found online, but nothing helped:(This looked promissing: http://tinyurl.com/nk2wd , but it didn't get meany futher.Maybe someone can get me through the troubleshoot mentioned in thatlink:- check if DTC running properlyHow do I check that? If I open the "Support services" in EnterpriseManager and right-click the "Distributed Transaction Coordinatior" Ican stop the service, what indicates the service is running, but isthere anything else I should check? I have 0 items in the right windowpane of the DTC item, is it OK?- registry setting as discussed earlierThe following Registry Keys should be entered:[HKEY_LOCAL_MACHINESOFTWAREMicrosoftMSDTCMTxOCI ]"OracleXaLib"="oraclient8.dll""OracleSqlLib"="orasql8.dll""OracleOciLib"="oci.dll"My entries are:"OracleOciLib"="ociw32.dll""OracleSqlLib"="SQLLib18.dll""OracleXaLib"="xa73.dll"Are they OK?- check if Mtxoci.dll is loadedThere is a Mtxoci.dll in my system32 dir, but how do I tell if it'sloaded? Should I regsvr32 it?- SET XACT_ABORT ON should be use in your SQL statement, for example:SET XACT_ABORT ONBEGIN DISTRIBUTED TRANSELECT statementCOMMIT TRANI've tried that, both in trigger but also surrounding the query thatfires the trigger.Am getting deseperate - please help. Will send candies!TIA

View 1 Replies View Related

Linked Server And Unable To Begin A Distributed Transaction

Jul 20, 2005

I have a database containing my own tables and data and I wanted tobe able to query this against an accountancy program which has an ODBCdriver. This was never a problem with MS Access and Jet but I hit Jet'slimitations and have moved to SQL.Creating my own SQL database was no problem, but I was unsure of thebest way to be able to be able to have my SQL tables and my accountancysoftware tables appearing in the same Access front end.I created a linked server to the accountancy program. This wassuccessful in that I could see all the tables below the linked server inenterprise manager.My problem occurs when I try to bring the data from these tablesinto my SQL database.I create a new view in my database:-SELECT *FROM OPENQUERY(SAGE_SERVER, 'SELECT * FROM STOCK')(My linked server is called 'SAGE_SERVER' and I am trying to retrieveall columns from the STOCK table.)I then try to save this view and get the following errors.ODBC Error: [Microsoft][ODBC SQL Server Driver][SQL Server]The operationcould not be performed because the OLE DB provider 'MSDASQL' was unableto begin a distributed transaction.[Microsoft][ODBC SQL Server Driver][SQL Server]OLE DB Error Trace[OLE/DBProvider 'MSDASQL' ITransactionJoi JoinTransaction returned 0x8004d00a].Thanks in advance,Marcus Thornton.

View 1 Replies View Related

Integration Services :: Begin And Rollback Transaction In SSIS

Sep 17, 2015

I am trying to use sql transaction in foreach loop where I am passing  1 ID @ a time .I want to rollback only current ID.1st task in foreach is execute sql task with begin tran and next is data flow task with 2 source and destination for 2 different tables (if anyone fails then rollback from all tables). After data flow is another execute sql task with rollback tran on failure (logical condition on pipe is OR). The rollback works but only rollback 1 table although I want to rollback on current iteration ID of foreach  from both tables.

View 3 Replies View Related

Error 8525: Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.

May 31, 2008

Hi All

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

View 1 Replies View Related

SSIS, Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.

Feb 22, 2007

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.

Please help me it's very urgent.

View 3 Replies View Related

Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.

Feb 6, 2007

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?!

View 1 Replies View Related

Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction.

Dec 22, 2006

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.

View 8 Replies View Related

Distributed Transaction Completed. Either Enlist This Session In A New Transaction Or The NULL Transaction. (HELP)

Jan 8, 2008

Hi,

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.



Thanks in advance.


View 2 Replies View Related

DTC Select Works - Insert Update Fails Cannot Begin Distributed Transaction

Mar 31, 2015

We have a rather large environment and have just a couple of boxes out there that we are getting cannot begin distributed transaction on inserts and updates but works fine on selects. Inserts and updates work fine outside the begin tran / commit so it's definitely DTC

We have checked the configuration on and the source box is set to No authentication required same for destination.

We have: Verified credentials running the service, changed them, same problem. Uninstalled and re-installed MSDTC per Microsoft instructions.

Have run all the tools for checking DTC DTCPing etc and followed those procedures which typically in the past has resolved any DTC issues. Other than swapping out the offending pc for a new one we are at a loss.

View 2 Replies View Related

The Operation Could Not Be Performed Because The OLE DB Provider 'SQLOLEDB' Was Unable To Begin A Distributed Transaction.

Jan 14, 2008

Hi,

I am facing the below mentioned error:

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 the specified transaction coordinator. ]
OLE DB error trace [OLE/DB Provider 'SQLOLEDB' ITransactionJoin::JoinTransaction returned 0x8004d00a].

I have a Insert statement which i am using to insert data into a remote server from my local server. I have added the remote server as a linked server in my local server but when i try to execute the statement i am getting the above mentioned error. I am using Windows Enterprise Edition 2003 and SQL Server 2000.

I have also enabled the Allow InBound and Allow OutBound in the security configuration of My Computer properties but still i am facing the same problem. Kindly let me know how to resolve this issue.

Thanks.

View 13 Replies View Related

Transact SQL :: Transaction Count After EXECUTE Indicates Mismatching Number Of BEGIN And COMMIT Statements

Aug 19, 2015

I am getting an exception. And i don't know whether this exception is from the C# coding or SQL SERVER."Cannot roll back InsertRxs. No transaction or savepoint of that name was found.Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.A transaction that was started in a MARS batch is still active at the end of the batch. The transaction is rolled back."

View 2 Replies View Related

SQL Server 2012 :: Transaction Count After EXECUTE Indicates Mismatching Number Of BEGIN And COMMIT Statements

Oct 23, 2015

I'm all of a sudden getting this error on a Stored Procedure that has not been touched since it was created.

Msg 266, Level 16, State 2, Procedure usp_ArchivexactControlPoint, Line 0
Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 0, current count = 1.

CREATE PROCEDURE [dbo].[usp_ArchivexactControlPoint]
AS
DECLARE @TableName VARCHAR (50)

[Code] ...

View 2 Replies View Related

Could Not Run BEGIN TRANSACTION In Database 'whatever' Because The Database Is Read-only.

Jul 20, 2005

I had a databases running on SQL Server (EVALUATION VERSION).I moved it to another system running:-Windows 2000 Server-IIS 5.0-BlueDragon Server-MSDEI applied all of the latest service packs, security updates, etc...Intalled SQL Server Web Data Administrator and .NET framework.I attached the database using sp_attach_db:[color=blue]>osql –U sa>password>Sp_attach_db ‘whatever',>@filename1 = ‘C:Program FilesMicrosoft SQL[/color]ServerMSSQLDataCollaborationTools.mdf',[color=blue]>@filename2 = ‘C:Program FilesMicrosoft SQL[/color]ServerMSSQLDataCollaborationTools.ldf'[color=blue]>go[/color]I added my datasource using the ODBC Admin Tool...Verified it using the BlueDragon Admin Datasources page....But now I'm getting the error message:'Could not run BEGIN TRANSACTION in database 'whatever' because thedatabase is read-only.'Any help/guidance would be appreciated.Thanks very much.Shaun

View 3 Replies View Related







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