Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

Exam 1z0-062 topic 1 question 245 discussion

Actual exam question from Oracle's 1z0-062
Question #: 245
Topic #: 1
[All 1z0-062 Questions]

The HR.DEPARTMENTS table is the parent of the HR.EMPLOYEES table. The EMPLOYEES.DEPARTMENT_ID column has a foreign key constraint with the ON option that refers to the DEPARTMENTS.DEPARTMENT_ID column. An index exists on the DEPARTMENTS.DEPARTMENT_ID column. A

DELETE CASCADE -
transaction deletes a primary key in the DEPARTMENTS table, which has child rows in the EMPLOYEES table.
Which statement is true?

  • A. The transaction acquires a table lock only on the DEPARTMENTS table until the transaction is complete.
  • B. The transaction acquires a table lock on the DEPARTMENTS table. This lock enables other sessions to query but not update the DEPARTMENTS table until the transaction on the DEPARTMENTS table is complete.
  • C. The transaction acquires a table lock on the EMPLOYEES table. This lock enables other sessions to query but not update the EMPLOYEES table until the transaction on the DEPARTMENTS table is complete.
  • D. Only the rows that are deleted in the DEPARTMENTS and EMPLOYEES tables are locked until the transactions on the DEPARTMENTS table is complete.
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Mohit201920
Highly Voted 4 years, 1 month ago
i think D is correct
upvoted 17 times
...
Ray520
Most Recent 1 year, 11 months ago
C is correct.
upvoted 1 times
...
NorwayOracle
2 years, 1 month ago
Selected Answer: D
Testet: OBJECT_ID LOCKED_MODE ---------- ----------- 85674 3 85676 3 Only rows locked.
upvoted 2 times
NorwayOracle
2 years, 1 month ago
3 - ROW_X (SX): Row Exclusive Table Lock
upvoted 2 times
...
...
Oracle2020
2 years, 9 months ago
Answer is C The database acquires a full table lock on the child table when no index exists on the foreign key column of the child table, and a session modifies a primary key in the parent table (for example, deletes a row or modifies primary key attributes) or merges rows into the parent table. When both of the following conditions are true, the database acquires a full table lock on the child table: No index exists on the foreign key column of the child table. A session modifies a primary key in the parent table (for example, deletes a row or modifies primary key attributes) or merges rows into the parent table.
upvoted 4 times
...
exampro46
2 years, 10 months ago
When you delete row from parent table, you can check in select * from v$locked_object; in this query you can use object_id numbers in dba_objects to identify table names. For example select*from dba_objects where object_id in(79902,79900); that both table locked, so A is not correct in my opinion. D is not correct because after delete operation both tables locks not only rows which deleted, you can not update other rows two. In C the employees table is child table and we cannot update there rows or insert due to parent table, so I think the answer is B.
upvoted 1 times
...
Modasser
2 years, 11 months ago
Answer is C Because- Locks and Unindexed Foreign Keys The database acquires a full table lock on the child table when no index exists on the foreign key column of the child table, and a session modifies a primary key in the parent table (for example, deletes a row or modifies primary key attributes) or merges rows into the parent table. https://docs.oracle.com/database/121/CNCPT/consist.htm#CNCPT1351 in section "Locks and Foreign Keys"
upvoted 4 times
...
dad
3 years, 1 month ago
The key point of this question is the ON DELETE CASCADE option. If the primary key of the parent table is deleted (note that the primary key constraint is not deleted here), then the corresponding row of the child table will also be deleted, so when deleting the primary key of the parent table , The sub-table is locked, the purpose is to delete the corresponding row of the sub-table at the same time. Because Oracle deletes rows based on row-level locks. The test proved that it is possible to delete rows on other sub-tables.
upvoted 2 times
dad
3 years, 1 month ago
so the correct answer is D
upvoted 3 times
...
...
yukclam9
3 years, 2 months ago
if no index for that FK constraint at table employee the lock will be table wise
upvoted 1 times
...
hggz
3 years, 7 months ago
I think it's A Reference: https://docs.oracle.com/database/121/CNCPT/consist.htm#CNCPT1351 in section “Locks and Indexed Foreign Keys” A is correct as “Figure 9-4 Locking Mechanisms with Indexed Foreign Key” and its description indicate that the lock at table level only occurs on the parent table. Answers B and C are ruled out because they both indicate that “the locking allows query but not update the parent or child tables (DML)”, the reference however states that “A lock on the parent table prevents transactions from acquiring exclusive table locks, but does not prevent DML on the parent or child table during the primary key modification”.
upvoted 3 times
badguy001djh
3 years ago
In this question, there is no index on foregn key, so the correct answer is D
upvoted 2 times
...
...
NorthKorean
4 years ago
I think it's C
upvoted 1 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...