nerdexam
Oracle

1Z0-052 · Question #168

View the Exhibit and examine the parameters. User A executes the following command to update the TRANS table: SQL> UPDATE B.trans SET tr_amt=tr_amt+500 WHERE c_code='C005'; Before user A issues a…

The correct answer is D. The ALTER TABLE command fails after waiting for 60 seconds due to the resource being busy. Oracle's DDL_LOCK_TIMEOUT parameter determines how long a DDL statement waits for a conflicting lock before failing with ORA-00054; with the parameter set to 60, the ALTER TABLE waits 60 seconds then errors out.

Managing Data and Concurrency

Question

View the Exhibit and examine the parameters. User A executes the following command to update the TRANS table:

SQL> UPDATE B.trans SET tr_amt=tr_amt+500 WHERE c_code='C005'; Before user A issues a COMMIT or ROLLBACK command, user B executes the following command on the TRANS table:

SQL> ALTER TABLE trans MODIFY (tr_type VARCHAR2(3)); What would happen in this scenario?

Exhibit

1Z0-052 question #168 exhibit

Options

  • AThe ALTER TABLE command modifies the column successfully
  • BThe DDL operation gets higher priority and transaction for user A is rolled back
  • CThe ALETER TABLE command waits indefinitely until user A ends the transaction
  • DThe ALTER TABLE command fails after waiting for 60 seconds due to the resource being busy

How the community answered

(57 responses)
  • A
    7% (4)
  • B
    5% (3)
  • C
    21% (12)
  • D
    67% (38)

Why each option

Oracle's DDL_LOCK_TIMEOUT parameter determines how long a DDL statement waits for a conflicting lock before failing with ORA-00054; with the parameter set to 60, the ALTER TABLE waits 60 seconds then errors out.

AThe ALTER TABLE command modifies the column successfully

The ALTER TABLE cannot succeed while user A holds an active DML lock - DDL requires an exclusive table lock, which is incompatible with the row-level lock escalation needed for a structural modification while an uncommitted transaction exists.

BThe DDL operation gets higher priority and transaction for user A is rolled back

Oracle does not grant DDL statements priority over active DML transactions - the database will never automatically roll back a user's uncommitted transaction to accommodate a competing DDL operation from another session.

CThe ALETER TABLE command waits indefinitely until user A ends the transaction

The DDL does not wait indefinitely because DDL_LOCK_TIMEOUT is explicitly set to 60 seconds in the exhibit; indefinite waiting would only occur if DDL_LOCK_TIMEOUT were set to a very large value or some other infinite-wait mechanism were in place, which it is not here.

DThe ALTER TABLE command fails after waiting for 60 seconds due to the resource being busyCorrect

The exhibit shows DDL_LOCK_TIMEOUT set to 60 seconds. When user B issues the ALTER TABLE, Oracle attempts to acquire an exclusive DDL lock on the table but finds it blocked by user A's uncommitted UPDATE transaction. Oracle waits the full 60 seconds for the lock to become available, and when user A neither commits nor rolls back within that window, the ALTER TABLE command fails with ORA-00054: resource busy and acquire with NOWAIT specified or timeout expired.

Concept tested: DDL_LOCK_TIMEOUT parameter controlling DDL lock wait behavior

Source: https://docs.oracle.com/en/database/oracle/oracle-database/19/refrn/DDL_LOCK_TIMEOUT.html

Topics

#DDL_LOCK_TIMEOUT#DDL concurrency#DML lock contention#transaction blocking

Community Discussion

No community discussion yet for this question.

Full 1Z0-052 Practice