With the rapid development of office automation and electronic commerce, the dependence of enterprise on information system is more and more high, and database plays an important role as the core of information system. Especially in some industries with high data reliability requirements such as banks, securities, telecommunications and so on, if there is an accidental downtime or loss of data will be very heavy. This database administrator should develop a detailed database backup and disaster recovery strategy for specific business requirements, and rigorously test every possible situation by simulating failures to ensure high availability of data. Database backup is a long-term process, and recovery is only after an accident, recovery can be seen as the reverse process of backup, the degree of recovery depends largely on the situation of backup. In addition, the correctness of the steps taken by the database administrator during the recovery has a direct impact on the final recovery results, this article mainly for the Oracle database may encounter a variety of failures to provide a corresponding recovery method, for everyone's reference.
To have a clear understanding of Oracle database Backup and recovery, it is necessary to have a good understanding of several running states of the database. The operating state of an Oracle database is divided into 3 main categories, which are:
L Nomount (not installed) Oracle simply reads the configuration information in the INI file and initializes the SGA area.
L mount (install) Oracle reads the INI file as well as read the control file and obtains information about the physical structure of the database.
L Open Database to check that all files are at the same point in time, restore errors to rollback for unfinished transactions, and eventually allow users to access.
Database backup mainly divided into three types: cold backup, hot backup; logical backup;
The backup of the database is not the focus of this article, here is a brief overview, Oracle database backup mainly:
Cold backup is a database full backup that includes all data files, control files, online log files, and INI files in the state of shutting down the database.
Hot backup refers to backing up the data files and control files while the database is running, and you must run the database in the (Archive Log) archive mode to use hot backups.
L Export (logical backup) This is the simplest backup method that can be exported by a table, a user, or an entire database in a database, and supports full, cumulative, and incremental three ways. With this method, the database must be open, and if the database is not in the restrict state it will not guarantee the consistency of the exported data.
The recovery of database can be divided into two main categories: complete recovery; incomplete recovery;
Full recovery refers to restoring the database to a point in time of failure without losing any data. Incomplete recovery refers to restoring a database to a point in time before a failure occurs, and all changes after this point in time will be lost. If there are no special requirements, we recommend that full recovery should be used as far as possible.
The Oracle Database recovery process takes place in two steps, starting with all the redo in the redo log file to the data file, and then rolling back all uncommitted transactions in the redo so that all data is restored to the moment of disaster. The recovery of a database can only be done on the data file before the failure, restoring it to the point of failure, and the data file cannot be rolled back to a previous time. For example, we have a 2001/1/1 database backup, and when 2001/5/1 brings us to the confusion of data in the database and wants to restore the database to 2001/4/30, we can only recover the 2001/1/ 1 database backup and then use the redo record on it to roll it forward to the 2001/4/30 state, instead of rolling back the 2001/5/1 database to 2001/4/30.
In order to design the database recovery scheme, we first classify the errors that may be encountered, the Oracle database errors are divided into 5 main categories:
L SQL statement failed
L Thread Failure
L Instance failed
L User Action failed
L Storage Device failed