Transaction Rollback And Database Restore-urgent
Dec 8, 2000
Hi,
We have an order posting stored procedure that's been executing for 14 hours now. This procedure has simple update statements but all the tables updated have triggers which update other tables with triggers and so on.
This procedure hasn't commited yet. I have a full database backup from last night and transaction log backup from this morning while it was running. I want to kill this job and restore database from last backup. Only thing I am afraid of is that it will take too long to roll back which I have no estimate of time. Is there any faster way to get rid of all the uncommited transactions? Has anybody rolled back such a massive transaction? Any idea on how long it can take? Can it affect the overall server performance as this is the main production ERP server.
I can see in profiler that this procedure is still running and not hung.
View 1 Replies
ADVERTISEMENT
Oct 16, 2014
I have a wrapper stored procedure ProcMain_wrapper that executes in one main dataabase and it calls child stored procedure in multiple databases. Does the rollback occur in all the databases if the stored procedure fails in any one of the multiple databases?
create procedure dbo.db_Main.ProcMain_wrapper (
declare @curClientCode as cursor ,@db varchar(10),@dbName varchar(20)
BEGIN TRANSACTION TRAN1
BEGIN TRY
SET @curClientCode = CURSOR FOR
SELECT [name] from sys.databases where name like 'dbclient_%'
[code]....
View 2 Replies
View Related
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
Oct 20, 1999
I have a 95GB database (dump file is 73 GB) and I want to restore it on a different server.
I have created 95GB devices and tried to restore it, but it failed because of reason " page xxx had non-log objectid xxx while checking in syslogs" .
I tried locating the object on that page but it showed page is in cache.
View 2 Replies
View Related
May 2, 2007
Hi there...
Is it possible to undoing the restore database??
I accidentally restore an old database backup to my current database!!
The worst is I don't have any new backup for my current database....:eek:
So ... does anybody here know how to solve this problem??
Can I undo the transaction log?? if it is possible.. could you please teach me the way to undo it?? I'm desperate.....
I'd greatly appreciate if you can answer me....
Thanks in advance...
__________________
Best Regards,
Debbie
View 8 Replies
View Related
Aug 8, 2007
Mrs,
I'm having a serious problem in SQL 2000 SP3 Database which is used Business Applications.
Today, I tryied to take backup in service time by the Enterprize Manager, the following
error occured and could not take backup.
--------------------------------------------------------------------------------------------------------------------------------------
Error 926 : Database '[database name]' cannot opened. It has been marked SUSPECT by recovery.
See the SQL Server errorlog for more information.
--------------------------------------------------------------------------------------------------------------------------------------
After that, we tried same operation 3 times. But result is same.
After sometime, end-user report us that they can not log-in to database.
So we tried to dettach this database and attached it.
We success to dettach, but we can not attached it.
Also we tried to restore this database from Yesterday's backup file by using Enterprize Manager,
but the following error occured, and could not complete.
This backup file was generated daily backup task in Maintenance Plan in Enterprize Manager.
--------------------------------------------------------------------------------------------------------------------------------------
Microsoft SQl-DMO(ODBC SQLState:42000)
The media family on device "E:ccd......xxx.bak" is incorrectly formed.
SQL Server cannot process this media family.
RESTORE DATABASE is terminating abnormally.
--------------------------------------------------------------------------------------------------------------------------------------
We need to recover the database immediately not to stop the end-user business process.
Please help us.
Yamagury.
View 6 Replies
View Related
Aug 10, 2007
Hi,
I was wondering how I could restore a bkp file into a database with a different name. For example, I made a backup of T1.mdf and i want to restore t1.bkp to T2.mdf.
I am using VB.Net to do the backup and restore.
Is there any way of doing it?
Thanks!
View 21 Replies
View Related
May 8, 2007
I am having difficulty restoring a database (DB_1) with 2 datafiles and one log file, DB Structure is as following:
Filegroup PRIMARY with file name 'fnm_data' with physical file name and location D:dbfile_1.mdf,
Filegroup 'FG1' with file name 'fgnm1_data1' with physical file name and location F:dbfile_FG1.mdf,
One log file with file name 'fnm_log' with physical file name and location (E:loglog_db.ldf)
{Note} Logfile resides on E drive whereas Datafiles reside on several other drives.
I need to restore the DB on another machine. And I need to move the log file to a drive other than E.In this case it is K drive. Hence I have used the following code,
restore log DB_1 from disk='M:kupccciclog.txt'
WITH RESTRICTED_USER , MOVE 'fnm_log'
TO 'K:DBlog_db.ldf', recovery, replace,RESTART
go
When I try to restore from backup files, I keep error message saying "Physical file name E:loglog_db.ldf may be incorrect." 'fnm_log' cannot be restored. Use Move command to identify a valid location for the file.
Even though I am using Move command to move the log file.
Then I found that if I create a drive with E: and a folder named 'log' then restore program runs alright. That is, when E:log exists then code does run smoothly. All the restore code is looking for the presence of path of the log file from where it is been backed up. In this case it is E:log folder. Once the database is restored I could kill that directory and nothing happens. Also log file has been restored on K:DB only.
Why the restore code is looking for the initial drive letter and path even though I have used Move command? Is there an issue in my code?
Any help will be highly appreciated.
View 3 Replies
View Related
May 18, 2005
If I have a database backup from sunday, and a failure occurs monday... Can the backup .mdf and .ldf files be attached, and the backup log after the point of failure be applied to them?
The problem I am having is it looks like you can only restore from a .bak file, and then apply the log at the point of failure. IT doesn't look like you can restore the .ldf/.mdf files, and then apply the backup log from the point of failure.
Can someone please help? I'm in desparate need of fixing this !
Thanks,dp
View 1 Replies
View Related
Feb 21, 2008
Hi guys, just wanna ask about the backup and restore database method. What's the best way for database and restore which able to view all the transaction logs after the database being restored. Currently I backup my database daily for recovery purposes. However, if I restore the backup file at another server and use SQL log application for viewing the prefer database's transaction log, it shows all the previous log had been truncated.
Therefore, I want to know is there any way that able to get the transaction logs after restore from a database backup file? Hope able to get any assistance here as soon as possible. Thank you.
Best Regards,
Hans
View 1 Replies
View Related
Sep 13, 2007
We have received a backup of a database from an external company for a project that we are taking over. We have attempted to restore the database and it fails giving us the error: "Internal consistency error occurred."
We have run the restore verifyonly command with the results: "The backup set is valid." However, I don't have confidence that the verify is telling the complete story.
It appears that the database is restored and the overall restore is failing on the transaction log file.
Any help is appreciated. This is rather urgent.
View 4 Replies
View Related
Dec 9, 2003
Hi!
I just made a transaction which writes and reads some data from a database as one unit. Now, I would like to know, what happens, if this transaction does not commit, but instead performs a rollback? Should I use a boolean loop which keeps on trying the transaction until it commits or is there an alternative? I would appreciate any suggestions or help!
Thanks!
Timothy
View 1 Replies
View Related
Feb 26, 2007
How do I find out the transaction name to rollback. Thanks
View 1 Replies
View Related
Apr 10, 2008
Hi all
I received the following message in the application log files while the QA team is tesing the application.
06:40:31 [ERROR ] com.inet.tds.ao: The connection is closed: there was an error on the database could not rollback the transaction
I checked at the SQL server logs and found any thing odd.
what does the above error indicates..
Thanks.
View 1 Replies
View Related
Jul 31, 2007
Hi all,
How to work rollback transaction in sql server.
Thanks&Regards
msrs
View 2 Replies
View Related
Jul 20, 2005
If someone could help me with this I will be in debt to you!I am a .net developer who is working on a system that has a sql server2000 backend. On the weekends, I work from home and I have MSDE on mylaptop. This morning I went to update the main SQL server as I addedsome new views .. however I managed to import the data too!!Therefore I have overwritten my local data to the main sql serverdatabase, which has ressulted in loss of loads of work!Can I rollback to the version before I exported my data from MSDE to themain SQL server. I did the export by using enterprise manager and rightclicking on the table on my local msde and then sending it to the realsql server!Please please please help??*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
View 1 Replies
View Related
Jun 15, 2007
i have a froeach loop,in which i have data flow task,which i need to rollback if any other task fails..
here i need to accept multiple files and i have to give a one second pause for between each file for this i have used a dummy for loop,as i am using this for loop i cant give the for each loop property Transaction Option as required...but i need to rollback if any task fails...i have a screen shot of the for each loop
please give me some ideas on this.
Thanks in advance
View 1 Replies
View Related
Jul 10, 2006
Hi everyone,
In the following T-SQL code snippet,when I attempt to insert more than one record I encounter an error because of the following trigger but I have some doubts about the performation of ROLLBACK TRANSACTION in here. So there is only one transaction occured in the specified table that contain both trigger and the specified table however I supposed that when we call ROLLBACK TRANSACTION, the transaction is aborted. But the code run the Raiserror statement which is located in after the ROLLBACK TRANSACTION statement. So why do this code( Raiserror) is run ? Should not it be terminated because of the ROLLBACK TRANSACTION statement ??
ALTER TRIGGER kimlikNo_Degistir
ON Bilgi FOR INSERT
AS
IF(SELECT COUNT(*) FROM Inserted) > 1
BEGIN
ROLLBACK TRANSACTION
RAISERROR('You are not allowed to enter more than one record',12,1)
END
ELSE
BEGIN
UPDATE M SET M.KimlikNo = B.Kimlk + M.KimlikNo FROM Muhasebe as M INNER JOIN Inserted AS B ON M.Ad = B.Ad
END
Thanks
View 8 Replies
View Related
Dec 14, 2007
I made a mistake and ran a delete query that I should not have. There have been no other transactions/modifcations to the database since my delete query.
Can I roll this back from the log file?
Please help as soon as you can!
THANKS!!
View 7 Replies
View Related
Aug 6, 2006
With the function below, I receive this error:Error:Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.Function:Public Shared Function DeleteMesssages(ByVal UserID As String, ByVal MessageIDs As List(Of String)) As Boolean Dim bSuccess As Boolean Dim MyConnection As SqlConnection = GetConnection() Dim cmd As New SqlCommand("", MyConnection) Dim i As Integer Dim fBeginTransCalled As Boolean = False
'messagetype 1 =internal messages Try ' ' Start transaction ' MyConnection.Open() cmd.CommandText = "BEGIN TRANSACTION" cmd.ExecuteNonQuery() fBeginTransCalled = True Dim obj As Object For i = 0 To MessageIDs.Count - 1 bSuccess = False 'delete userid-message reference cmd.CommandText = "DELETE FROM tblUsersAndMessages WHERE MessageID=@MessageID AND UserID=@UserID" cmd.Parameters.Add(New SqlParameter("@UserID", UserID)) cmd.Parameters.Add(New SqlParameter("@MessageID", MessageIDs(i).ToString)) cmd.ExecuteNonQuery() 'then delete the message itself if no other user has a reference cmd.CommandText = "SELECT COUNT(*) FROM tblUsersAndMessages WHERE MessageID=@MessageID1" cmd.Parameters.Add(New SqlParameter("@MessageID1", MessageIDs(i).ToString)) obj = cmd.ExecuteScalar If ((Not (obj) Is Nothing) _ AndAlso ((TypeOf (obj) Is Integer) _ AndAlso (CType(obj, Integer) > 0))) Then 'more references exist so do not delete message Else 'this is the only reference to the message so delete it permanently cmd.CommandText = "DELETE FROM tblMessages WHERE MessageID=@MessageID2" cmd.Parameters.Add(New SqlParameter("@MessageID2", MessageIDs(i).ToString)) cmd.ExecuteNonQuery() End If Next i
' ' End transaction ' cmd.CommandText = "COMMIT TRANSACTION" cmd.ExecuteNonQuery() bSuccess = True fBeginTransCalled = False Catch ex As Exception 'LOG ERROR GlobalFunctions.ReportError("MessageDAL:DeleteMessages", ex.Message) Finally If fBeginTransCalled Then Try cmd = New SqlCommand("ROLLBACK TRANSACTION", MyConnection) cmd.ExecuteNonQuery() Catch e As System.Exception End Try End If MyConnection.Close() End Try Return bSuccess End Function
View 5 Replies
View Related
Apr 6, 2006
I am moving some code that was created in visual studio 2002 into Visual Web Developer 2005 express edition and am getting a warning on some of my code before compilation.
The warning is "Variable lSqlTransaction is used before it has been assigned a value. A null reference exception could result at runtime". I experienced no problems in vs2002.
The offending line is the rollback command within the exception. If I move it out of the exception it no longer flags the warning, if I move it after the throw statement it now longer flags the warning. Any help appreciated.
Heres the code
Public Shared Sub ExecuteNonQuery(ByVal lSQLCommand As SqlCommand)
Dim lSQLConnection As New SqlConnection(SQLConnString(enmSQLDB.enmSQLDB_TPSDB))
Dim lSQLTransaction As SqlTransaction
Try
'-----------------------------------------------------
'Try and open the database
'-----------------------------------------------------
lSQLConnection.Open()
'-----------------------------------------------------
'Create a transaction
'-----------------------------------------------------
lSQLTransaction = lSQLConnection.BeginTransaction
'-----------------------------------------------------
'Assign the connection and transaction to our object
'-----------------------------------------------------
lSQLCommand.Connection = lSQLConnection
lSQLCommand.Transaction = lSQLTransaction
'-----------------------------------------------------
'Execute the stored proc
'-----------------------------------------------------
lSQLCommand.ExecuteNonQuery()
'-----------------------------------------------------
'Use the transaction to commit the changes
'-----------------------------------------------------
lSQLTransaction.Commit()
Catch ex As Exception
'-----------------------------------------------------
'If any errors have been thrown then roll back without
'commiting....
'-----------------------------------------------------
lSQLTransaction.Rollback()
Throw New Exception("An error has occured whilst trying to update the database. " & _
"Your changes have not been saved.", ex)
Finally
If lSQLConnection.State = ConnectionState.Open Then
lSQLConnection.Close()
End If
End Try
End Sub
View 1 Replies
View Related
Nov 20, 1998
DECLARE @A INT, @B INT,@C INT
SELECT @A=2,@B=3
SELECT @C=@A*@B
SELECT @C
BEGIN TRANSACTION A
SELECT @A
SELECT @B
SELECT @C
END TRANSACTION A
THIS CODE PROCDUE the following errors
Msg 156, Level 15, State 1
Incorrect syntax near the keyword 'END'.
Can anyone help me telling me what I am doing wrong ?
thanks
Ali
View 1 Replies
View Related
Jul 23, 2005
In VB 6, using ADO, SQL Server 2000In my VB program I use the connection object (abc)to begin a transaction.abc.BeginTransI then, in my VB App, using ADO, execute multiple stored proceduresinserting records into temp tables ##Meetings,reading them, and then finnaly executing (from my VB appusing ADO) as stored procedure that inserts recordsinto a non-temp table.I then have a abc.CommitTransWhat if my VB program crashes before thecommittrans is executed, I assume that the transactionis rolled back, even though no explicit rollbackis issued, because my VB program has crashed.Thank You for your help,Laurence NuttallProgrammer Analyst IIIUCLA - Division of Continuing Education
View 1 Replies
View Related
Aug 14, 2006
Hi
We are loading data from one extract file in to 4 different database tables. When we are loading if the first table gets loaded without any issues and the second table loading gives any issues, we need to rollback the data loaded in to the first table also.
In the package for achieving this, we are using Sequence container. In the sequency container we are having 4 different tasks for loading data to 4 different tables from the same extract file. We also tried setting the different transaction options given in the properties box of the packages, container and tasks.
Also we tried the properties by setting as mentioned in the Test# 7 and 8 in the following URL
http://www.sqlservercentral.com/columnists/jthomson/transactionsinsqlserver2005integrationservices.asp
Could you please explain what properties we need to give.
Thanks
Kumaran
View 8 Replies
View Related
May 7, 2007
Hello ,
I have a Dataflow where I insert data from SQL to Oracle and SQL Connection needs to have RetainSameConnection = TRUE. I have Oracle Services for Microsoft Transaction Server installed and I can rollback the transaction only if SQL Connection has RetainSameConnection = FALSE and TransactionOption = Required. Is there any possibility to rollback the Oracle transaction with having SQL RetainSameConnection = TRUE and TransactionOption = Supported?
Thanks.
View 4 Replies
View Related
Aug 19, 2004
Hi,
i would like to know how to determine a transaction is already rollback so that we dont have to reroll back again and get an exception like below:
This SqlTransaction has completed;
it is no longer usable. at System.Data.SqlClient.SqlTransaction.Rollback()
Please help because when i tried to do this: objTrans.rollback() and i got the above exception.
Regards,
View 3 Replies
View Related
Feb 17, 2006
When I write code for a multiple statements transaction do I need to check 'if @@ERROR > 0 ' after each SELECT, INSERT, DELETE or UPDATE statement so that the 'rollback tran' statement can be given, or SQL server will automatically rollback the transaction and we don't need to check for @ERROR > 0 ?
View 2 Replies
View Related
Jul 10, 2007
Hi everyone,
I am reading about the Rollback transaction but I'm not sure if it's the feature I need.
My application is going to update a few tables, but my programmer said that it will be done using more than 1 transaction.
For example, if I want to create a new employer with all the detailed informations, tables will be filled when the user complete the insertion of a part of data. If he decides to abort the operation, i'd like to delete all the values inserted before with the other queries. Is it possible to create a "savepoint" and roll back all transactions processed from this savepoint?
thank you!
View 6 Replies
View Related
Feb 8, 2006
Hi,I have a problem. When my computer loses connection toserver during transaction it is rolled back automaticlyby server after 2-5 minutes. During the time a can resetmy computer, run my program again and I can seedata from not commited transaction becouse I have toset isolation level to read uncommited.How to force the server immediately rollback transaction?TIAclint
View 1 Replies
View Related
May 28, 2008
Hello,
I have a stored procedure that updates my table with values entered in a datatable in my windows app.
An error occurs 1/2 way through the update process. I assumed that by implementing the rollback transaction command that the inserted lines would not be saved to my db. This is not the case.
I will elaborate a little more on what I need. From my windows app I have a datatable with 100 new rows that need to be written to my db. This I can do. However, a problem crops up should there be an error during the transfer. Let's say I have 100 rows in my datatable in my windows app, and row 57 causes an error, what is happening is that rows 1-56 are committed and 57-100 are not. What I need is for 1-100 to NOT be committed to my DB should there be a snag along the way. I need a code sample as I'm having way too much difficulty with this as is.
The basic code that copies to my db(sans rollback):
BEGIN
SET NOCOUNT ON
INSERT INTO userprofile (uid, uname, ustatus)
VALUES @userid, @username, @userstatus;
END
Thank You.
View 3 Replies
View Related
Oct 15, 2007
We have a locked table and all I need is a way to show all open trans, so I can roll teh offender back
View 1 Replies
View Related
May 6, 2007
Hi all, I have a program that needs to delete records, then re-insert new records to a table. But I need to rollback the transaction IF the insert is not success (error occured). The delete and insert are in 2 difference stored procedure (which have rollback transaction) that calling from 1 stored procedure. My problem is that if Insert is not successful, but the records already deleted previously. How can we rollback the delete transaction when insert is not successful?
Note: if possible, I don't want to delete the records AFTER the insert is successful, or create a temp table to stored the deleted records
=======================================
create stored procedure combine_sp
as
begin
call delete_sp -- have rollback transaction in the delete_sp
-- what to do if following has error occured, but we already deleted the records above?
call insert_sp -- have rollback transaction in the insert_sp
end
go
=======================================
Thanks a lot.
View 3 Replies
View Related
Jun 15, 2008
I have a transaction that calls one other sproc and also executes another set of queries, but for some reason I'm getting error 266: "Msg 266, Level 16, State 2, Procedure AddUserHaveTag, Line 26. Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 0, current count = 1."There is NO transaction in the sproc AddTag. It is also included below.Here is the sproc with the transaction:1 set ANSI_NULLS ON2 set QUOTED_IDENTIFIER ON
3 go4
5 ALTER PROCEDURE [dbo].[AddUserHaveTag] 6 (7 @UserHaveID int,8 @Tag varchar(24),9 @UserHaveTagExists bit OUTPUT
10 )11 AS12 SET NOCOUNT OFF13 DECLARE @ErrorCode int14 DECLARE @TagID int15 DECLARE @TagExists bit16
17 BEGIN TRAN
18 19 -- Call proc to add tag to Tags table
20 EXEC AddTag @Tag, @TagID OUTPUT, @TagExists OUTPUT
21
22 -- Check for errors
23 IF @ErrorCode <> 0 GOTO ERROR24
25 -- Check for existing record, otherwise insert
26 IF EXISTS (SELECT 1 FROM UserHaveTags WHERE UserHaveID = @UserHaveID AND TagID = @TagID)27 BEGIN28 SET @UserHaveTagExists = 129 RETURN 030 END31 ELSE32 BEGIN33 INSERT INTO UserHaveTags (UserHaveID, TagID) VALUES (@UserHaveID, @TagID)34 SET @UserHaveTagExists = 035 END
36
37 -- Check for errors
38 IF @ErrorCode <> 0 GOTO ERROR39
40 COMMIT TRAN
41
42 ERROR:43 IF (@ErrorCode <> 0)44 BEGIN45 PRINT 'Unexpected error occurred!'
46 ROLLBACK TRAN47 END
Here is the AddTag sproc:1 set ANSI_NULLS ON2 set QUOTED_IDENTIFIER ON
3 go4
5 ALTER PROCEDURE [dbo].[AddTag] 6 (7 @Tag varchar(24),8 @TagID int OUTPUT,9 @TagExists bit OUTPUT
10 )11 AS12 SET NOCOUNT OFF13 14 IF EXISTS (SELECT 1 FROM Tags WHERE Tag = @Tag)15 BEGIN16 SELECT @TagID = TagID FROM Tags WHERE Tag = @Tag17 SET @TagExists = 118 RETURN 019 END20 ELSE21 BEGIN22 INSERT INTO Tags (Tag) VALUES (@Tag)23 SET @TagID = SCOPE_IDENTITY()24 SET @TagExists = 025 ENDAny advice?Also if you see any glaring errors or things I could be doing better, I'm open to suggestions. I'm fairly new to sprocs and transactions. Thanks,Travis
View 4 Replies
View Related