Sei sulla pagina 1di 4

Concepts of Database Management, Sixth Edition

Solutions 7-1

Chapter 7 DBMS Functions Solutions


Answers to Review Questions
Note: Answers to odd-numbered review questions are found in Appendix D of the textbook. 1. In updating and retrieving data, users do not need to know how data is physically structured on disk nor what processes the DBMS uses to manipulate the data. These structures and manipulations are solely the responsibility of the DBMS. Metadata is data about the data in a database. The catalog component of a DBMS maintains metadata about tables, fields, table relationships, views, indexes, users, privileges, and replicated data. Most PC-based DBMSs contain a catalog that maintains metadata about tables, fields, table relationships, views, indexes, users, privileges, and replicated data. Large, expensive DBMSs usually contain a data dictionary that serves as a super catalog containing the same metadata as a catalog and additional metadata such as that needed to track fragmented data. Concurrent update occurs when multiple users make updates to the same database at the same time. A lost update could occur in a concurrent update situation when two users attempt to update the same data at the same time, and the DBMS does not does not have concurrency update features such as two-phase locking or timestamping. Locking denies access by other users to data while the DBMS processes one users updates to the database. A DMBS uses locking to prevent lost updates. A transaction is a set of steps completed by a DBMS that accomplishes a single user task; the DBMS must successfully complete all transaction steps or none at all for the database to remain in a correct state. Two-phase locking is an approach for handling locks to prevent lost updates. During the first (or growing) phase, the DBMS locks more rows and releases none of the locks. After the DBMS acquires all the locks needed for the transaction and has completed all database updates, there is a second (or shrinking) phase in which the DBMS releases all the locks and acquires no new locks. Deadlock occurs in a concurrent update situation when the first user is waiting for data that has been locked by a second user, and the second user is waiting for data that has been locked by the first user. Unless outside action occurs, each user could wait for the others data forever. Deadlock occurs when each of the two users is attempting to access data that is locked by the other user. With timestamping the DBMS assigns to each database update the unique time when the update started; this time is called a timestamp. In addition, every database row includes the timestamp associated with the last update to the row. The DBMS processes updates to the database in timestamp order. If two users try to change the same row at the same time, the DBMS processes the change with the earlier timestamp. The other transaction is restarted and assigned a new timestamp value. Recovery is the process of returning the database to a state that is known to be correct from a state known to be incorrect. The journaling feature of a DBMS involves maintaining a journal or log of all updates to a database; the DBMS uses the journal to recover the database. The journal is a file separate from the database, so that the journal is still available if a catastrophe destroys the database. The two types of images output by a DBMS to

2. 3.

4. 5.

6. 7. 8.

9.

10.

11. 12.

Concepts of Database Management, Sixth Edition

Solutions 7-2

its journal are before images (what the data in records looked like in the database before updates) and after images (what the data in records looked like in the database after updates). 13. A DBA uses forward recovery when a catastrophe destroys a database. Forward recovery consists of two steps. First, the DBA copies the most recent database backup over the live database. Second, the DBMS forward recovery feature uses the log to apply after images for committed transactions. If a database has not been destroyed and transactions updated the database incorrectly or were stopped in midstream, then a DBA uses backward recovery to undo the updates for the transactions. The DBMS backward recovery feature uses the log to apply before images for the problem transactions to undo their updates. Security is the prevention of unauthorized access, either intentional or accidental, to a database. Encryption converts the data in a database to a format thats indecipherable to a word processor or other program and stores it in an encrypted format. If unauthorized users attempt to bypass the DBMS and get to the data directly, they see only the encrypted version of the data. However, authorized users accessing the data using the DBMS have no problem viewing and working with the data. Authentication refers to techniques for identifying the person who is attempting to access the DBMS. Three types of authentication are passwords, biometrics, and database passwords. A password is a string of characters assigned by the DBA to a user that the user must enter to access to the database. Biometrics identify users by physical characteristics such as fingerprints, voiceprints, handwritten signatures, and facial characteristics. A database password is a string of characters assigned by the DBA to a database that users must enter before they can access the database. Authorization rules specify which users have what type of access to which data in a database. Permissions specify what kind of access a user has to objects in a database. A workgroup is a group of users, and a DBA usually assigns appropriate permissions to workgroups. If a user is accessing a database through a view, he or she only has access to the data contained in the view. The user is prevented from accessing any data not contained in the view. Privacy refers to the right of individuals to have certain information about them kept confidential. Privacy and security are related because it is only through appropriate security measures that privacy can be ensured. Integrity constraints are rules that a DBMS must follow so that it updates data accurately and consistently. Integrity constraints can be handled in four ways: (1) Integrity constraints can be ignored. (2) The responsibility for enforcing integrity constraints can be assigned to users; that is, users would have to take great care not to enter invalid data. (3) Programs can enforce integrity constraints. (4) The DBMS can enforce integrity constraints. Of these four ways to handle integrity constraints, the last is the most desirable. When the DBMS enforces integrity constraints, users dont have to guard against entering incorrect data, and programmers dont have to build the logic to enforce the constraints in the programs they create. Data independence is a property that lets you change a database structure without requiring you to change the programs that access the database. Replication lets users at different sites use and modify copies of a database and then share their changes with the other users. After a user updates an individual replica in a replica set, the DBMS exchanges all updated data between the master database and a replica in a process called synchronization. Some utility services that a DBMS should provide include: services that let you change the database structure; services that let you add new indexes and delete indexes that are no longer needed; facilities that let you use the services available from your operating system; services that let you export data to and import data from other software products; services that provide support for easy-to-use edit and query capabilities, screen generators, report generators, and so on; support for both procedural and nonprocedural languages; and support for an easy-to-use menu-driven or switchboard-driven interface that allows users to tap into the power of the DBMS without having to resort to a complicated set of commands. When you use a procedural language, you must tell the computer precisely how a given task is to be accomplished. When you use a nonprocedural language, you describe the task you want accomplished to the computer, which then determines how to accomplish it.

