Sooner or later, you'll lose some data in the database. As a user, you may delete some rows in a table that you really didn't want to delete. As a DBA, you may have a server crash or one of the server's hard disks may fail, resulting in loss of data.
Oracle provides a number of tools for both users and DBAs to minimize data loss in these situations. Some of the tools are primarily for use by the DBA; other tools are primarily used by the database user.
This begins with descriptions of the types of failures possible in the database and then discusses the different ways that you can back up and restore data.
Database failures can be divided into two general categories: media failures and nonmedia failures.
Media failures, the more serious type, occur when a server hardware component fails and the contents of one or more disk files are either unreadable or corrupted. The DBA is solely responsible for recovering from this type of failure by restoring the unreadable or corrupted file from a tape or disk backup. The DBA can perform the recovery process using one of the tools described in this.
Media Failure A type of database failure where a server hardware component fails and the contents of one or more disk files are either unreadable or corrupted.
Nonmedia Failure A type of database failure that is not related to a server disk-related hardware component and is one of several types: statement failure, process failure, instance failure, or user error.
Nonmedia failures are all other types of failures, including the following:
Statement failure The SQL statement being executed has a syntax error or the user executing the statement has the wrong permissions. Recovery from a statement failure is generally simple: Rerun the SQL statement with the right syntax or obtain the proper permissions on the objects in the query, and then rerun the query.
Process failure The user may be disconnected from the database due to a network problem or because a resource limit was exceeded. One of the Oracle background processes automatically cleans up the terminated process by freeing the memory used by the process.
Instance failure The entire database instance fails due to a power outage, a server memory problem, or a bug in the Oracle software. When the database instance is restarted, Oracle uses the redo log files to make sure that all committed transactions are recorded properly in the database datafiles.
User error A user may drop a table or delete rows from a table unintentionally.
In the following sections, we'll cover the processes used by DBAs and users to recover from the two types of errors that Oracle cannot handle automatically: media failures and user errors.