Oracle ROLLBACK不返回数据

时间:2014-08-28 09:05:18

标签: oracle commit rollback

我在删除数据时犯了一个错误。删除后我没有运行commit语句,但是在运行ROLLBACK时,数据仍然缺失。

我跑了类似的东西:

create table temp_ids as
select myid ABC --This might be part of the mistake as I did not alias this to my_id
from XX WHERE xx;
create index idx01 on temp_ids (my_id);

delete from YYY where my_id in (select my_id from temp_ids);
delete from XXX where my_id in (select my_id from temp_ids);
delete from ZZZ where my_id in (select my_id from temp_ids);
commit;

我正在使用sqldeveloper,在前两次删除之后(在它进入提交之前)我点击了取消查询按钮。但回滚不会返回前两个表中的数据 还有其他选择吗?
我正在使用Oracle Database 11g 11.2.0.3.0版 - 64位生产

更新:

~~~~~~~

根据要求,这是完整的陈述:

create table temp_events as
select 
DUP.Event_ID Dupl
from EVENT_REV MASID INNER JOIN EVENTS MAS ON MASID.Event_ID = MAS.Event_ID
left join EVENTS DUP
ON 
MAS.IMPACT = DUP.IMPACT AND  
INNER JOIN EVENT_REV DUPID ON DUPID.Event_ID = DUP.Event_ID 
WHERE 
MAS.person_id = 'JSteward'
ORDER BY MAS.event_id;
create index idx01 on temp_events(event_id);

delete from EVENT_REV where event_id in (select event_id from temp_events);
delete from EVENT_TASKS where event_id in (select event_id from temp_events);
--Here is where I hit the Cancel Query button and ran ROLLBACK.
delete from TIMESHEETS where event_id in (select event_id from temp_events);
delete from TRIPS where event_id in (select event_id from temp_events);
commit;

temp_events表有大约800条记录,如: C00156 C45568 C41155 D12355

1 个答案:

答案 0 :(得分:0)

以下解决方案适合我。谢谢Alex Poole。

我运行了以下内容,它实际上用数据填充了新表:

Create table EVENT_REV_RESTORE AS 
select * from EVENT_REV
AS OF TIMESTAMP
   TO_TIMESTAMP('2014-08-28 10:00:00', 'YYYY-MM-DD HH:MI:SS');