针对Oracle数据库来说,存在若干情况,会话断开,本次测试会话断开后,数据保留情况。
--以下考虑都是基于事务修改未commit
【Oracle复合ACID 持久性Durability,解释说明:事务结束,数据永久保留commit or rollback】
情况A,会话exit方式,数据是否保留,是rollback or commit
select count(*) from t1;40delete t1 where id>15;10 rows deleted.exitselect count(*) from t1;30
#SQL*Plus 执行exit 命令,退出会话,执行commit操作
情况二、kill session 'sid,serial#' immediate 方式
HR@env >delete t1 where id>14;2 rows deleted.>select sid,serial# from v$session where username='HR'; SID SERIAL# ---------- ---------- 780 33>alter system kill session '780,33' immediate; >select count(*) from hr.t1; COUNT(*)---------- 30
Kill session ,退出会话,执行rollback操作
情况三、kill spid 方式
>delete t1 where id>14;2 rows deleted.>select spid from v$process where addr=(select paddr from v$session where username='HR');SPID ------------------------ 18695 >! kill -9 18695SYS@env >select count(*) from hr.t1; COUNT(*) ---------- 30
Kill spid ,退出会话,执行rollback操作
情况四、shutdown immediate 方式
>delete t1 where id>14;>shutdown immediate;>startupselect count(*) from hr.t1; 30
shutdown immediate,退出会话,执行rollback操作
情况四、shutdown abort方式
>delete t1 where id>14;>startup force; >select count(*) from hr.t1; COUNT(*)---------- 30
shutdown abort,退出会话,执行rollback操作