Transaction Reverts Back After 10 Mins

Apr 3, 2015

The following transaction runs, then reverts back after 10 mins.

begin Tran [UpdateSundays]
update ScanAssetInformation with (rowlock)
set BusinessDate = dateadd(day,-2,BusinessDate)
where datepart(weekday,BusinessDate) = 1
commit tran [UpdateSundays]

begin Tran [UpdateSaturdays]
update ScanAssetInformation with (rowlock)
set BusinessDate = dateadd(day,-1,BusinessDate)
where datepart(weekday,BusinessDate) = 7
commit tran [UpdateSaturdays]

View 2 Replies


ADVERTISEMENT

Snapshots And Reverts

Nov 9, 2007

HiWhat would be the quickest way to create a backup and revert programon an sql (2000) database?- Can you create a transaction on a database, regardless of theconnections and thenrollback it all via an external program- Could you monitor the changes with profiler and then reverse those?- If desperate, could you backup the db from a tool and then restoreit? (too slow to be practical?)Not sure how to do this so any offers would be appreciatedta

View 3 Replies View Related

How To Back Up The Transaction Log For The Database?

Feb 8, 2001

Hi all,
I'm getting the following error message in NT event view:

Error: 9002, Severity: 17, State: 2
The log file for database 'db_sys' is full. Back up the transaction log for the database to free up some log space.

But I don't know how to back up the transaction log for the database.
Do I need TRUNCTE LOG (in E.M) to free up some log space?
I only know back up all the database using ALL TASKS -> BACKUP DATABASE in E.M. Please help me. Thanks in advance.
TH

View 1 Replies View Related

Transaction Not Rolling Back

Mar 19, 2007

I have a stored procedure that calls another stored procedure with thefirst stored procedure opening a transaction:BEGINSET XACT_ABORT ONBEGIN TRANSACTIONdoes various updates/insertscalls 2nd stored procedure to proccess updates/inserts common to manyother stored proceduresdoes more various updates/insertscommitENDThe problem I'm having is that within the 2nd stored procedure is thatif it encounters an error, it does not roll back the entiretransaction and I finish up with missing records in the database. Amusing this in the 2nd stored procedure:if(@TypeId1 = @TypeId2 and @Line1 <'' and @Line2 <'')beginRAISERROR('error message', 16, 1)RETURNendWhat could the problem be? From what I've read, it seems as thoughyou can't have an open transaction within one sp that calls another spand it maintains the same transactoin? Is this corrrect?I tired the following too, and I still couldn't get it to work. Anyideas anyone?************ sp 1 ***********Declare @AddressError char(3)SET XACT_ABORT ONBEGIN TRANSACTIONexec Sp2@AddressError OUTPUT,@variable1,@variable2,etc. etc************** sp 2 *****************@AddressError char(3) OUTPUT,if(@TypeId1 = @TypeId2 and @Line1 <'' and @Line2 <'')beginRAISERROR('error message', 16, 1)RETURNendSET XACT_ABORT ONBEGIN TRANSACTIONprocess updates/insertsSet @AddressError = 'no'Commit******** back to sp 1************If @AddressError <'no'BEGINrollback transactionENDcontinue doing updates/insertscommit

View 1 Replies View Related

Rolling Back Transaction

Jun 16, 2007

Hi,



I have a case where I read from SQL Server DB and write to a flat file.

I have one Data Flow Task inside which I have a OLEDB source component that feeds rows to a script component that writes to a flat file. I have set the txn attributes for the container to "Required" and "Read committed" . But I find that rows are written to flat file even when I throw an exception from my script component. Question is how do I prevent rows from being written to the flat file if error/exception happens. I want the whole process to be in a single transaction.



Thanks

View 3 Replies View Related

How To Implement Transaction Roll Back

Feb 28, 2008

Hello, I do not know how to implement transaction roll back in asp.net application. I am using SqlHelper class to communicate with my sql db.Thanks, junior 

View 1 Replies View Related

My Transaction Isnt Rolling Back When It Should

Apr 9, 2008

Ive got an insert statement that fails, and below that I have code like the following:


IF @@ERROR <> 0
BEGIN
-- Roll back the transaction
ROLLBACK
-- Raise an error and return
RAISERROR ('Error INSERT INTO Address.', 16, 1)
print 'test was here'
RETURN
END


However, there is now rollback and the inserts below it are going through.

what do i have wrong ?

View 5 Replies View Related

Mirroring And Rolling Back Transaction Log

Mar 17, 2008

