Database concepts 7th edition kroenke solutions manual

Page 1

Visit to download the full and correct content document: https://testbankdeal.com/dow nload/database-concepts-7th-edition-kroenke-solutions-manual/

Database Concepts 7th Edition Kroenke Solutions Manual

Database Concepts

Seventh Edition

David M. Kroenke • David J. Auer

Instructor’s Manual

Prepared by David J. Auer

CHAPTER SIX

DATABASE ADMINISTRATION

Page 1 of 30
Page 2 of 30 Instructor's Manual to accompany: Database Concepts (Seventh Edition)
M. Kroenke and David J. Auer © 2015, 2013, 2011, 2010, 2008 Pearson Education, Inc. Publishing as Prentice Hall
David

 CHAPTER OBJECTIVES

• Understand the need for and importance of database administration

• Learn different ways of processing a database

• Understand the need for concurrency control, security, and backup and recovery

• Learn typical problems that can occur when multiple users process a database concurrently

• Understand the use of locking and the problem of deadlock

• Learn the difference between optimistic and pessimistic locking

• Know the meaning of ACID transaction

• Learn the four 1992 ANSI standard isolation levels

• Understand the need for security and specific tasks for improving database security

• Know the difference between recovery via reprocessing and recovery via rollback/rollforward

• Understand the nature of the tasks required for recovery using rollback/rollforward

• Know basic administrative and managerial DBA functions

 CHAPTER ERRATA

There are no known errors at this time. Any errors that are discovered in the future will be reported and corrected in the Online DBC e07 Errata document, which will be available at http://www.pearsonhighered.com/kroenke

 THE ACCESS WORKBENCH

Solutions to the Access Workbench exercises may be found in Solutions to all Sections: The Access Workbench, which is a separate document within the Instructor’s Manual.

 TEACHING SUGGESTIONS

• This chapter introduces the topic of database administration by describing the fundamental concepts, technology, and terminology used for multi-user database management.

Page 3 of 30

Chapter
– Database
Six
Administration

• This text distinguishes between database administration and data administration. The latter is an organizational activity that typically sits high in the enterprise organization chart and may be concerned with much larger issues than the maintenance of a particular database. This chapter is concerned with database administration, a more pedestrian function that occurs at a much lower level in the organization. Every multi-user database needs a database administrator. The administrator may only have a few tasks to perform and may work on them only a few hours a week, but someone needs to be given the responsibility for ensuring that the database administration tasks are accomplished on a timely basis. This is especially true for Internet technology databases where the users may be far away or even anonymous, and where the consequences of failures and mistakes will be difficult to correct.

• Concurrency control is important and sometimes seems obscure. If users do not learn the concepts and techniques, however, the DBMS will use default settings. These defaults may be perfect, but they also may be terrible. Thus, even though these issues can be ignored, the consequences of them cannot be avoided.

• Security is becoming more and more important. As implied in the text, for Internet applications, security tasks are accomplished by both the Web server and the DBMS. Students should look into these issues when they have had both Web server and database classes.

• If you are working with SQL Server 2014, be sure to create the server login and database user accounts as shown in the chapter. The Web site material in Chapter 7 will not work without them!

• The goal of this chapter with regard to backup and recovery is to raise the students’ consciousness to these issues. They should get a general idea of the importance of backup and recovery and the general nature of backup and recovery tools and techniques

 ANSWERS TO REVIEW QUESTIONS

6.1 What is the purpose of database administration?

The purpose of this function is to manage a database so that its value to an organization is maximized.

6.2 Explain how database administration tasks vary with the size and complexity of the database.

Single-user databases are much easier to administer than large organizational databases with hundreds of concurrent users and dozens of applications.

6.3 What are two interpretations of the abbreviation DBA? Database administration and database administrator.

Page 4 of 30

Chapter Six – Database Administration

6.4 What is the purpose of concurrency control?

The purpose of concurrency control is to ensure that the results obtained when more than one user processes the database are consistent with what is expected.

6.5 What is the goal of a database security system?

The goal of a database security system is to ensure that only authorized users can take authorized actions at appropriate times.

