Presentation is loading. Please wait.

Presentation is loading. Please wait.

Database Management System Module 5 DeSiaMorewww.desiamore.com/ifm1.

Similar presentations


Presentation on theme: "Database Management System Module 5 DeSiaMorewww.desiamore.com/ifm1."— Presentation transcript:

1 Database Management System Module 5 DeSiaMorewww.desiamore.com/ifm1

2 Boyce-Codd Normal Form BCNF was designed to cover anomalies that arise when there is more than one candidate key in some set of data requirements. DeSiaMorewww.desiamore.com/ifm2

3 Example BCNF Suppose we have introduced a scheme of majors into degree scheme at a unveristy. The business rules relevant to that prt of this domain covering majors are: Each student may major several areas A student has one tutor for each area DeSiaMorewww.desiamore.com/ifm3

4 Example BCNF Each area has several tutors but a tutor advise in only one area. Each tutor advises several students in an area. On the grounds of these rules, a schema produced in third normal form represented below Majors(studentNo, area, staffNo) DeSiaMorewww.desiamore.com/ifm4

5 Example BCNF A set of sample data is provided in the table below. DeSiaMorewww.desiamore.com/ifm5

6 Example BCNF The schema has the following anomalies: Suppose student 123456 changes one of his or her majors from computer science to information systems. Doing this means that we lose information about staffNo 234 tutoring on computer science. This is an update anomaly. DeSiaMorewww.desiamore.com/ifm6

7 Example BCNF Suppose we wish to insert a new row to establish the fact that staffNo 789 tutors on computer science. We cannot do this until at least one student takes this area as his or her major. This is an insertion anomaly These anomalies occur because there are two overlapping candidate keys. R.F. Boyce and E.F. Codd came with the solution. DeSiaMorewww.desiamore.com/ifm7

8 BCNF A relation is in BCNF if every determinant is a candidate key. The schema above can be converted into BCNF in one of two ways: Schema 1: StudentTutorial(studentNo, staffNo) TutorAreas(staffNo, area) Schema 2: StudentTutorials(studentNo, area) TutorAreas(staffNo, area) DeSiaMorewww.desiamore.com/ifm8

9 Concurrency control and recovery DeSiaMorewww.desiamore.com/ifm9

10 Transactions In multi-user database system the procedures that cause changes to a database or retrieve data from the database are called transactions. A transaction may be defined as a logical unit of work. Include activities performed by an individual, group, organisation or software process on database. DeSiaMorewww.desiamore.com/ifm10

11 ACID To remain an accurate reflection of its real-world domain, any transaction such as the one above should demonstrate the properties of atomicity, consistency, isolation and durability (ACID) DeSiaMorewww.desiamore.com/ifm11

12 Atomicity – Since a transaction consists of a collection of actions, the DBMS should ensure that either all the transaction is performed or none of is performed. Consistence – all transactions must preserve the consistency and integrity of the database. Operations performed by an updating transaction, for instance, should not leave the database in an inconsistent state DeSiaMorewww.desiamore.com/ifm12

13 Isolation – While a transaction is updating shared data, that data may be temporarily inconsistent. Such data not be made available to other transactions until the transaction in question has finished using it. DeSiaMorewww.desiamore.com/ifm13

14 Durability – When a transaction completes, the changes made by the transaction should be durable. That is, they should preserved in the case of hardware or software failure. DeSiaMorewww.desiamore.com/ifm14

15 Transaction in SQL-Based System. In most SQL-Based products, a transaction is simply a sequence of SQL-statement that is packaged as a single entity. Relational DBMS maintain consistency by ensuring either that all the SQL statements in a transaction complete successifully or that none do. DeSiaMorewww.desiamore.com/ifm15

16 Transaction in SQL-Based System In SQL the statements COMMIT and ROLLBACK are used to delineate transactions. COMMIT makes permanent changes to a database. ROLLBACK undoes all changes made in an unsuccessful transaction. DeSiaMorewww.desiamore.com/ifm16

17 Example SQL-Transaction INSERT INTO registration(studentNo, moduleName) VALUES (34698, ‘Relational Database Systems’) UPDATE Modules SET roll = roll + 1 COMMIT DeSiaMorewww.desiamore.com/ifm17

18 CONCURRENCY Data in the database systems can be accessed by many users; multiple data sharing. E.g. Airline reservation system There must be mechanism of controlling shared or concurrent access. When there are several transactions executed on parallel on a shared database, their execution must be synchronised. DeSiaMorewww.desiamore.com/ifm18

19 Concurrency Control The primary objective of concurrency control is to prevent interference between transactions to occur. A major control strategy used for concurrency control is locking. DeSiaMorewww.desiamore.com/ifm19

20 Locking It is the most approach in contemporary DB. When a transaction locks a data-item it is saying to other transactions ‘Hey I am doing something with this data- item, wait until I have completed may task’. Importance of this to serialise access to limited resources. DeSiaMorewww.desiamore.com/ifm20

21 Two types of Locks Read locks – A read lock gives only read access to data and prevents any other transaction from updating the locked data. A transaction applies this type of lock when it wishes to query a file but does not want to change it. Also it does not want other transactions to change it while it is looking at it. DeSiaMorewww.desiamore.com/ifm21

22 Two types of Locks Write locks; this gives both read and write access to a data-item. It also prevents any other transaction from reading from or writing to a data. DeSiaMorewww.desiamore.com/ifm22

23 Transaction Manager and Transaction Log Transaction manager is a module within the kernel of a DBMS that handles the throughput of transactions against a database. It ensures that transaction either completes successfully or fails. DeSiaMorewww.desiamore.com/ifm23

24 Transaction Log The transaction log is a file that contains data about the updates affecting a database. Such data may comprise transaction records. DeSiaMorewww.desiamore.com/ifm24

25 Recovery Recovery is the process of ensuring that the database can achieve a consistent state in the event of failure. Failure can occur either when writing the data to buffers or while flushing the buffers. Flushing is the process of transferring data from buffers in main memory to secondary memory. DeSiaMorewww.desiamore.com/ifm25

26 Recovery If a transaction issued a commit but failure occurred before flushing completes, then the changes to the database will not be made permanent. In this case the recovery module will need to redo the transaction. DeSiaMorewww.desiamore.com/ifm26

27 Distributed Database System A distributed database system is a database system which is fragmented or replicated on the various configurations of hardware and software, located usually at different geographical sites within an organisation. DeSiaMorewww.desiamore.com/ifm27

28 Distributed Database System Distribution is solely said of fragmentation and replication of data. A data fragment constitutes some subset of the original database. A data replicate is constitutes of some copy of the whole or part of the original database. DeSiaMorewww.desiamore.com/ifm28

29 Distributing Data DeSiaMorewww.desiamore.com/ifm29

30 Distributing Data DeSiaMorewww.desiamore.com/ifm30

31 Distributed Database System An example of distributed database system DeSiaMorewww.desiamore.com/ifm31

32 Advantage DeSiaMorewww.desiamore.com/ifm32

33 Advantage DeSiaMorewww.desiamore.com/ifm33


Download ppt "Database Management System Module 5 DeSiaMorewww.desiamore.com/ifm1."

Similar presentations


Ads by Google