HomeOracle Page 2 - Using Control Files for Backup and Recovery
Enabling ARCHIVELOG Mode - Oracle
In this second part of a three-part series on backing up and recovering an Oracle database, you'll learn about multiplexing control files and enabling ARCHIVELOG mode. This article is excerpted from chapter 30 of the book Beginning PHP and Oracle: From Novice to Professional, written by W. Jason Gilmore and Bob Bryla (Apress; ISBN: 9781590597705).
A database in ARCHIVELOGmode automatically backs up a filled online redo log file after the switch to the next online redo log file. Although this requires more disk space, there are two distinct advantages to usingARCHIVELOGmode:
After media failure, you can recover all committed transactions up to the point in time of the media failure if you have backups of all archived and online redo log files since the last backup, the control file from the most recent backup, and all datafiles from the last backup.
You can back up the database while it is online. If you do not useARCHIVELOGmode, you must shut down the database to perform a database backup. This is an important consideration when you must have your database available to users 24 hours a day, 7 days a week.
By default, an Oracle Database XE installation is inNOARCHIVELOGmode. If your database is used primarily for development and you make occasional full backups of the database, this may be sufficient. However, if you use your database in a production environment, you should useARCHIVELOG mode to ensure that no user transactions are lost due to a media failure. To enableARCHIVELOGmode, perform the following steps. First, connect to the database withSYSDBAprivileges, and shut down the database:
Next, start up the database inMOUNTmode. This mode reads the contents of the control file and starts the instance but does not open the datafiles:
Total System Global Area 146800640 bytes Fixed Size 1257668 bytes Variable Size 88084284 bytes Database Buffers 54525952 bytes Redo Buffers 2932736 bytes Database mounted.
Next, enableARCHIVELOGmode with this command:
alter database archivelog;
Finally, open the database:
alter database open;
The Oracle Database XE home page’s Usage Monitor section now indicates the new status of the database, as you can see in Figure 40-3.
Figure 40-3.Database status after enabling ARCHIVELOG mode
After you perform one full backup of the database, the archived and online log files will ensure that you will not lose any committed transactions due to media failure. In addition, to save disk space you can purge (or move to tape and then purge) all archived redo log files and previous backups created before the full backup. Only those archived redo log files created since the last full backup are needed to recover the database when a media failure occurs; the combination of a full backup and subsequent archived redo log files will ensure that you will not lose any committed transactions. The previous full backups and subsequent archived redo log files created before the latest full backup will only be useful if you need to restore the database to a point in time before the most recent full backup.