6.6 Explain the meaning of the word inappropriately in the phrase “one user’s work does not inappropriately influence another user’s work.”

It means that any overlap of work results is anticipated and is in accordance with the requirements. In some applications, the work of two users is supposed to be completely isolated from each other, say patient records processing for two different patients in a hospital. In other applications, two users’ work need not be so isolated someone who wants the latest stock price won’t mind if the price is updated as the list is being produced as long as they know that it may happen.

6.7 Explain the trade-off that exists in concurrency control.

A high level of control granularity means easy administration for the DBMS but poor throughput. A low level of control granularity means difficult administration for the DBMS, but better throughput.

6.8 Describe what an atomic transaction is and explain why atomicity is important.

An atomic transaction is one in which either all of the database actions are committed to the database or none of them are. Without it, there is a danger that partially processed transactions will be committed to the database.

6.9 Explain the difference between concurrent transactions and simultaneous transactions. How many CPUs are required for simultaneous transactions?

With concurrent transactions, two or more users access the database using a single CPU on the database server. The CPU executes some instructions from one, and then executes some from the other, switching back and forth between them. The actions may appear simultaneous to the two users. For transactions to be simultaneous, they would have to be actually processed at the same time. For transactions to be processed simultaneously, two or more CPUs are required. With modern server computers, such processing is possible.

6.10 Give an example, other than the one in this text, of the lost update problem.

The lost update problem occurs when two transactions attempt to update the same data resource simultaneously. Because each transaction copies the record into its work area, each can effect different changes and then rewrite the record. The problem is that all updates except the last one to be rewritten are lost. Example: At a music store, two salespeople rent the same B-flat clarinet to two different customers.

Page 5 of 30

Chapter Six – Database Administration

6.11 Define the terms dirty read, nonrepeatable read, and phantom read

• A dirty read reads data that has been changed but not committed by another user.

• A nonrepeatable read is a read in which multiple reads of the same record may not obtain the same values because of changes made by other users.

• A phantom read occurs when new rows are found on a second or subsequent read of a file.

6.12 Explain the difference between an explicit and an implicit lock.

Explicit locks are set by the application program, while implicit locks are set by the DBMS on behalf of the application or users.

6.13 What is lock granularity?

Lock granularity is the size of the resource that is locked. Large grained locks are easy for the DBMS to administer but result in frequent conflicts, whereas small grained locks are more difficult and expensive to administer but result in fewer conflicts.

6.14 Explain the difference between an exclusive lock and a shared lock.

An exclusive lock allows no other access, whereas a shared lock allows other transactions to read but not update the data.

6.15 Explain two-phased locking.

The two-phase locking strategy is used to obtain a number of locks until a lock is released, and after that no more locks can be obtained until all are released. Thus, the transaction has a lock growing phase and then a lock shrinking phase. Most DBMS products implement a special case of this in which all locks are released when a transaction commits.

6.16 How does releasing all locks at the end of a transaction relate to two-phase locking?

It is a special case of two-phase locking during the life of the transaction, locks are only acquired (the growing phase). When the transaction is committed, all locks are released. The shrinking phase occurs at one point.

6.17 What is deadlock? How can it be avoided? How can it be resolved when it occurs?

Deadlock occurs when each of two transactions is waiting for a resource the other has locked. Both transactions are placed in the wait state, but neither one can get out of it. A DBMS can either prevent the deadly embrace from occurring (via control over locking) or it can allow it and then detect and break it (by aborting one of the transactions, thus releasing its locks and enabling the other transaction to continue).

6.18 Explain the difference between optimistic and pessimistic locking.

The assumption with optimistic locking is that conflict will not occur. Therefore, no locks are placed until the transaction is completed. At that point, locks are obtained and records are updated only if they have not been changed since last read. With pessimistic locking, the assumption is made that conflict will occur. Therefore, records are locked before they’re read. When the transaction is complete, all locks are released.

Page 6 of 30

Chapter Six – Database Administration

6.19 Explain the benefits of marking transaction boundaries, declaring lock characteristics, and letting a DBMS place locks.

