Presentation is loading. Please wait.

Presentation is loading. Please wait.

DBSQL 7-1 Copyright © Genetic Computer School 2009 Chapter 7 Transaction Management, Database Security and Recovery.

Similar presentations


Presentation on theme: "DBSQL 7-1 Copyright © Genetic Computer School 2009 Chapter 7 Transaction Management, Database Security and Recovery."— Presentation transcript:

1 DBSQL 7-1 Copyright © Genetic Computer School 2009 Chapter 7 Transaction Management, Database Security and Recovery

2 DBSQL 7-2 Copyright © Genetic Computer School, Singapore 2009 Chapter 7 Overview Transaction Management Concurrency Control Database Security Database Recovery

3 DBSQL 7-3 Copyright © Genetic Computer School, Singapore 2009 Transaction Management

4 DBSQL 7-4 Copyright © Genetic Computer School, Singapore 2009 Transaction Management Transaction is the execution of a program that access and changes the database. Once a transaction is committed it is said to be that the database is in its consistent state.

5 DBSQL 7-5 Copyright © Genetic Computer School, Singapore 2009 Transaction Concept ACID Properties Transaction Operation Transaction State Concurrent access to data

6 DBSQL 7-6 Copyright © Genetic Computer School, Singapore 2009 ACID Properties Atomicity Consistency Isolation Durability

7 DBSQL 7-7 Copyright © Genetic Computer School, Singapore 2009 Cont’ A tomicity C onsistency I solation D urability All the transaction task is performed or not performed at all The system is consistent at the end of a transaction A transaction should not make its updates visible to other transactions until it is committed When a transaction has made a change to the database state and the change is committed, this change is permanent and should be available to all other transactions

8 DBSQL 7-8 Copyright © Genetic Computer School, Singapore 2009 Transaction Operation BEGIN_TRANSACTION READ or WRITE END_TRANSACTION COMMIT_TRANSACTION ROLLBACK UNDO REDO

9 DBSQL 7-9 Copyright © Genetic Computer School, Singapore 2009 Transaction State A transaction goes into an active state immediately after it stars execution, where it can issue READ and WRITE operations. When the transaction ends, it moves to the partially committed state. At this point, some concurrency control techniques require that certain checks are made to ensure that the transaction did not interfere with other executing transactions.

10 DBSQL 7-10 Copyright © Genetic Computer School, Singapore 2009 Concurrent Access of data Many computer systems can be used simultaneously by more than one user. This is made possible by multiprogramming, a technique that allows the computer to run multiple program (or transactions) at the same time. Due to speed at which these commands are executed, the impression of concurrent use is given to the users. This process is known as interleaving An important issue is that more than one application may attempt to access the same data item. As a result, data stored in a multi-user DBMS can be damaged or destroyed. To overcome this problem, concurrency control techniques have been developed to protect data from incorrect changes caused by transactions running simultaneously

11 DBSQL 7-11 Copyright © Genetic Computer School, Singapore 2009 Problems when concurrent access is executed The lost update problem The uncommitted dependency problem The inconsistency analysis problem

12 DBSQL 7-12 Copyright © Genetic Computer School, Singapore 2009 Concurrency Control

13 DBSQL 7-13 Copyright © Genetic Computer School, Singapore 2009 Concurrency Control Locks Types of Locking Locking Protocol Deadlock Oracle concurrency control

14 DBSQL 7-14 Copyright © Genetic Computer School, Singapore 2009 Concurrency Control Concurrency Control is the control on the Database and Transaction which are executed concurrently to ensure that each Transaction completed healthy. Concurrently control is concerned with preventing loss of data integrity due to interference between users in a multi- user environment.

15 DBSQL 7-15 Copyright © Genetic Computer School, Singapore 2009 Lock-Based Method The best method to control the concurrent access to the Database Objects by providing suitable permissions to the Transactions. Also it is the only method which takes less cost of Time and less program complexity in terms of code development.

16 DBSQL 7-16 Copyright © Genetic Computer School, Singapore 2009 Cont’ Database Object Lock Database Object is the small data element, the value of which one is altered during the execution of transactions. Lock is a small object associated with Database Object which gives the information about the type of operations allowed on a particular Database Object. It can be termed as type of permission provided by the transaction manager to the transactions to do a particular operation on a Database Object.