hi,
i want to create a disaster recovery site, to which i can fail over (not automatically),
and also to have the option to return the database to a point in time?
for example,
if my principal server fails in 17:00,
i want to have the option to make the mirror server available for users from 17:00 (or at least close to that time),
and also to be able the return to the data from 16:00 (in the mirror site).
Is it possible, and what is the best way to do it?

Thanks.

View 1 Replies View Related

Transaction Log Back Ups - Simple Question

Aug 15, 2007



When using the maintenance plan to backup t logs, should I enclude the system database logs such as master, model, etc...?


Thanks!

View 1 Replies View Related

Back Up And Restore Using Transaction Log And Incremental Backup

Feb 1, 2001

hi, I would like to know the correct reaction for a crash in both senarios.
First senario,
I made a full back up at 6 am , then scheduled sql server to make transaction log back up every 2 hours (8,10,12,2 pm,4,6,8) . If I have a crash at 12:30. How would I resotre the data in the first senario....Can I restore the full back up done at 6 am then restore the last transaction log backup ( which is 12 Noon ) . I am not sure If I need to resotre the whole tran from 6 am till the time it was crashed.

Second senario,

I made a full back up at 6 am, then scheduled sql server to make Incremental backup every 2 hours (8,10,12,2 pm,4,6,8) . If I have a crash at 3:00 pm. How would I resotre the data in the second senario. ....Do I restore the full backup at 6 am then restore each incremental backup backwords ( 2,12,10,8)

AS you can see, I am not sure how to deal with this issue, I do appreciate your feedback.

Best regards

Ahmed

View 1 Replies View Related

Full Back Up ( Transaction Log ) Vs ( Incremental Backup)

Feb 1, 2001

hi, I would like to know the correct reaction for a crash in both senarios.
First senario,
I made a full back up at 6 am , then scheduled sql server to make transaction log back up every 2 hours (8,10,12,2 pm,4,6,8) . If I have a crash at 12:30. How would I resotre the data in the first senario....Can I restore the full back up done at 6 am then restore the last transaction log backup ( which is 12 Noon ) . I am not sure If I need to resotre the whole tran from 6 am till the time it was crashed.

Second senario,

I made a full back up at 6 am, then scheduled sql server to make Incremental backup every 2 hours (8,10,12,2 pm,4,6,8) . If I have a crash at 3:00 pm. How would I resotre the data in the second senario. ....Do I restore the full backup at 6 am then restore each incremental backup backwords ( 2,12,10,8)

AS you can see, I am not sure how to deal with this issue, I do appreciate your feedback.

Best regards

Ahmed

View 2 Replies View Related

Rolling Back Transaction Logs Database

Feb 3, 2004

I have a Development database and I want to roll it back to Monday morning. I backed up the database and used the command:

RESTORE DATABASE ITTEST
FROM ITTEST20040203
WITH NORECOVERY
GO

RESTORE LOG MyNwind
FROM ITTEST20040203
WITH RECOVERY, STOPAT = 'FEBRUARY 2, 2004 09:00 AM'
GO

The transaction logs have never been truncated.

But it does not seem to have worked. It this the best way to do a roll back the database or have I missed out something.

thanks.

View 2 Replies View Related

Write To A Table In A Rolled Back Transaction.

Mar 4, 2008



Hi,

Is there a way to write to a log-table inside a transaction which is rolled back without rollback of this log-entry.

thanks in advance
Raimund

View 9 Replies View Related

Rolling Back Transaction After .Commit() Runs Successfully

Jun 10, 2007

I have a page that runs a transaction correctly after a button click.
I want to allow someone to click a button that rolls back the transaction, after the transaction runs on the first button click.
I can also successfully roll back within the first button click.
 I'm getting a NullReference error when trying to access SqlTransaction.Rollback() outside the button click.
 If SqlTransaction.Commit() completes without error can SqlTransaction.Rollback() be called after?
I tried making 'trans' a more global variable and it still gave me the error.
Button Click 1:
Dim trans As SqlTransaction
trans = connection.BeginTransaction()
try
'run SQL Statement
trans.Commit()
Catch e As Exception
 trans.Rollback()
throw e
end try
 
Button Click 2:
trans.Rollback()
 

View 4 Replies View Related

SQL Server 2008 :: Can Second Save Transaction T2 Be Rolled Back

May 4, 2015

I am confused about save transaction in the below scenario :

begin transaction
save transaction t1
delete from #t1
save transaction t2
begin try
delete from #t2

[Code] ....