It’s more flexible and puts less demand on the application programmer. The programmer defines the boundaries of the transaction and then defines the locking behavior that is wanted. The DBMS then figures out where to set locks. If the locking behavior declaration is subsequently changed, the DBMS will then place locks in accordance with the new behavior. This reduces the likelihood of programmer errors as well.

6.20 Explain the use of the SQL transaction control statements BEGIN TRANSACTION, COMMIT TRANSACTION, and ROLLBACK TRANSACTION.

These statements are used to mark transaction boundaries. The application programmer must set these boundaries because the DBMS cannot automatically determine what DBMS operations are to be atomic.

6.21 Explain the meaning of the expression ACID transaction. An ACID transaction is atomic, consistent, insolated, and durable.

6.22 Describe statement-level consistency.

An update will apply to a set of rows as they existed at the time the statement was first executed.

6.23 Describe transaction-level consistency. What disadvantage can exist with it?

All updates in a transaction will be to rows as they existed at the time the transaction began. The possible disadvantage is that, depending on how this is implemented, transaction cannot view its own changes.

6.24 What is the purpose of transaction isolation levels?

They exist to provide flexibility in the degree of isolation between the works of different transactions.

6.25 Explain what read uncommitted isolation level is. Give an example of its use.

The read uncommitted isolation level allows dirty reads, nonrepeatable reads, and phantom reads. It might be used when making a list of Web sites in response to a search for articles on a movie.

6.26 Explain what read committed isolation level is. Give an example of its use.

The read committed isolation level disallows dirty reads, but allows nonrepeatable reads and phantom reads. It might be used when making a list of stock prices that are expected to be current only as of the time the stock price was read.

Chapter Six – Database Administration
Page 7 of 30

6.27 Explain what repeatable read isolation level is. Give an example of its use.

The repeatable read isolation level disallows dirty reads and nonrepeatable reads, but allows phantom reads. It might be used when making a list of inventory quantities on a list of inventory items that were known to be in the database when the read began.

6.28 Explain what serializable isolation level is. Give an example of its use.

The serializable isolation level disallows dirty reads, nonrepeatable reads, and phantom reads. It might be used when rank ordering a list of commodities, where the ranking process requires several passes through the table.

6.29 Explain the term cursor

A cursor is a pointer into a set of rows.

6.30 Explain why a transaction may have many cursors. Also, how is it possible that a transaction may have more than one cursor on a given table?

The transaction may need to process several tables at one time. A cursor can be opened on two different views of a table (these are SQL views, not application views), in which case there will be two cursors open on the same table for that transaction. Furthermore, there are some transactions in which the logic requires that two cursors process the same table.

6.31 What is the advantage of using different types of cursors?

Because cursors require considerable memory, having many cursors open at the same time for, say, a thousand concurrent transactions, can consume considerable memory and CPU time. One way to reduce cursor overhead is to define reduced-capability cursors and use them when a full-capability cursor is not needed.

6.32 Explain forward-only cursors. Give an example of their use.

The simplest cursor is the forward-only cursor. With it, the application can only move forward through the recordset. Changes made by other cursors in this transaction and by other transactions will be visible only if they occur in rows ahead of the cursor. They would be used when processing a report sequentially and you use a forward-only cursor when you are sequentially reading a recordset.

6.33 Explain static cursors. Give an example of their use.

With a static cursor, the application sees the data as it was at the time the cursor was opened. Changes made by this cursor are visible. Changes from other sources are not visible. Both backward and forward scrolling are allowed. Use this when processing a recordset and you need to see any changes you have made but not changes other users have made.

6.34 Explain keyset cursors. Give an example of their use.

Dynamic changes of any type and from any source are visible. When the cursor is opened, a primary key value is saved for each row in the recordset. When the application accesses a row, the key is used to fetch the current values for the row. All inserts, updates, deletions, and

Page 8 of 30

Chapter Six – Database Administration

Chapter Six – Database Administration

