Which lock types exist when access is reserved for the transactions that locked the object?
26.A(n) ____ phase in a two-phase lock is when a transaction releases all locks and cannot obtain anynew lock.a.growingc.lockingb. shrinkingd. unlockingANS: BPTS: 1REF: 453 Show 27.A(n) ____ condition occurs when two or more transactions wait for each other to unlock data.PTS: 1REF: 453 Get answer to your question and much more 28.The ____ approach to scheduling concurrent transactions assigns a global unique stamp to eachtransaction.PTS: 1REF: 455 Get answer to your question and much more 29.In the optimistic approach, during the ____ phase, a transaction scans the database, executes theneeded computations, and makes the updates to a private copy of the database values.PTS: 1REF: 457 Get answer to your question and much more 30.In the optimistic approach, during the ____ phase, changes are permanently applied to the database.a.readc.writeb. validationd. sharedANS: CPTS: 1REF: 457 COMPLETION1.Although the DBMS is designed to recover a database to a previous consistent state (when aninterruption prevents the completion of a required set of transactions), the transactions themselves aredefined by the end user or programmer and must be ____________________ correct. Get answer to your question and much more PTS: 1REF: 4402.If a(n) ____________________ is issued before the termination of a transaction, the DBMS willrestore the database only for that particular transaction, rather than for all transactions, in order tomaintain the durability of the previous transactions. Get answer to your question and much more PTS: 1REF: 4433.The objective of ____________________ control is to ensure the serializability of transactions in amultiuser database environment. Get answer to your question and much more SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG. All rights reserved. ABAP - Keyword Documentation → ABAP - Reference → Processing External Data → ABAP Database Accesses → Data Consistency → Database Locks Any database permitting simultaneous access to multiple transactions requires database locks to manage and synchronize access. The tasks of this mechanism are to: This mechanism can be used to
The following sections are a short discussion of the properties of database locks:
Setting Locks Database systems do not usually provide commands for explicitly setting locks. Database locks are set implicitly each time data on the database is accessed. In ABAP, databases are accessed in the following ways:
Locked Objects Database systems set physical locks: All rows affected by a database call are locked. In the case of SELECT, these are the selected entries. In the case of UPDATE, DELETE, INSERT, and MODIFY, these are rows to be changed, deleted, or inserted. SELECT SINGLE FOR UPDATE * FROM sflightWHERE carrid = 'LH' AND connid = '0400' AND fldate = '19960516' INTO ... . for example, locks the entry in table SFLIGHT for Lufthansa flight 0400 on May 16, 1996. It is not always the table row that is locked. Tables, data pages, and index pages can also be locked, for example. The units locked depend on the database system being used and the action being carried out. Lock Mode In principle, one type of lock is enough to control competing data access. However, to allow a larger number of transactions to run in parallel, database systems use a range of lock types. These can vary from system to system, but the following two examples outline sufficiently how locks work:
Exclusive locks are set by the Open SQL statements SELECT SINGLE FOR UPDATE, INSERT, UPDATE, MODIFY, and DELETE, the corresponding Native SQL statements or platform-specific statements in AMDP methods, plus EXPORT TO DATABASE. The current isolation level specifies whether the SQL command SELECT sets a shared lock.
If a transaction cannot lock an object because it is already locked by another transaction, it waits until the other transaction has released the lock. This can produce a deadlock. A deadlock occurs, for example, when two transactions are waiting for a lock held by the other. Example A booking needs to be made in a flight reservation system for Lufthansa flight 0400 on May 16, 1996. This is possible only if there are enough free seats. To prevent two bookings from being made at the same time and avoid overbooking, the entry in the database table SFLIGHT for this flight must be locked to prevent it from being changed by other transactions. This ensures that the query to determine the number of free seats in the SEATSOCC field can be carried out, the flight can be booked, and the SEATSOCC field can be updated by other transactions. The following program excerpt shows a solution for this problem: DATA sflight_wa TYPE sflight, sbook_wa type sbook. SELECT SINGLE FOR UPDATE * IF sflight_wa-seatsocc < sflight_wa-seatsmax. COMMIT WORK. The table row selected by SELECT SINGLE FOR UPDATE and inserted by INSERT is locked until the end of the database LUW. This prevents the flight from being overbooked and inconsistencies from occurring between tables SFLIGHT and SBOOK in the event of a database rollback after an error. Lock Duration Database systems do not usually provide commands for explicitly releasing locks. All database locks are released no later than the next database commit or rollback. Shared locks usually have an even shorter lifetime. Sometimes, this causes problems for transactions that involve multiple dialog steps: After the user has selected a flight in the above example, he or she usually performs further dialog steps to enter additional data for the reservation. Here, the flight reservation is added in a different database LUW than the original selection of the flight. Database locking does not prevent another transaction from booking this flight in the meantime, which can mean that the scheduled booking may have to be canceled after all. From the point of view of the user, this solution is very inconvenient. To avoid this scenario, a flight reservation system must use the SAP locking mechanism to lock the flight for the entire duration of the transaction. Continue What types of lock are used for transactions?There are two types of lock:. Shared lock: It is also known as a Read-only lock. In a shared lock, the data item can only read by the transaction. ... . Exclusive lock: In the exclusive lock, the data item can be both reads as well as written by the transaction.. What are the two types of lock?Although there are many types of locks, the four most common are padlocks, deadbolts, knob locks, and levers.
Which locking types that concurrent transactions are granted read access on the basis of a common lock?Shared locks are appropriate when concurrent transactions are granted READ access on the basis of a common lock, because concurrent transactions based on a READ cannot produce a conflict. A shared lock is issued when a transaction must read data from the database and no exclusive locks are held on the data to be read.
What type of locking are available in Oracle?Oracle locks fall into one of three general categories. DML locks protect data. For example, table locks lock entire tables, row locks lock selected rows. DDL locks protect the structure of schema objects—for example, the definitions of tables and views.
|