[Database system and application] - log, fault recovery, transaction, concurrency control, scheduling, checkpoint

  1. Log files are used to record __________.
    A. Data operation
    B. Program running process
    C. Program execution result
    D. All update operations on data

  2. Which of the following statements is correct is __________.
    A. Transaction failure can be recovered through the running log
    B. Media failure can be correct only by restoring the backup to the system
    C. Checkpoint refers to the point at which the failure is checked and recovered
    D. Checkpoint is the DBMS forcing the content and media in the memory DB Buffer

    Option A is incorrect. A transaction failure only affects the transaction itself, which can be recovered by undoing and redoing the transaction. The statement of option B is incorrect. After a media failure restores the backup to the system, it is necessary to use the operation log to restore to the correct state at the point of failure. The statement of option C is incorrect. A checkpoint is a point in time when the DBMS forces the contents of the database buffer to be consistent with the contents of the media. Option D is correct.

  3. Recovery from media failure requires _________.
    A. The currently executed transaction needs to be redone in the order of the running log records
    B. The currently unfinished transaction is undone
    C. Replace the failed database file with the latest backup file
    D. All the above tasks are required, but attention should be paid to the sequence of operations.

  4. The locking mechanism in the database is the main method of __________.
    A. Integrity control
    B. Security control
    C. Concurrency control
    D. Failure recovery control

  5. If transaction T has added X lock to data R, then other transactions pair R__________.
    A. Can add S lock but not X lock
    B. Can add S lock or X lock
    C. Can not add S lock but can add X lock
    D. No locks can be added

  6. If transaction T has added S lock to data R, then other transactions pair R__________.
    A. You can add S lock but not X lock
    B. You can add S lock or X lock.
    C. You can’t add S lock but you can add X lock
    . D. You can’t add any lock.

  7. If transaction T has added S lock to data M, and without changing the S lock, other transactions will __________ data M.
    A. can read and write
    B. Can read, but not write
    C. Can't read, but can write
    D. Can't read, can't write

  8. Which of the following statements is correct is __________.
    A. The correct parallel scheduling must be serializable scheduling
    B. The two-stage blocking method used for concurrency control will not cause deadlock
    C. The two-stage blocking method is a serializable parallel scheduling algorithm
    D. If a schedule is non-conflict serializable, then it must not be serializable

    The statement of option A is incorrect, serializable scheduling must be correct parallel scheduling, and vice versa. The statement of option B
    is incorrect. The two-stage blocking method can definitely produce serializable scheduling, but it may cause deadlock. The statement of option C
    is correct, and the two-stage blocking method must be able to produce a serializable schedule. Option D
    is incorrect, serializable schedules can be "non-conflicting serializable", conflicting serializable is stricter than serializable.

  9. T1, T2 are two transactions. Figure (a)(b)© shows three kinds of schedules for these two transactions. What problems will arise in these three schedules? The correct option is _____________.
    A. The schedule in Figure (a) will have "lost modification", the schedule in Figure (b) will have "repeated read errors", and the schedule in Figure © will have "dirty reads".
    B. The schedule in Figure (a) will have "dirty reads", the schedule in Figure (b) will have "repeated read errors", and the schedule in Figure © will have "lost modification".
    C. The schedule in Figure (a) will have "repeated read error", the schedule in Figure (b) will have "dirty read", and the schedule in Figure © will have "lost modification".
    D. The schedule in Figure (a) will have "lost modification", the schedule in Figure (b) will have "dirty reads", and the schedule in Figure © will have "repeated read errors".
    insert image description here

  10. T1 and T2 are two transactions. Figures (a) and (b) show two schedules S1 and S2 for these two transactions. Regarding S1 and S2, the correct option is _____________.
    A, S1 is serializable scheduling, S2 is serializable scheduling
    B, S1 is serializable scheduling, S2 is non-serializable scheduling
    C. S1 is non-serializable scheduling, and S2 is serializable scheduling
    D. S1 is non-serializable scheduling, and S2 is non-serializable scheduling

insert image description here

  1. Describe the concept of affairs and the four characteristics of affairs. What properties of transactions can recovery techniques guarantee?

    • A transaction is a sequence of database operations defined by the user. These operations are either all done or not done at all, and are an indivisible unit of work.

    • Transactions have 4 properties: Atomicity, Consistency, Isolation and Persistence. These four properties are also referred to as ACID properties for short.

      1. Atomicity: A transaction is the logical unit of work of the database, and all operations included in the transaction are either performed or not performed.
      2. Consistency: The result of transaction execution must cause the database to change from one consistent state to another.
      3. Isolation: The execution of a transaction cannot be interfered with by other transactions. That is, the operations and data used within a transaction are isolated from other concurrent transactions, and concurrently executed transactions cannot interfere with each other.
      4. Persistence: Persistence, also known as permanence, means that once a transaction is committed, its changes to the data in the database should be permanent. Subsequent other operations or failures should not have any effect on its execution result.
    • Fault recovery can guarantee the atomicity and continuity of transactions.

  2. Describe the concept of affairs and the four characteristics of affairs. What properties of transactions can recovery techniques guarantee?
    Writing a modification to data to the database and writing a log record representing the modification to a log file are two different operations. It is possible for a failure to occur between these two operations where only one of the two write operations completed.

    If the database modification is written first, but the modification is not registered in the running record, the modification cannot be recovered later. If the log is written first, but the database is not modified, it will only perform one more UNDO operation during recovery, which will not affect the correctness of the database. So be sure to write the log file first, that is, first write the log records to the log file, and then write the modification of the database.

  3. What is a checkpoint record? What does a checkpoint record include?
    insert image description here
    14. Now there is a schedule r3(B)r1(A)w3(B)r2(B)r2(A)w2(B)r1(B)w1(A) for three transactions, the schedule is conflict-feasible serialization schedule? Why?
    is a conflict serializable schedule.

    Sc1=r3(B)r1(A)w3(B)r2(B)r2(A)w2(B)r1(B)w1(A), exchange r1(A) and W3(B), get r3(B )w3(B)r1(A)r2(B)r2(A)w2(B)r1(B)W1(A); exchange r1(A) and r2(B)r2(A)w2(B), Obtain Sc2=r3(B)W3(B)r2(B)r2(A)w2(B)r1(A)r1(B)w1(A). Since Sc2 is serial and both exchanges are based on non-conflicting operations, Sc1=r3(B)r1(A)w3(B)r2(B)r2(A)w2(B)r1(B) w1(A) is a conflict serializable schedule.

  4. Consider two transactions T1 and T2.
    T1: R(A); R(B); B=A+B; W(B); T2: R(B); R(A); A=A+B; W(A) ① Rewrite T1 and
    T2 , add lock operation and unlock operation, follow the two-stage lock protocol.
    ② Explain whether the execution of T1 and T2 will cause deadlock, and give a scheduling description of T1 and T2.

insert image description here

Guess you like

Origin blog.csdn.net/weixin_56462041/article/details/130947144