changes in the recordset order are visible. If the isolation level is dirty read, then uncommitted changes are visible. Otherwise, only committed changes are visible. Updates from any source are visible. Inserts from sources outside this cursor are not visible (There is no key for them in the keyset ) Inserts from this cursor appear at the bottom of the recordset. Deletions from any source are visible. Use a keyset cursor when you need to see updates from any source and your own inserts, but not inserts from other sources

6.35 Explain dynamic cursors. Give an example of their use.

With a dynamic cursor, changes in row order are not visible. If the isolation level is dirty read, then committed updates and deletions are visible; otherwise only committed updates and deletions are visible. Use a dynamic cursor when you need to see all changes being made. Use with dirty read isolation level to see uncommitted changes, otherwise only committed changes will be seen.

6.36 What happens if you do not declare transaction-isolation level and cursor type to the DBMS? Is not declaring the isolation level and cursor type good or bad?

If you do not specify the isolation level of a transaction or do not specify the type of cursors you open, the DBMS will use a default level and type. These defaults may be perfect for your application, but they also may be terrible. Thus, even though these issues can be ignored, the consequences of them cannot be avoided.

6.37 Explain the necessity of defining processing rights and responsibilities. How are such responsibilities enforced?

We need to define processing rights and responsibilities to bring order to the processing of the database, which is a shared resource. While rights can be enforced by the DBMS and application programs, responsibilities must be documented and understood by users. The upholding of responsibilities cannot be automated; it’s a matter of user training and behavior.

6.38 Explain the relationships of users, groups, permission, and objects for a generic database security system.

Permissions give roles to users and database objects themselves the ability to interact with database objects. [NOTE: Although permissions can be granted to users, a basic principle of systems administration is that, unless absolutely necessary, no users should have permissions granted directly to them. Instead, users should be placed in roles (which will hold groups of users), and the roles should be granted permissions to the database objects].

Each user can be in many roles, and each role can have many users. Each user, role or object may have many permissions. Each permission gives one user, role or object to one database object.

6.39 Describe the advantages and disadvantages of DBMS-provided security. Advantages:

• Easier to implement

• Done regardless of the source of data changes and activities

Page 9 of 30

• Probably more consistent

Disadvantages:

• May not suffice for particular needs

• Works best for vertical security

6.40 Describe the advantages and disadvantages of application-provided security.

Advantages:

• Easier to implement

• Done regardless of the source of data changes and activities

• Probably more consistent

Disadvantages:

• May not suffice for particular needs

• Works best for vertical security

6.41 Explain how a database could be recovered via reprocessing. Why is this generally not feasible?

Reprocessing means reapplying all transactions since the latest database save to that saved copy of the database. Because reprocessing takes as much time as original processing, reprocessing is usually infeasible. Additionally, initially asynchronous events may occur in a different order.

6.42 Define the terms rollback and rollforward.

Rollback means applying before images (before changes were made) to the current database. This takes the database backwards in time.

Rollforward means loading the latest database backup then applying all after images (after changes were made) to it. This brings the database forward in time.

6.43 Why is it important to write to a log before changing the database values?

When database values are written to the log before they are changed in the database, the log record is correct in the event a database failure. Otherwise the database could be behind the log and changes that were committed might not be recovered.

6.44 Describe the rollback process. Under what conditions should rollback be used?

Start with a current copy of the database, and then back out changes. This method is used when database has not been lost; there is just some update activity that needs to be removed.

Chapter Six – Database Administration
Page 10 of 30

6.45 Describe the rollforward process. Under what conditions should rollforward be used?

Start with a restored database from a prior saved backup, then apply after images. This method is used when database has been lost.

6.46 What is the advantage of making frequent checkpoints of a database?

Checkpoints are snapshots of updated parts of a database. They can be taken automatically by the DBMS. In the event of a needed recovery, checkpoints can be used to perform recovery because they provide a point of synchronization between the log and the database. This is faster than recovering the entire database from a backup and then applying all after images since the backup was taken.

6.47 Summarize a DBA’s responsibilities for managing database user problems.

The DBA’s responsibilities for managing user problems include:

• Creating and managing a process for gathering and recording user-reported errors and other problems

