Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
What Happens to the Current Transaction If the Session Is Killed
What Happens to the Current Transaction If the Session Is Killed? - Oracle DBA FAQ - Understanding SQL Transaction Management
✍: FYIcenter.com
If a session is killed by the DBA, the current transaction in that session will be rolled back and ended. All the database changes made in the current transaction will be removed. This is called an implicit rollback when session is killed. The following tutorial exercise shows you that the DBA KILL SESSION command forces the current transaction to be rolled back with all the changes uncommitted.
SQL> connect HR/fyicenter SQL> SELECT * FROM fyi_links; ID URL NOTES COUNTS CREATED ------- ---------------- ---------- ---------- --------- 101 FYICENTER.COM 07-MAY-06 110 CENTERFYI.COM 07-MAY-06 112 oracle.com 07-MAY-06 113 sql.com 07-MAY-06 SQL> DELETE FROM fyi_links where id = 112; 1 row deleted. SQL> DELETE FROM fyi_links where id = 113; 1 row deleted. SQL> SELECT * FROM fyi_links; ID URL NOTES COUNTS CREATED ------- ---------------- ---------- ---------- --------- 101 FYICENTER.COM 07-MAY-06 110 CENTERFYI.COM 07-MAY-06
Keep the "HR" SQL*Plus window as is, and open another window to run another instance of SQL*Plus.
>cd (OracleXE home directory) >.\bin\sqlplus /nolog SQL> connect SYSTEM/password Connected. SQL> SELECT sid, serial#, username, status, type 2 FROM V$SESSION WHERE username = 'HR'; SID SERIAL# USERNAME STATUS TYPE ---------- ---------- ------------------ -------- ----- 39 141 HR INACTIVE USER SQL> ALTER SYSTEM KILL SESSION '39,141'; System altered.
Go back to the "HR" SQL*Plus window.
SQL> SELECT * FROM fyi_links; ORA-00028: your session has been killed SQL> connect HR/fyicenter SQL> SELECT * FROM fyi_links; ID URL NOTES COUNTS CREATED ------- ---------------- ---------- ---------- --------- 101 FYICENTER.COM 07-MAY-06 110 CENTERFYI.COM 07-MAY-06 112 oracle.com 07-MAY-06 113 sql.com 07-MAY-06
As you can see, two records were rolled back as the session got killed by another session.
2007-04-18, 4768👍, 0💬
Popular Posts:
What are the five levels in CMMI? There are five levels of the CMM. According to the SEI, Level 1 – ...
Can Two Forms Be Nested? - XHTML 1.0 Tutorials - Understanding Forms and Input Fields Can two forms ...
How to set a HTML document's background color? document.bgcolor property can be set to any appropria...
What are the different accessibility levels defined in .NET ? Following are the five levels of acces...
Which bit wise operator is suitable for turning off a particular bit in a number? The bitwise AND op...