Presentation is loading. Please wait.

Presentation is loading. Please wait.

CREATE THE DIFFERENCE Back ups and Recovery. CREATE THE DIFFERENCE Aims This lecture aims to cover –Back ups –Transaction logging –Security threats.

Similar presentations


Presentation on theme: "CREATE THE DIFFERENCE Back ups and Recovery. CREATE THE DIFFERENCE Aims This lecture aims to cover –Back ups –Transaction logging –Security threats."— Presentation transcript:

1 CREATE THE DIFFERENCE Back ups and Recovery

2 CREATE THE DIFFERENCE Aims This lecture aims to cover –Back ups –Transaction logging –Security threats

3 CREATE THE DIFFERENCE How can Data be Protected? Dual recording of data (mirrored systems) –Considerations Requires a second hardware/software system. Provides the best but for a large system, the most expensive system Periodic Back ups –Considerations time interval between dumps time taken to perform the dump time taken to perform the recovery database integrity units on-line back-up capability Transaction Logging –Considerations fault tolerance ease of recovery additional storage Database Security –10 major threats and prevention.

4 CREATE THE DIFFERENCE How best to safeguard the system –Use transaction logging alone? a crash after a significant period of time will result in an extended time for recovery –Use high frequency back ups? Time consuming –A combination of logging and back ups? most systems use this approach because the recovery time is kept short and time spent on backing up is reduced. Safeguards

5 CREATE THE DIFFERENCE Back ups A back up will usually comprise –A back up of the entire system (database, reports, forms programs etc. –A back up of the data log file. –Provision of offsite storage for back ups –Provision for resilience in the event of system hardware failure.

6 CREATE THE DIFFERENCE Example of a back up system TuesdayFridayThursdayMondayWednesday daily back up of database changes to data PROBLEM OCCURS no log file present

7 CREATE THE DIFFERENCE Recovery Insert back up of database from Wednesday evening –As the problem occurred halfway through Thursday, the last back up of the database was on Wednesday evening so the transactions on Thursday will be lost. Issues –If the database is large, the time taken to back up could make this option unfeasible. –Transactions are lost.

8 CREATE THE DIFFERENCE Example of a back up system TuesdayFridayThursday Monday Wednesday weekly back up of database Transaction logging activated growth of log PROBLEM OCCURS

9 CREATE THE DIFFERENCE Recovery Insert weekly back up of database –Rollforward log In theory, this would work well with no loss of data. Problems –The log file is not backed up so if it is corrupted all the data since the weekly back up would be lost.

10 CREATE THE DIFFERENCE Example of a back up system TuesdayFridayThursdayMondayWednesday weekly back up of database daily back up of log file growth of log PROBLEM OCCURS

11 CREATE THE DIFFERENCE Recovery Insert weekly back up of database –Rollforward log using the backup from Monday evening –Rollforward log using the backup from Tuesday evening –Rollforward log using the backup from Wednesday evening –Rollforward log on Thursday. Problems –As the problem occurred halfway through Thursday, the last back up of the log file was on Wednesday evening. As long as all the log back ups are intact, the only possible risk is with the log on Thursday which may or may not have been corrupted.

12 CREATE THE DIFFERENCE The Rollback command If a database log is used, the database can be rolled back to when the log was started. It is possible to start a log to cover a series of commands eg. at a month or year end. If one command fails, the whole series can be rolled back to maintain data integrity.

13 CREATE THE DIFFERENCE Transaction Properties Revision The ACID test: –A tomicity: a transaction must be an atomic unit of processing – either all parts are performed or it is not performed at all. –C onsistency: execution must take the database from one correct state to another –I solation: the updates of a transaction must visible to or useable by other transactions until it is committed (solves the temporary update problem) –D urability or Permanency: if a transaction changes the database and is committed, the changes must never be lost because of subsequent failure

14 CREATE THE DIFFERENCE Transaction manager The transaction manager provides atomicity COMMIT TRANSACTION (Commit) –signals successful end of transaction –the database should be (or is) in a consistent state –all the updates can be made permanent ROLLBACK TRANSACTION (Rollback) –signals unsuccessful end of transaction –all updates made by the logical unit of work must be undone

15 CREATE THE DIFFERENCE Transaction logging Transactions are tracked by using logs Transaction records –transaction ID –type of log (start of transaction, insert, update..) –identifier of the data item affected –before image (value before change) –after image (value after change) –log management information (pointers) Logs can also be used for performance monitoring and auditing

16 CREATE THE DIFFERENCE Transaction logging

17 CREATE THE DIFFERENCE System Recovery System failure –the contents of main memory are lost –the precise status of transactions in progress is unknown –these transactions have to be UNDONE (rolled back) on system start up The log records are used to write the before-image of the affected fields, and restore the database to its state prior to the transaction’s start. Applied in the reverse order to which they were written to the log –transactions that do complete but do not manage to have the updates transferred to disk must be REDONE (rolled forward) Use the after-image log records for the transaction, In the order in which they were written to the log Check points determine whether a rollback or roll forward is required Checkpoint –the point of synchronisation between the database & transaction log file. All buffers are force written to secondary storage

18 CREATE THE DIFFERENCE Recovery - transaction categories Time tc tf T1 T2 T3 T4 T5 Checkpoint (time tc) System failure (time tf)

19 Transaction recovery Start with 2 lists of transactions, the UNDO list and the REDO list –set the UNDO list equal to the list of all transactions in the most recent checkpoint –set the REDO list to empty Search forward through the log, starting from the checkpoint record –If a BEGIN TRANSACTION entry is found for T, add T to the UNDO list –If a COMMIT log entry is found for transaction T, move T from the UNDO list to the REDO list When the end of the log is reached, the 2 lists contain relevant transactions

20 CREATE THE DIFFERENCE Recovery - atomicity Transactions have atomicity –A transaction must succeed in its entirety or must be rolled back resulting in a nil effect –Transactions can suffer cascading rollback due to interdependencies of data usage in transactions Cascades may be stopped by using only committed values – but this reduces concurrency –We avoid cascading rollback at the expense of parallelism


Download ppt "CREATE THE DIFFERENCE Back ups and Recovery. CREATE THE DIFFERENCE Aims This lecture aims to cover –Back ups –Transaction logging –Security threats."

Similar presentations


Ads by Google