If there is error after delete #t2 , transaction t1 is rolled back. But i am not able to understand why i am getting error in the statement 'rollback transaction t2' . I am getting error as 'Cannot roll back t2. No transaction or savepoint of that name was found.'. but save point t2 is mentioned in the code.

View 3 Replies View Related

Transaction Scope Rollback Does Not Roll Back Action Of Activation SP

Aug 16, 2007

Hi,

I followed Remus' post about not doing 'fire and forget'.

I have two queues, ProcessingSendQueue and ProcessingReceiveQueue.

Once i receive from ProcessingReceiveQueue, activation SP gets called on ProcessingSendQueue and ends conversation.

However,if I then get an exception, the action of the activation SP ( ie the ending of the conversation ) does not get rolled back... is this possible? I would have thought that the action of the activation SP would get rolled back too.

My ProcessingSendQueue activation SP is as follows:

ALTER PROCEDURE [dbo].[ProcessingSendQueue_AP]
AS
BEGIN
DECLARE @dh UNIQUEIDENTIFIER;
DECLARE @message_type SYSNAME;
DECLARE @message_body NVARCHAR(4000);

RECEIVE @dh = [conversation_handle], @message_type = [message_type_name], @message_body = CAST([message_body] AS NVARCHAR(4000))
FROM [ProcessingSendQueue];

IF @dh IS NOT NULL
BEGIN
IF @message_type = N'http://schemas.microsoft.com/SQL/ServiceBroker/Error'
BEGIN
RAISERROR (N'Received error %s from service [ProcessingReceiveQueue]', 10, 1, @message_body) WITH LOG;
END
END CONVERSATION @dh;
END
END

View 1 Replies View Related

How Do You Roll Back Transactions For A Single Table From The Current Transaction Log?

Nov 1, 2007



Goofed up and ran an update query. It messed up all the data in a single table. I'm trying not to restore the table from a previous backup since the backup is more than 20 GB. It's going to take forever to restore it. Any advice would be much appreciated!

Thanks!
Charles.

View 3 Replies View Related

Transaction Replication Failed After Restoring Full Back Up Of Database In NORECOVERY

Mar 4, 2011

We had a siutation last night in our production environment that forced us to revert back to an earlier version of the database (before a major code rollout that failed). After restoring the days full backup (with NORECOVERY), and then restoring a DIFF backup (FULL RECOVERY and had checked Preserve Replication Settings)...the transaction replication failed.

Message #1
The replication agent has been successfully started. See the Replication Monitor for more information.

Message #2
2011-03-04 15:07:17.566 Copyright (c) 2008 Microsoft Corporation
2011-03-04 15:07:17.566 Microsoft SQL Server Replication Agent: logread
2011-03-04 15:07:17.566
2011-03-04 15:07:17.566 The timestamps prepended to the output lines are expressed in terms of UTC time.
2011-03-04 15:07:17.566 User-specified agent parameter values:

[code]....

I've tried reinitializing the publication/subscription and while that took brand new snapshots and copied it over to the replicated data server, it did not fix the problem.I read from a different post that I could try running "sp_replrestart" but that ran for about a half an hour and didn't appear to do anything but fill up our log files...did I not wait long enough?