14.

15. 16.

17.

18. 19. 20. 21. 22.

23. 24.

25.

26.

Concepts of Database Management, Sixth Edition

Solutions 7-3

Answers to Premiere Products Exercises


1. In transaction 2, the DBMS started it at 8:01, added an Orders table record at 8:02, added an OrderLine table record at 8:05, and added an OrderLine table record at 8:09. To rollback the transaction, the DBMS deletes the three added records. An unrepeatable read (also called an inconsistent retrieval, dirty read, or inconsistent read) occurs when a users retrieval transaction reads a set of data that other users transactions have partially updated. For example, suppose Pats transaction involves calculating the total balance for all customers, and the customer balances are $900, $750, and $500 for a total of $2,150. Suppose further that a $200 order from the third customer was entered for the first customer by mistake, and that Elenas update transaction will change the customer for that order from the first to the third customer. (The new customer balances will be $700, $750, and $700.) An unrepeatable read will occur if the DBMS processes the two transactions as follows: a) The DBMS reads the first customers $900 balance for Pats transaction. b) The DBMS reduces the first customers $900 balance to $700 for Elenas transaction. c) The DBMS read the second customers $750 balance for Pats transaction. d) The DBMS increases the third customers $500 balance to $700 for Elenas transaction. e) The DBMS reads the third customers $700 balance for Pats transaction. f) The DBMS calculates the total balance from Steps a, c, and e and displays the total customer balance of $2,350 for Patthe displayed total is $200 higher than the actual total. Many examples of situations when replication would prove useful are possible. For example, auditors might need their own replicas to review the status of data at the end of a reporting period, and an executive might need a replica as part of a presentation to other executives. You use a statistical database to produce only statistics (sums, averages, maximums, counts, and so on) about the data in the database. If the database contains confidential data, you should not be able to infer information about any individual record in the database. The problem with statistical databases is that you can obtain information about individual records in the database. For example, suppose that the commissions earned by Premiere Products reps are confidential to Pat, that Pat can use only statistical queries against the Rep table, and that she wants to find out Valerie Kaisers commission. Because Valerie is the only rep living in Grove FL, Pat can determine Valeries commission by requesting the average commission for reps in Grove FL. Thus, by obtaining a statistic, Pat can infer information about an individual. It might seem you could avoid this problem by reporting a statistic only when there was a minimum number of values upon which the statistic was calculated. The DBMS could report an average commission, for example, only if there were at least five records within the sample used for the statistic. Even this might not be good enough, however. Suppose Premiere Products has six reps and Valerie is the only female rep. If Pat requested the average commission of all reps, the DBMS would give the answer because six reps are involved in the query. The DBMS would not give an answer if Pat requested the average commission of all female reps, but it would give an answer if Pat requested the average commission of all male reps because five reps are involved. From these two averages, however, Pat could calculate Valeries commission, thus circumventing the confidentiality controls built into the DBMS. Researchers have proposed other solutions to the confidentiality problem, but no solution works perfectly in all situations. Biometric identification techniques, or biometrics, include voiceprints, handwritten signatures, keystroke/signature dynamics, fingerprints, face images, eye images, palm images, hand geometry images, and wrist vein or thermal images. The answer depends on the specific source material used by the student.

2.

3.

4.

5.

Answers to Henry Books Case


1. 2. The answer depends on the particular DBMS comparison used. The answer depends on the particular DBMS used at your school. You can search your DBMS vendors Web site or its literature to find current information about the DBMS.

Concepts of Database Management, Sixth Edition 3.

Solutions 7-4

The answer depends on the particular DBMS selected. You can search the Web for IBM for DB2, MySQL, Oracle, or Sybase to find current information about the DBMS.

Answers to Alexamara Marina Group Case


1. Transaction 1 modifies the ServiceRequest (add) table. Transaction 2 modifies the Marina (change) and MarinaSlip (change) tables. Transaction 3 modifies the Owner (change) and MarinaSlip (change) tables. Transaction 4 modifies the MarinaSlip (change) and Owner (change) tables.. The recovery program would use Transactions 1 and 3 to update the restored database. Uses would have to reenter Transactions 2 and 4. Transactions 3 and 4 could have created deadlock. If Transaction 3 at 11:08 moved to 11:14, for example, deadlock would occur. First, it would be best for all boat-related data to be stored in a Boat table and to pull that data out of the MarinaSlip table. Second, there would be a many-to-many relationship between the Boat and Owner tables, and a BoatOwner table would be the intersection table for this relationship. The resulting database design for the affected tables would be as follows: Owner (OwnerNum, LastName, FirstName, Address, City, State, Zip) Boat (BoatName, BoatType) BoatOwner (BoatName, OwnerNum) MarinaSlip (SlipID, MarinaNum, SlipNum, Length, RentalFee, BoatName) The defining query for the view would be as follows: CREATE VIEW OwnerBoat AS SELECT Owner.OwnerNum, LastName, FirstName, BoatName FROM Owner, BoatOwner WHERE Owner.OwnerNum=BoatOwner.OwnerNum ;

2. 3. 4.

Potrebbero piacerti anche