Restore table data till specified date [message #618630] |
Mon, 14 July 2014 08:06 |
Database admin
Messages: 365 Registered: September 2006 Location: india
|
Senior Member |
|
|
Hi,
There is a situation where i have updated table with data till 14th of June 2014
without any backup and found it to wrong and user want to restore table data to
13th of June 2014.Now the user want to remove the data loaded after 13th of June 2014
i.e remove data of 14th of June.
Could you guide me how to restore the table data till 13th of June 2014.
Regards,
Srini
[Updated on: Mon, 14 July 2014 08:07] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
Re: Restore table data till specified date [message #618681 is a reply to message #618630] |
Mon, 14 July 2014 15:19 |
tim2boles
Messages: 38 Registered: August 2008 Location: Clarksburg, WV
|
Member |
|
|
I am thing perhaps they truly do mean 13th of July instead of 13th of June.
With the information given as it is the answers so far do seem correct. I am wondering though when it is said "without backup" do they truly mean the entire database is not being backed up or that just this table was not being backed up.
If the database is backedup, I could see restoring it to a different machine and doing a point-in-time recovery. There is all kinds of potential there depending on the setup of the system. Export/Import, scripts to do comparisons, etc.
The database itself is not being backed up then why worry about the data in the table at all. If you are not backing up your database then the data is not valuable to begin with.
Regards
Tim
|
|
|
|
|
Re: Restore table data till specified date [message #618688 is a reply to message #618652] |
Mon, 14 July 2014 21:14 |
Database admin
Messages: 365 Registered: September 2006 Location: india
|
Senior Member |
|
|
Hi Gazzag,
I read flashback query and found it to be interesting.
I read the topic 'flashback Data Archive to Recover Data' and found it suitable for answer i am looking for.
I hope the below quote is similar to the one i am looking for.
Quote:Scenario: Using Flashback Data Archive to Recover Data
An end user recovers from erroneous transactions that were previously committed in the database. The undo data for the erroneous transactions is no longer available, but because the required historical information is available in the Flashback Data Archive, Flashback Query works seamlessly.
Lisa manages a software development group whose product sales are doing well. On November 3, 2007, she decides to give all her level-three employees who have more than two years of experience a salary increase of 10% and a promotion to level four. Lisa asks her HR representative, Bob, to make the changes.
Using the HR web application, Bob updates the employee table to give Lisa's level-three employees a 10% raise and a promotion to level four. Then Bob finishes his work for the day and leaves for home, unaware that he omitted the requirement of two years of experience in his transaction. A few days later, Lisa checks to see if Bob has done the updates and finds that everyone in the group was given a raise! She calls Bob immediately and asks him to correct the error.
At first, Bob thinks he cannot return the employee table to its prior state without going to the backups. Then he remembers that the employee table has Flashback Data Archive enabled.
First, he verifies that no other transaction modified the employee table after his: The commit time stamp from the transaction query corresponds to Bob's transaction, two days ago.
Next, Bob uses these statements to return the employee table to the way it was before his erroneous change:
DELETE EMPLOYEE WHERE MANAGER = 'LISA JOHNSON';
INSERT INTO EMPLOYEE
SELECT * FROM EMPLOYEE
AS OF TIMESTAMP (SYSTIMESTAMP - INTERVAL '2' DAY)
WHERE MANAGER = 'LISA JOHNSON';
Bob then reexecutes the update that Lisa had requested.
How to ensure Flashback Data Archive is enable in database and would it have any impact to users and database in enabling this feature ?
Regards,
Srini
|
|
|
|
Re: Restore table data till specified date [message #618751 is a reply to message #618688] |
Tue, 15 July 2014 03:50 |
gazzag
Messages: 1119 Registered: November 2010 Location: Bedwas, UK
|
Senior Member |
|
|
Note that there is a difference between Flashback Query and Flashback Database. The latter needs a bit more configuration at database level - as Michel states, read the documentation - the former relies on the DB_FLASHBACK_RETENTION_TARGET parameter which can be used to specify the time (in seconds) that Oracle will attempt to maintain any data. In fact, there is an article on OraFaq's here. It's a few years old but may help get you started.
HTH
-g
|
|
|
|
|
Re: Restore table data till specified date [message #618773 is a reply to message #618686] |
Tue, 15 July 2014 06:28 |
tim2boles
Messages: 38 Registered: August 2008 Location: Clarksburg, WV
|
Member |
|
|
Often when trying to help someone it is like shooting a target in the dark with only a general idea of what the target looks like and the choices you have in items to shoot at the target with. You need to communicate your situation and options more completely.
You now say that
Quote:Actualy this issue happend during peak hours in the morning and backup is taken everyday in the night.
So could not use backup to restore the data.
Don't just assume you can not use the backup to restore the data. You might be right be there are some fairly cleaver people in this forum they might have some iteas on what you can do. Tell us more about the 'backup' you do. How often do you backup your system up? What commands do you use to backup your system? How long are the backups maintained?
You now say that
Quote:Sorry to say by mistake i used the word 'updated'.Actually its 'data added into table'.
Well "added" often can be "deleted" if the primary key is known and used to add the data. Or if perhaps there are other "key" fields within the table that will allow you to narrow you delete statement to the appropriate data loaded.
So as Blackswan indicated give us the details...
Quote:can you post any actual logfile showing what was really done & when it was done and not just your uncertain recount of what you think you saw?
post CREATE TABLE statement(s) for any/every table that was adversely affected by the incorrect data load
If you have the actual DML that inserted the rows, let us know that. If not the actual DML give us details on the process and include any log files that might be helpful.
A solution is only as good as the building blocks you provide. Right now I feel we are stumbling over pebbles when there may be good foundation stones that can be used.
|
|
|