The only thing I know to do at this point is to drop the publication on the production server and rebuild it completely (and with all the tables we're replicating that would take quite a bit of time.

View 9 Replies View Related

SQL Server 2014 :: Stored Proc Timing Out Halfway Through - Rolling Back Without Transaction

Jul 7, 2015

We have a high volume database with 1000's of users and 1000's of procs. Our application enforces a 20 second timeout on all connections.

We can't adjust the 20 seconds - this is a business rule.

It sometimes happens that a proc does not complete within 20 seconds and then times out halfway though. This causes data inconsistency where 50% of the code was saved to the DB and 50% was not - seeing that a stored proc is not transactional and therefor does not roll back the code.

We can't put the code in a TRANSACTION in order to roll back when a time out occurs, because this causes exclusive locks on the tables.

So I guess my question is:
Is it possible to undo/rollback all the code in a proc when a timeout occurs - without using a TRANSACTION? And if a TRANSACTION is the only way - how do I avoid the exclusive lock and blocks?

View 4 Replies View Related

Why Does This Procedure Takes 25 Mins To Run

Jul 7, 2004

hi, this stored procedure below takes 25 mins to execute. is this normal? and is there a faster way to do this? its not like i have millions of records, i only have about 170.

Create Procedure sp_PayrollComplete

AS
declare @weDate nvarchar(10)

Select @weDate= we FROM cbetts.tblArchive
WHERE we = (select max(convert(datetime,we)) from cbetts.tblarchive)

declare @uid int
declare @job nvarchar(10)
declare @name nvarchar(30)
declare @Location nvarchar(30)
declare @Direct float
declare @LBO float
declare @g1099 float
declare @agency float
declare @nonbill float
declare @holiday float
declare @vacation float
declare @total float

delete cbetts.tblpayroll

Declare payroll_cursor CURSOR FOR
SELECT distinct userid FROM cbetts.v_PayrollTotals
where (we = @weDate)
ORDER BY userid

OPEN payroll_cursor

-- Perform the first fetch.
FETCH NEXT FROM payroll_cursor into @uid
-- Check @@FETCH_STATUS to see if there are any more rows to fetch.
WHILE @@FETCH_STATUS = 0
BEGIN

select @location=location from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
select @name = name from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
select @Direct =
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and employeetype='direct'
and left(jobno,3) != '900'
select @LBO =
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and employeetype='LBO'
select @g1099 =
sum(totals)from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and employeetype='1099'
select @agency =
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and employeetype='Agency'
select @nonbill=
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and left(jobno,3)='900'
select @holiday =
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and (jobno='90010' or jobno='90011')
select @vacation =
sum(totals) from cbetts.v_payrolltotals
where userid = @uid
and we = @weDate
and jobno='90020'

set @total = ISNULL(@direct,0) + ISNULL(@lbo,0) + ISNULL(@g1099,0) + ISNULL(@agency,0) + ISNULL(@nonbill,0) + ISNULL(@holiday,0) + ISNULL(@vacation,0)
set @nonbill = ISNULL(@nonbill,0) - (ISNULL(@holiday,0) + ISNULL(@vacation,0))

insert into cbetts.tblpayroll (Name,userid,location,direct,lbo,g1099,agency,nonbill,holiday,vacation)
values (@name,@uid,@location,ISNULL(@direct,0), ISNULL(@lbo,0), ISNULL(@g1099,0), ISNULL(@agency,0),ISNULL(@nonbill,0), ISNULL(@holiday,0), ISNULL(@vacation,0))


FETCH NEXT FROM payroll_cursor into @uid

END

CLOSE payroll_cursor
DEALLOCATE payroll_cursor

-- get rid of the 0 hour entries
delete cbetts.tblpayroll
where total = 0



GO

View 4 Replies View Related

How To Pull Records In Past 30 Mins Only

Jun 23, 2012

I need to show the count that occurred during the previous 30min. I've been told the following query doesn't work.

SELECT COUNT(*) FROM sampledata
WHERE (id = 254 AND sub_id = 731) AND (sampledate >= DATEADD(mi, -30, GETDATE()))

View 5 Replies View Related

Linked Server Problem After Few Mins

Aug 3, 2007



Dear All,

Before i get crazy please help me out, i have creatd a linked server between sql 2005 and sql 2000.

The security of linked server is how,

that i have used a window authitcation accout like domainuser and i m using this account as impersonate and with the option that "be made with the login's current security context".

Now the problem is when i used the application it is working fine, but after if login the applciation with a break of 15 mins or half an hour, i get the error

TCP Provider: An existing connection was forcibly closed by the remote host.

Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection."

I am unbale to undersatnd that why it so, y it fails after few mins, and if i check the particular Sp from backend it is working fine.

Moreover if a again create the link server with same setting as mentioned above it will work fine, but again after half an hour it will come up with same problem.

But if i create linked server with sql account that is available on both server using option "be made using this security context" every thing is working fine.

please help why problem in 1st case, and if my concept regarding linked server security is confusing do let me know any good link

Thnx l

View 1 Replies View Related

Scheduling The SSIS Package To Run After Every 2 Mins

Dec 12, 2006

How can i plan the execution of a package ?

For example, i want to execute the package every 2 minutes for all the time.

I do not want to use SQL Server Agent to do this. I want the package to self contained to do it.

Thanks
Rohit

View 4 Replies View Related

Need An Alert Notification If The Job Takes More 5 Mins To Execute:

Jan 25, 2008



Does any one have sample script which notify if "XYZ' job takes more than 5 mins to complete then needs to notify about the job status.

View 2 Replies View Related

How To Get Data Updated Every 5 Mins From Remote Server

Mar 24, 2007

Dear friends, We have a server put at US side and we are trying to load the data into another related database in India site, now the thing is that we want to update India data at an interval of 5 mins?

Is there any way to do it without effecting the performance of the US server?

thanks,

View 9 Replies View Related

The Log File For Database 'Home_alone' Is Full. Back Up The Transaction Log For The Database To Free Up Some Log Space.

Feb 4, 2008



Hi all

Iam working in Prodcution ENV,Please help how make space


The log file for database 'Home_alone' is full. Back up the transaction log for the database to free up some log space.

View 10 Replies View Related

High CPU Load On Service Start For Approx 10 Mins

Mar 12, 2008

This has been driving me crazy.

First noticed it when I went from JIT compiling of my .net app to pre-compiled via the command prompt, although I can't see that that's go anything to do with it...

My database is around 2gb and I'm using service broker.

If I drop a new version of my app into production, sqlserver.exe goes nuts and eats up the cpu.

Tonight, I stopped IIS and SQL Server, then dropped a new version in. I hadn't re-started IIS at this point... As soon as I started SQL Server, off it went again - eating up the CPU. I quickly launched a trace via the Profiler - no activity showing.

So, I started IIS after a couple of mins (still with the high cpu) and then just waited. After about 10 mins, SQL Server settled down and everything was normal again.

What is it doing when I start the SQL Server service?

Si

View 2 Replies View Related

Transact SQL :: Time Series Table Which Generates A Flag For Every 10 Mins

May 15, 2015

i have a time series table which generates a flag for every 10 mins. the table looks as below. I am trying to write a sql query which gives me the start date and end date of a particular flag, each time the flag starts. i tried to do it using cursors and actually joining the table to itself based on a 10 min offset but couldn't get the required results.

startdate enddate
flag
2009-11-02 23:30 2009-11-02 23:50
-999
2009-12-08 04:50 2009-12-08 04:50 -990

View 3 Replies View Related

Having Difficulty Setting Back Up To Back Up File Wihout Datetime Stamp SQL 2K

Apr 24, 2007

Hello,I'm trying to create a simple back up in the SQL Maintenance Plan that willmake a single back up copy of all database every night at 10 pm. I'd likethe previous nights file to be overwritten, so there will be only a singleback up file for each database (tape back up runs every night, so each daysback up will be saved on tape).Every night the maintenance plan makes a back up of all the databases to anew file with a datetime stamp, meaning the previous nights file stillexists. Even when I check "Remove files older than 22 hours" the previousnights file still exists. Is there any way to create a back up file withoutthe date time stamp so it overwrites the previous nights file?Thanks!Rick

View 5 Replies View Related

Mirroring :: Principal Database Get Role Back After Being Back On Line

May 14, 2015

New to Database Mirroring and I have a question about the Principal database server. I have a Database Mirroring setup configured for High-safety with automatic fail over mode using a witness.

When a fail over occurs because of a lost of communication between the principal and mirror, the mirror server takes on the roll of Principal. When communication is returned to the Principal server, at some point does the database that was the previous Principal database automatically go back to being the Principal server?

View 2 Replies View Related

Reporting Services :: Run Two Reports Back To Back Without Page Eject?

Jun 9, 2015

I need to run two reports each of A5 Size to run back to page and print on single A4 paper means in 1st half Sale bill will be printed and in second half Gate Pass Will Be Printed both report will be on same page and size and shape should be maintained. How to do it.

View 4 Replies View Related

How Do I Back-up &> Truncate &> Shrink &> Back-up SQL 2000

Jul 20, 2005

Hello,I am hoping you can help me with the following problem; I need to process the following steps every couple of hours in order to keep our Sql 2000 database a small as possible (the transaction log is 5x bigger than the db).1.back-up the entire database2.truncate the log3.shrink the log4.back-up once again.As you may have determined, I am relatively new to managing a sql server database and while I have found multiple articles online about the topics I need to accomplish, I cannot find any actual examples that explain where I input the coded used to accomplish the above-mentioned steps. I do understand the theory behind the steps I just do not know how to accomplish them!If you know of a well-documented tutorial, please point me in the right direction.Regards.

View 2 Replies View Related

Transact SQL :: To Display Days Hours Mins Format Based On Business Hours

Apr 22, 2015

I want to display Days Hours Mins Format.

I am Having two columns Like below,

Col1 (in days)    col2 (In Hours : Mins)
3days  4:5 

In this first have to  add Col1 and Col2 (Here one day is equals to 9 hours ) so the addition is 31.5

From this 31.5 I should display 3 Days 4 Hours 30 Mins because 31.5 contains 3 (9 hours) days 4 Hours and .5 is equals to 30 mins.

View 6 Replies View Related







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