View previous topic :: View next topic
|
Author |
Message |
Rameshkumar.R
New User
Joined: 15 May 2008 Posts: 9 Location: chennai
|
|
|
|
Hi,
I deleted wrong table with commit is there any way to restore the deleted data ?
Thanks in advance |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
Hi,
I hope this incident happened in Development.
Contact your DBA he will do the restoring part...
Sushanth |
|
Back to top |
|
|
Rameshkumar.R
New User
Joined: 15 May 2008 Posts: 9 Location: chennai
|
|
|
|
Hi,
We have option of ROLLBACK with SAVEPOINT
I dont know how to execute it ? |
|
Back to top |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
Rameshkumar.R
New User
Joined: 15 May 2008 Posts: 9 Location: chennai
|
|
|
|
I deleted through SPUFI |
|
Back to top |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10873 Location: italy
|
|
|
|
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 |
|
|
sushanth bobby
Senior Member
Joined: 29 Jul 2008 Posts: 1020 Location: India
|
|
|
|
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 |
|
|
Rameshkumar.R
New User
Joined: 15 May 2008 Posts: 9 Location: chennai
|
|
|
|
Thanks a lot Bobby |
|
Back to top |
|
|
|