17 DBSQL 7-17 Copyright © Genetic Computer School, Singapore 2009 Types of Lock Shared Locks (S locks) Exclusive Locks (X locks) Uses of Locking Lost update Uncommitted dependency Inconsistent analysis

18 DBSQL 7-18 Copyright © Genetic Computer School, Singapore 2009 Locking Protocols Basic 2PL Conservative 2PL Strict 2PL

19 DBSQL 7-19 Copyright © Genetic Computer School, Singapore 2009 Deadlock Deadlock occurs mainly due to the Lock-Based Concurrency Control. The exclusive lock type will isolate one particular Database Object from the access other transactions. This will isolate one particular Database Object from the access of other transaction. This will suspend all the transactions who request Shared lock on that particular Database Object until the transaction which hold Exclusive lock on that object is completed. This will create a loop in Database which leads to Deadlock within transactions. This will leave the Database in inconsistent state.

20 DBSQL 7-20 Copyright © Genetic Computer School, Singapore 2009 Oracle Concurrency Control SET TRANSACTION READ COMMITTED SET TRANSACTION SERIALIZABLE SET TRANSACTION READ ONLY

21 DBSQL 7-21 Copyright © Genetic Computer School, Singapore 2009 Example TRANSACTION 1 TRANSACTION 2 Time Start check seat availability Startcheck seat availability Make reservation seat x commit TRANSACTION 1 TRANSACTION 2 Time Start read price item x Startread/change price item x create order commit

22 DBSQL 7-22 Copyright © Genetic Computer School, Singapore 2009 Database Security

23 DBSQL 7-23 Copyright © Genetic Computer School, Singapore 2009 Database Security Database security issues are often lumped together with data integrity issues, but the two concepts are really quite distinct. Security refers to the protection of data against unauthorized disclosure, alteration, or destruction; integrity refers to the accuracy or validity of that data.

24 DBSQL 7-24 Copyright © Genetic Computer School, Singapore 2009 The need for security Multiple users tried to access the data at the same time so in order to maintain consistency security is needed Because of the advancement of internet and to protect data from hackers and crackers. The plastic card (credit card) is popular so data must be safe.

25 DBSQL 7-25 Copyright © Genetic Computer School, Singapore 2009 Database Security System The person responsible for data security is usually the database administrator (DBA). The database security system stores authorization rules and enforces them for each database access. When a group of users, access data in the database then a privilege can be given to the said group rather than individual users. Database security involves allowing and disallowing users from performing actions on the database and the objects within it

26 DBSQL 7-26 Copyright © Genetic Computer School, Singapore 2009 Classification of Security Physical refers to the security of the hardware associated with the system and the protection of the site where the computer resides Logical refers to the security measures residing in the operating system or the DBMS designed to handle threats to the data.

27 DBSQL 7-27 Copyright © Genetic Computer School, Singapore 2009 Cont’ Design Level Should be simple Has to be normalized Decide privilege for each group Create unique view for each users or group Maintenance Level Operating system issues and availability Confidentiality and accountability Encryption Authentication schemes

28 DBSQL 7-28 Copyright © Genetic Computer School, Singapore 2009 Database Recovery

29 DBSQL 7-29 Copyright © Genetic Computer School, Singapore 2009 Database Recovery Failure Classification Recovery Facilities Recovery Techniques Advance Recovery Techniques

30 DBSQL 7-30 Copyright © Genetic Computer School, Singapore 2009 Database Recovery Brings the database from the temporary inconsistent state to a consistent state. Database recovery can also be defined as mechanisms for restoring a database quickly and accurately after loss or damage. Database are damaged due to: Human error Hardware error Incorrect or invalid data Program errors Viruses Natural catastrophe

31 DBSQL 7-31 Copyright © Genetic Computer School, Singapore 2009 Recovery Facilities Back-up mechanism Logging Facilities Checkpoint Facilities Recovery Manager

32 DBSQL 7-32 Copyright © Genetic Computer School, Singapore 2009 Recovery Techniques Deferred update Immediate update Shadow paging

33 DBSQL 7-33 Copyright © Genetic Computer School, Singapore 2009 Advance Recovery Technique Crash Recovery Recovery Manager  Ensures transaction atomicity and durability Saving Steal Forcing


Download ppt "DBSQL 7-1 Copyright © Genetic Computer School 2009 Chapter 7 Transaction Management, Database Security and Recovery."

Similar presentations


Ads by Google