Chapter 14. Protecting Data

In This Chapter

  • Avoiding database damage

  • Understanding the problems caused by concurrent operations

  • Dealing with concurrency problems through SQL mechanisms

  • Tailoring protection to your needs with SET TRANSACTION

  • Protecting your data without paralyzing operations

Everyone has heard of Murphy's Law — usually stated, “If anything can go wrong, it will.” People joke about this pseudo‐law because most of the time things go fine. At times, you may feel lucky because you're untouched by one of the basic laws of the universe. When unexpected problems arise, you probably just recognize what has happened and deal with it.

In a complex structure, the potential for unanticipated problems shoots way up (a mathematician might say it “increases approximately as the square of the complexity”). Thus large software projects are almost always delivered late and are often loaded with bugs. A nontrivial, multiuser DBMS application is a large, complex structure. In the course of operation, many things can go wrong. Methods have been developed for minimizing the impact of these problems, but the problems can never be eliminated completely. This is good news for professional database maintenance and repair people, because automating them out of a job will probably never be possible. This chapter discusses the major things that can go wrong with a database and the tools that SQL provides for you to deal with the problems that arise.

Threats to Data Integrity

Cyberspace (including your ...

Get SQL For Dummies® now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.