Hot backups (aka online backups) are copies of data files taken while the database is up and running. Only databases in ARCHIVELOG mode are eligible for hot backups. Furthermore, the backup is not simply an OS level copy of the entire database at once. Each tablespace is placed in "hot backup mode," which freezes the data file headers so the SCN does not increase. Then, each data file in the tablespace is copied to the backup destination. Once those files are successfully copied, that tablespace is taken out of backup mode and the file headers are unfrozen. The backup process then advances to the next tablespace and performs the same process. Once all the tablespaces are copied, the hot backup is complete. The result is a copy of each tablespace and its corresponding data files, whereby each set of data files has a slightly different timestamp.
Believe it or not, this method is the most flexible way to back up an Oracle database. Rather than backing up an entire database (as with cold backups), these hot backups save files at the tablespace level. If a disk fails and you lose a mount point, simply restore those lost files from the hot backup. During the recovery, Oracle will notice that they have an earlier timestamp than specified in the surviving control files. Oracle will go into recovery mode and prompt you for all the archive log files after the timestamp of the restored files. Oracle will then "replay" the transactions in the archived log files and eventually the online redo log files to bring all the data files to the current SCN. Oracle will then open the database for business as normal.
Conceptually, that is how Oracle recovers to the current point in time using archive log files. All that is needed is the archived log files, a current control file (to see how far to recover to), and valid copies of the data files. The restored data files can come from a cold backup, a series of hot backups, or a mixture of both. Oracle only cares whether the files were closed normally or were in hot backup mode when they were copied to the backup location.
Oracle does, however, require a continuous chain of valid archive log files. Conceivably, you can restore a backup of a data file taken the previous year as long as you have every archive log file since that backup. If you encounter a gap in your archive log files, your recovery will be halted at the last continuous file.
Hot backups only apply to data files that are part of tablespaces. Control files and online redo logs are not part of a hot backup per se. Rather, they are used to implement the recovery by providing guidance for what to recover (via the control files) and the most recent transactions (via the redo log files). The hot backup and recovery methodology is largely based on the assumption that at least one control file and one member of each redo log group will survive the initial failure. This is a big reason why you multiplex your control and online redo log files. If you lose all of either the control or redo log files, you must first recover them before you can attempt to recover the data files. A failure of this magnitude only adds to the complexity and time to recover the database.
Was this article helpful?