nerdexam
Oracle

1Z0-052 · Question #108

All the database users are presently connected to the database instance and working. The HR user has opened three database sessions and executed the following command in one of his sessions: SQL>…

The correct answer is C. The session of the HR user that executed the commands. In Oracle, uncommitted DML changes are visible only to the session that executed them - no other session can read another session's dirty (uncommitted) data.

Managing Data and Concurrency

Question

All the database users are presently connected to the database instance and working. The HR user has opened three database sessions and executed the following command in one of his sessions:

SQL> UPDATE persons SET ccode='U031' WHERE ccode='U029'; 123 rows updated. SQL> DELETE FROM persons WHERE exp='Y'; 3 rows deleted. The SYS user opens a new session after HR executed the above commands. Which sessions can see the effect of the UPDATE and DELETE commands?

Options

  • AAll sessions of the HR user only
  • BAll sessions of the HR user and the SYS user
  • CThe session of the HR user that executed the commands
  • DAll the sessions for which the database users have access privilege to the PERSONS table

How the community answered

(39 responses)
  • A
    3% (1)
  • B
    5% (2)
  • C
    79% (31)
  • D
    13% (5)

Why each option

In Oracle, uncommitted DML changes are visible only to the session that executed them - no other session can read another session's dirty (uncommitted) data.

AAll sessions of the HR user only

HR's other two open sessions cannot see the uncommitted changes because Oracle's transaction isolation is scoped to the individual session, not to the database user account - sibling sessions for the same user behave identically to sessions of any other user when reading committed data.

BAll sessions of the HR user and the SYS user

The SYS user's session cannot see the uncommitted changes because Oracle's default read committed isolation level prevents any session from reading another session's dirty data, regardless of the privilege level of the querying user.

CThe session of the HR user that executed the commandsCorrect

Oracle enforces statement-level and transaction-level read consistency by using undo segments to serve older, committed versions of data to all sessions other than the one holding the transaction. Because HR has not issued a COMMIT, the UPDATE and DELETE changes exist only within that specific session's transaction context. Every other session - including HR's other two sessions and the newly opened SYS session - queries the last committed version of the PERSONS table and cannot see those pending changes.

DAll the sessions for which the database users have access privilege to the PERSONS table

Having SELECT privilege on the PERSONS table controls whether a user can access the table at all, but it has no bearing on transaction visibility - no amount of privilege grants a session the ability to read another session's uncommitted transaction data.

Concept tested: Oracle read consistency and uncommitted transaction visibility

Source: https://docs.oracle.com/cd/E11882_01/server.112/e40540/consist.htm

Topics

#read consistency#uncommitted data#transaction isolation#sessions

Community Discussion

No community discussion yet for this question.

Full 1Z0-052 Practice