Row-level and table-level locks for Oracle

Source: Internet
Author: User

1. When manipulating DML (create,insert,update) statements, Oracle automatically adds row-level locks when the select * from table for update "of column" "Nowait|wait 3" Oracle also locks automatically

Recommendation (1) nowait is generally added to the for update so that no other transaction is executed, and a transaction is determined and an error is thrown immediately.

Recommendation (2) The general of column is a multi-table operation, you can lock some of the columns of one table, if it is the same table, you cannot lock some columns

2, table-level lock

Table-level locks contain row-level locks, (1), (2) also through row-level locks to achieve table-level locks, they do not have strict classification, table-level lock is Oracle directly sweep the entire table to determine the transaction, rather than to scan each row in the list to determine the transaction, this is useful at some point

Table-level locks are divided into many types (mode):

(1) row sharing (row SHARE) – Prohibit exclusive lock table (2) row exclusive (row EXCLUSIVE) – Disables locking of tables with exclusive and shared locks (3) shared locks (SHARE) (4), allowing other users to query only rows in tables to prevent other users from inserting, updating, and deleting rows more Users can apply this lock on the same table at the same time (5) shared row exclusive (SHARE row EXCLUSIVE) – more restrictions than shared locks, prohibit the use of shared locks and higher locks (6) Exclusive (EXCLUSIVE) – Restrict the strongest table locks and allow other users to query only rows of the table. Prohibit modifying and locking tables General syntax: Lock table STUDENT in exclusive mode; (table-level lock Exclusive)
However, in the Java program How to call such a statement, temporarily did not get out, these statements in the DBA's use of more

Row-level and table-level locks for Oracle

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.