简体   繁体   中英

Rollback in oracle 10g

I have a table from which I deleted one row

delete from patient where pid=500;

now, I rollback the above query and it is completed successfully but upon querying

select *from patient;

I get:

"no rows selected"

so, did rollback undid all operations in the session?

but table structure is present and as per my little knowledge I think delete just deletes the record which can be retrieved by rollback or is it because I did not commit my insertions?

  1. Delete from will only delete the data, not the table structure.
  2. The rollback should have worked for the DELETE from statement, which creates a save point before it deletes.
  3. If it still doesn't work, and if flashback for the table is enabled, to get the data back:

     ALTER TABLE xxTABLENAMExx ENABLE ROW MOVEMENT; FLASHBACK TABLE xxTABLENAMExx TO TIMESTAMP (SYSTIMESTAMP - INTERVAL '20' minute); ALTER TABLE xxTABLENAMExx DISABLE ROW MOVEMENT; 

Input your time period in minutes where you want the table rolled back to.

如果您使用的是任何类型的Java工具或任何其他在默认情况下使用autocommit on设置运行的工具,这将是会话autocommit on的结果,您失去了回滚功能(仍然可以选择flashback)来拥有回滚功能需要将会话设置为autocommit off

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM