Interview Questions Answers.ORG
Interviewer And Interviewee Guide
Interviews
Quizzes
Home
Quizzes
Interviews DB Oracle Interviews:Concepts and ArchitectureData AccessDatabase ArchitectureDatabase ManagementDatabase Security OracleDistributed ProcessingFlexfieldForms ReportsGeneral OracleMemory ManagementMTO-SAP Financial AccountingOCIOracle AOLOracle AROracle Backup RecoveryOracle D2KOracle DatabaseOracle Database DeveloperOracle DB OptimizationOracle DBAOracle DeveloperOracle ETLOracle Forms 3.0Oracle Forms 4.0Oracle GLOracle PL-SQLOracle RMANOracle ScenariosOracle SecurityOracle SQLOracle System ArchitectureOracle Technology Network (OTN)Programmatic ConstructsRAC (Real Application Clusters)SQL Plus
Copyright © 2018. All Rights Reserved
Oracle Database Interview Question:
What Happens to the Current Transaction If the Session Is Killed?
Submitted by: AdministratorIf 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/globalguideline
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06
112 oracle.com 07-MAY-06
113 sql.com 07-MAY-06</pre>
SQL> DELETE FROM ggl_links where id = 112;
1 row deleted.
SQL> DELETE FROM ggl_links where id = 113;
1 row deleted.
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06</pre>
Submitted by: Administrator
SQL> connect HR/globalguideline
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06
112 oracle.com 07-MAY-06
113 sql.com 07-MAY-06</pre>
SQL> DELETE FROM ggl_links where id = 112;
1 row deleted.
SQL> DELETE FROM ggl_links where id = 113;
1 row deleted.
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06</pre>
Submitted by: Administrator
Keep the "HR" SQL*Plus window as is, and open another window to run another instance of SQL*Plus.
>cd (OracleXE home directory)
>.insqlplus /nolog
SQL> connect SYSTEM/password
Connected.
SQL> SELECT sid, serial#, username, status, type
2 FROM V$SESSION WHERE username = 'HR';
<pre> SID SERIAL# USERNAME STATUS TYPE
---------- ---------- ------------------ -------- -----
39 141 HR INACTIVE USER</pre>
SQL> ALTER SYSTEM KILL SESSION '39,141';
System altered.
Go back to the "HR" SQL*Plus window.
SQL> SELECT * FROM ggl_links;
ORA-00028: your session has been killed
SQL> connect HR/globalguideline
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06
112 oracle.com 07-MAY-06
113 sql.com 07-MAY-06</pre>
As you can see, two records were rolled back as the session got killed by another session.
Submitted by: Administrator
>cd (OracleXE home directory)
>.insqlplus /nolog
SQL> connect SYSTEM/password
Connected.
SQL> SELECT sid, serial#, username, status, type
2 FROM V$SESSION WHERE username = 'HR';
<pre> SID SERIAL# USERNAME STATUS TYPE
---------- ---------- ------------------ -------- -----
39 141 HR INACTIVE USER</pre>
SQL> ALTER SYSTEM KILL SESSION '39,141';
System altered.
Go back to the "HR" SQL*Plus window.
SQL> SELECT * FROM ggl_links;
ORA-00028: your session has been killed
SQL> connect HR/globalguideline
SQL> SELECT * FROM ggl_links;
<pre> ID URL NOTES COUNTS CREATED
------- ---------------- ---------- ---------- ---------
101 globalguideline.COM 07-MAY-06
110 globalguideline.COM 07-MAY-06
112 oracle.com 07-MAY-06
113 sql.com 07-MAY-06</pre>
As you can see, two records were rolled back as the session got killed by another session.
Submitted by: Administrator
Copyright 2007-2024 by Interview Questions Answers .ORG All Rights Reserved.
https://InterviewQuestionsAnswers.ORG.
https://InterviewQuestionsAnswers.ORG.