Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Databases General > Re: How to undo...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 8 Topic 3081 of 3234
Post > Topic >>

Re: How to undo changes / deletes ?

by Johan Nel <johan555.nel555@[EMAIL PROTECTED] > Apr 24, 2008 at 04:28 PM

One way I use:

You can always create a datetime stamp on all your database tables to 
know when a record was created/updated/deleted.

If you have a status column to indicate Live/Archive or in some cases I 
use a value 0 = Live, 9 = Very old with each delete incrementing the 
status value with value + 1.  If value is 9 the record can be removed 
from the table.  Depending your User Permissions you are allowed to 
view/update archived records then.

Create triggers on your table:

DELETE TRIGGER that will trap the delete and only do a UPDATE on the 
Status column.

UPDATE TRIGGER trap the Update, INSERT a record in database with old 
values but with Status of "Archive", then do the update.

Only downside to this is that you need to do more work on keeping your 
relation****ps in place and a performance penalty in high volume 
transaction databases.

To rollback then is just a matter of deleting records created with a 
datetime stamp > supplied date and change status flag of last row found 
with datetime stamp < supplied date.

kunt wrote:
> Hi all,
> is there a way to undo changes in a database (e.g. those made because of

> a recent human error, an erroneous delete/update query)
> 
> For example reversing all transactions made in the last N days?
> 
> On any database? In particular I am most interested in postgres and 
> mysql... secondarily Oracle.
> 
> Thank you
 




 8 Posts in Topic:
How to undo changes / deletes ?
kunt <kunt@[EMAIL PROT  2008-01-23 18:51:45 
Re: How to undo changes / deletes ?
DonO <don.orban@[EMAIL  2008-01-23 12:16:04 
Re: How to undo changes / deletes ?
Michael Austin <mausti  2008-01-23 14:45:04 
Re: How to undo changes / deletes ?
Lennart <Erik.Lennart.  2008-01-24 10:24:55 
Re: How to undo changes / deletes ?
Thomas Kellerer <FJIFA  2008-01-24 19:33:48 
Re: How to undo changes / deletes ?
Johan Nel <johan555.ne  2008-04-24 16:28:28 
Re: How to undo changes / deletes ?
Marco Mariani <marco@[  2008-04-28 13:04:41 
Re: How to undo changes / deletes ?
Philipp Post <Post.Phi  2008-04-29 06:21:20 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Wed Aug 20 8:02:31 CDT 2008.