Hindi1
Hindi1
Hindi1
Timestamping Locking
To ensure accuracy, completeness and the integrity of data, database system maintains following properties of No.
transaction. 2 It is used for deadlock prevention. It is used to improve performance.
1. Atomicity: Atomicity property ensures that at the end of the transaction, either no changes have occurred to the A lock is a variable associated with a data item that
database or the database has been changed in a consistent manner. At the end of a transaction, the updates made 3 Timestamp is a unique identifier to identify a transaction. describes its status concerning possible operations
by the transaction will be accessible to other transactions and processes outside the transaction. applied.
2. Consistency: Consistency property of transaction implies that if the database was in consistent state before the Timestamping methods assign timestamps to Locking methods prevent unserializable schedules
start of a transaction, then on termination of a transaction, it will also be in a consistent state. In other words, Data is 4 transactions, enforcing serializability by ensuring that by stopping more than one transaction from
in a consistent state when a transaction starts and when it ends. transaction timestamps match the schedule. accessing the same data elements.
3. Isolation: Isolation property of transaction indicates that action performed by a transaction will be hidden from Timestamping methods may cause more transactions to Locking methods avoid transaction abortion by
5
outside the transaction until the transaction terminates. Thus each transaction is unaware of other transactions abort than a locking protocol. preventing potentially conflicting transactions.
executing concurrently in the system.
4. Durability: Durability property of a transaction ensures that once a transaction completes successfully (commits), Advantages of Two-Tier Client/Server Structure:
Q10) Advantage and disadvantages of single tier
the changes it has made to the database persist, even if there are system failures. Advantage of Single-Tier: 1)This structure is quite easy to maintain and modify.
Q2 States of transaction with diagram: 1. The data is easily and quickly available since it is 2)The communication between the client and server in
2. located in the same machine. the form of request response messages is quite fast.
1. Active State (Initial State): This is the initial state of transaction. A
Disadvantage of Single-Tier: Disadvantage of Two-Tier Client/Server Architecture:
transaction is active when it is executing. A transaction always starts
1. This architecture is completely not scalable. 1)If the client nodes are increased beyond capacity in the
with active state. It remains in active state till all commands of that
2. Only one user can access the system at a given architecture, then the server is not able to handle the
transaction are executed.
2. Partially Committed: When a transaction completes its last time through the local client. request overflow and performance of the system
statement (command), it enters in partially committed state. degrades.
3. Failed: If the system decides that the normal execution of the
transaction can no longer proceed, then transaction is termed as .Q4 What is Triggers? Concept of triggers ?
failed. If some failure occurs in active state or partially committed Advantages Disadvantages?
state, transaction enters in failed state. 1 A trigger is a set of SQL statements stored in the database catalog.
2 A trigger is a set of actions that are run automatically when a specified change operation (SQL INSERT,
4. Committed: When the transaction completes its execution
UPDATE, DELETE or TRUNCATE statement) is performed on a specified table or view.
successfully it enters committed state from partially committed state. 3 Definition: A trigger is, "a statement that is executed automatically by the system as a side effect of a modification
5. Aborted: To ensure the atomicity property, changes made by to the database".
failed transaction are undone i.e. the transaction is rolled back. After Concept of triggers
rollback, that transaction enters in aborted state. When the
a)To design a trigger mechanism, we must:
transaction is in failed state, it rollbacks that transaction and enters in
1. Specify the conditions under which the trigger is to be executed.
aborted state.
2. Specify the actions to be taken when the trigger executes.
b)A trigger is a special user-defined function that binds to a table.
To create a new trigger, we must define a trigger function first, and
then bind this trigger function to a table.
c)The difference between a trigger and a user-defined function is
that a trigger is automatically invoked when an event occurs
whereas a stored procedure must be called explicitly.
dependent on T_{10} T_{11} must be rolled back. Since, is dependent on T 11' T_{12} must be rolled back.
3) This concept, in which a single transaction failure results in a series of transaction rollbacks, is called cascading
rollback.
4) A cascadeless schedule is one where, for each pair of transactions T, and T_{1} and Tj that Tj reads a data item
previously written by Tj, the commit operation of T_{i} appears before commit operation of Tj.
8)Activity Monitoring: DBAs monitor database activity to detect unusual patterns or suspicious behavior that may
indicate a security threat.
Q20)Shadow paging
Shadow paging is a recovery technique used in database systems to ensure data consistency and recoverability. It's
a copy-on-write approach that avoids in-place updates to database pages
Advantages of Shadow Paging:
Simplicity: It's a relatively simple technique to implement.
Increased Concurrency: Multiple transactions can be executed concurrently without interfering with each other.
Fast Recovery: In case of a system crash, recovery is straightforward as the database can be rolled back to the
state of the last committed transaction.
Reduced Write Amplification: By avoiding unnecessary writes to disk, shadow paging can improve performance.
Disadvantages of Shadow Paging:
Storage Overhead: It requires additional storage space to store shadow pages.
Performance Overhead: Creating and managing shadow pages can introduce overhead, especially for frequent
updates.