IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to rollback a commited delete Query


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Rameshkumar.R

New User


Joined: 15 May 2008
Posts: 9
Location: chennai

PostPosted: Tue Jul 28, 2009 11:04 am
Reply with quote

Hi,
I deleted wrong table with commit is there any way to restore the deleted data ?

Thanks in advance
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Jul 28, 2009 12:01 pm
Reply with quote

Hi,

I hope this incident happened in Development.
Contact your DBA he will do the restoring part...

Sushanth
Back to top
View user's profile Send private message
Rameshkumar.R

New User


Joined: 15 May 2008
Posts: 9
Location: chennai

PostPosted: Tue Jul 28, 2009 12:07 pm
Reply with quote

Hi,
We have option of ROLLBACK with SAVEPOINT
I dont know how to execute it ?
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Jul 28, 2009 12:36 pm
Reply with quote

Ramesh,

ROLLBACK TO SAVEPOINT comes into picture only for LUW(logical unit of work) not for a particular time frame.

Example of savepoints(courtesy : DB2 V9 Application programing & SQL Guide)
i.e., it goes to savepoint B
Code:
EXEC SQL SAVEPOINT A;
...
EXEC SQL SAVEPOINT B;
...
EXEC SQL ROLLBACK TO SAVEPOINT;


If you give
Code:
EXEC SQL ROLLBACK TO SAVEPOINT A;

It goes to SAVEPOINT A

You have to code this in a program.

By the way, How did you delete the data ? using a program or spufi or etc.,


Sushanth
Back to top
View user's profile Send private message
Rameshkumar.R

New User


Joined: 15 May 2008
Posts: 9
Location: chennai

PostPosted: Tue Jul 28, 2009 12:39 pm
Reply with quote

I deleted through SPUFI
Back to top
View user's profile Send private message
enrico-sorichetti

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Tue Jul 28, 2009 12:57 pm
Reply with quote

when these events happen, letting time go by worsen the whole thing

the data/table(*) is lost, and you lost about two hours in recovering the situation

talk to Your DBA' s

(*)
some data rows if You issued a DELETE
the table itself if You issued a DROP
Back to top
View user's profile Send private message
sushanth bobby

Senior Member


Joined: 29 Jul 2008
Posts: 1020
Location: India

PostPosted: Tue Jul 28, 2009 1:27 pm
Reply with quote

Ramesh,

SAVEPOINT doesn't work in spufi. But you can use COMMIT & ROLLBACK statements like the following.
Code:
SELECT * FROM BOBT1.COUNTRY;       
INSERT INTO BOBT1.COUNTRY         
       VALUES (250,'PARIS','B-13');
SELECT * FROM BOBT1.COUNTRY;       
ROLLBACK;                         
SELECT * FROM BOBT1.COUNTRY;       
commit;                           


And do remember AUTOCOMMIT is usually set to YES in spufi ? set it to NO, so after executing the query DB2 will ask whether you want to commit, rollback or defer.

Sushanth
Back to top
View user's profile Send private message
Rameshkumar.R

New User


Joined: 15 May 2008
Posts: 9
Location: chennai

PostPosted: Tue Jul 28, 2009 1:53 pm
Reply with quote

Thanks a lot Bobby
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts DELETE SPUFI DB2 1
No new posts DSNTIAUL driven delete IBM Tools 0
No new posts RC query -Time column CA Products 3
No new posts Dynamically pass table name to a sele... DB2 2
No new posts How to delete a user's alias from the... JCL & VSAM 11
Search our Forums:

Back to Top