Oracle7 Administrator's Reference for UNIX
ARCHIVELOG Mode
In ARCHIVELOG mode, redo log files are archived to disk or tape before being overwritten. The Oracle instance suspends activity if no log file is available.
Starting Redo Log Archiving
Running in ARCHIVELOG mode prevents an inactive log file from being overwritten before it has been archived to disk or tape. Use the following SQL statement to put the database into ARCHIVELOG mode:
ALTER DATABASE ARCHIVELOG;
Update the initsid.ora File
To enable automatic redo log archiving, add the following parameters to the initsid.ora file:
These parameters can be set or overridden after instance startup using Server Manager.
LOG_ARCHIVE_DEST
Specify the destination directory for archived log files by setting LOG_ARCHIVE_DEST.
Default value: $ORACLE_HOME/dbs/arch
LOG_ARCHIVE_DEST = device [: volume M|K|B]
where:
device | is the location where the redo log file is to be archived. |
volume | applicable only to tape archiving. This is the size limit of the tape volume. The tape must be able to hold the size of one log file, plus an overhead of 6 kilobytes. If your largest log file is 5 MB, the tape must accommodate at least 5.006 MB. If the tape limit is reached, the ARCH daemon stops the log archiving operation and sends a message to archmon to prompt you to mount another tape. After the tape is mounted, archmon reads your response, and instructs the ARCH daemon to resume log archiving. |
B, K, or M | Indicates whether volume refers to bytes, kilobytes, or megabytes. The default is bytes. |
For example, the initsid.ora entry for archiving the redo log file to a 100 MB tape on the device /dev/rmt0, would look like:
LOG_ARCHIVE_DEST = /dev/rmt0:100M
LOG_ARCHIVE_FORMAT
Specify the filename format for archived redo logs by setting LOG_ARCHIVE_FORMAT.
Default value: %t_%s.dbf
where
%t | is the thread number |
%s | is the log sequence number |
The thread number is unnecessary, unless you are using the Oracle Parallel Server, where the thread number specifies the instance which generated the redo log.
For example, a non-Oracle Parallel Server entry in initsid.ora would look like:
LOG_ARCHIVE_FORMAT = arch%s.dbf
LOG_ARCHIVE_START
Specify automatic redo log archiving at instance startup by adding an entry for LOG_ARCHIVE_START to your initsid.ora file.
Default value: false
Automatic archiving of redo logs is not enabled by default. It is usually unnecessary to archive redo information generated during database creation. Once the database has been created and put into ARCHIVELOG mode, there is no reason not to archive automatically.
Set LOG_ARCHIVE_START to true after you create the database.
For Parallel Server: Archiving is done on a per-instance basis and can be either manual or automatic. Instances running concurrently should archive by the same method.
Stopping Redo Log Archiving
Stop automatic log archiving by editing the initsid.ora file and restarting the database, or by overriding the initialization parameters on a running instance using Server Manager.
If LOG_ARCHIVE_START is set to false when the database is in ARCHIVELOG mode, you must archive logs manually. When the database is operating in ARCHIVELOG mode, the LGWR process will not overwrite a redo log that has not been archived Instead, LGWR prevents further transactions until a log buffer is available.
To end ARCHIVELOG mode, use the SQL statement ALTER DATABASE NOARCHIVELOG when the database is shut down. Reopen the database with the ALTER DATABASE OPEN statement.
See Also: Chapter 4, "Commands", in the Oracle7 Server SQL Reference for more information on the ARCHIVE LOG clause syntax.
Archiving Directly to Tape
You can set up your system to archive redo logs directly to tape. However, archiving to tape may slow your system. Oracle Corporation recommends you archive redo logs to disk.
To archive directly to tape:
1. Mount the archiving device.
2. Set up automatic redo log archiving as explained in the section "Starting Redo Log Archiving".
3. Start the archmon program.
The archmon Program
The archmon program:
- monitors the ARCH process and displays error messages
- prompts for new tapes and confirms successful activity
Run archmon in a dedicated window or dedicated terminal and check it regularly for error messages.
Stopping archmon
You can stop archmon when you shut down the database, or when you stop log archiving. Use one of the following SQL statements to shut down the database and preserve the integrity of redo log file archiving:
After SHUTDOWN, archmon archives all remaining redo log files and signs off with the following message:
Message from ora_arch_MAIN@central at 11:34 ...
Normal, successful termination.
If you use SHUTDOWN ABORT to shut down the database, some log files are not completely archived. You may lose data necessary to restore the database from the archived tape. In this case, start the database from the redo log.
When starting a database after SHUTDOWN ABORT, smon recovers to a consistent state. If an archived log file is not on the tape, the user is prompted for a new log. At this point, the user can specify a log file that has the proper sequence number in it.
Interrupting archmon
You can interrupt archmon, or kill and re-invoke it. However, if archmon is down and all redo logs are filled, the database will hang until archmon is invoked again or the online logs are archived manually.