• Creating and managing a process to prioritize user-reported errors and other problems

• Creating and managing a process for ensuring that user-reported errors and other problems are corrected

6.48 Summarize the DBA’s responsibilities for configuration control.

The DBA’s responsibilities for configuration control include:

• Creating and managing a process for recording change requests

• Creating and managing a process for conducting user and developer reviews of change requests

• Creating and managing a process for creating tasks and projects for implementing approved change requests

6.49 Summarize the DBA’s responsibilities for documentation.

The DBA’s responsibilities for documentation include ensuring that proper documentation is maintained on:

• Database structure

• Concurrency control

• Security

• Backup and recovery

• What applications use that database, and how they use it

Page 11 of 30

Six – Database
Chapter
Administration

 ANSWERS TO EXERCISES

6.50 If you have access to Microsoft SQL Server 2014, search its help system to answer the following questions

A. Does Microsoft SQL Server 2014 support both optimistic and pessimistic locking?

Yes.

B. What levels of transaction isolation are available?

All via cursor type

C. What types of cursors, if any, does Microsoft SQL Server use?

READ_ONLY, OPTIMISTIC, SCROLL_LOCK (=Optimistic)

D. How does the security model for Microsoft SQL Server 2014 differ from that shown in Figure 6-15?

In SQL Server 2000, it was pretty much the same. SQL Server 2005 added a new layer, name “schema”, which has continued into SQL Server 2008, SQL Server 2008 R2, 2012 and now SQL Server 2014. Schemas own objects, while users own schemas. Schemas are now database owners, and the “dbo” that is seen in the SQL Server 2014 screen shots refers to the dbo schema, not a dbo user (which no longer exists).

E. Summarize the types of Microsoft SQL Server 2014 backup.

You can create a complete or differential backup of the database, you can create a transaction log backup, and you can create a backup of particular files and file groups.

F. Summarize the Microsoft SQL Server recovery models.

They are simple, full, and bulk-logged. With the simple recovery model, no logging is done. The only way to recover a database is to restore the database to the last backup. Changes made since that last backup are lost. The simple recovery model could be used for a database that is never changed say, one having the names and locations of the occupants of a full graveyard. Or, one that is used for read-only analysis of data that is copied from some other transactional database. With full recovery, all database changes are logged, and with bulk-logged database recovery, all changes are logged except those that cause large log entries. With bulk-logged recovery, changes to large text and graphic data items are not recorded to the log actions like CREATE INDEX are not logged, and some other bulk-oriented actions are not logged. An organization would use bulk-logged recovery if conserving log space is important and if the data used in the bulk operations is saved in some other way.

Page 12 of 30

Chapter Six – Database Administration

6.51 If you have access to Oracle Database Express Edition 11g Release 2, search its help system to answer the following questions.

A. How does Oracle Database Express Edition 11g Release 2 use read locks and write locks?

From “Summary of Locking Behavior” on Page 9-12 of Oracle Database Concepts in the Oracle Database 11g Release 2 Documentation Library (available at http://docs.oracle.com/cd/E11882_01/index.htm):

Locks affect the interaction of readers and writers. A reader is a query of a resource, whereas a writer is a statement modifying a resource. The following rules summarize the locking behavior of Oracle Database for readers and writers:

■ A row is locked only when modified by a writer.

When a statement updates one row, the transaction acquires a lock for this row only. By locking table data at the row level, the database minimizes contention for the same data. Under normal circumstances1 the database does not escalate a row lock to the block or table level.

■ A writer of a row blocks a concurrent writer of the same row.

If one transaction is modifying a row, then a row lock prevents a different transaction from modifying the same row simultaneously.

■ A reader never blocks a writer.

Because a reader of a row does not lock it, a writer can modify this row. The only exception is a SELECT ... FOR UPDATE statement, which is a special type of SELECT statement that does lock the row that it is reading.

■ A writer never blocks a reader

Page 13 of 30

Chapter Six – Database Administration

Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.
Database concepts 7th edition kroenke solutions manual by martha.craig760 - Issuu