The process of turning redo log files into archived redo log files is called archiving. It is only possible if the database is running in ARCHIVELOG
mode. Here are some advantages to be in ARCHIVELOG
mode:
- Recover a database
- Update a standby database
- Perform a hot backup
In this article ...
... Oracle 10g and Oracle 11g are concerned.
... a database SHUTDOWN is required to enable/disable Archive Log.
... SYSTEM privileges is necessary to execute commands. Otherwise, you may get some errors.
Archive log status
Before starting, you should check your db instance archive log status in order to know if your instance already is in archive log mode or not.You have different ways to see that:
As you can see from the result here, the instance is definately not in Archive Log mode.
Enable archive log
Careful ...
... It is recommanded to perform a backup of your instance before doing these changes.
You can let the default parameters to get the archive log works. Otherwise if you want to personalize the archive log parameters, you may want to check how to change the different parameters here first.
We will now enable the archive log for the instance as following:
Let's check the archive log mode information again:
Here we go, we are in archive log mode now!
Do you know?
Before Oracle 10g, the following commands should be executed in order to automaticaly enable automatic archiving :
ALTER SYSTEM ARCHIVE LOG START ;
ALTER SYSTEM SET LOG_ARCHIVE_START=TRUE SCOPE=SPFILE ;
This is now deprecated on Oracle 10g and onward.
Disable archive log
In case of, you really need to turn off Archive Log for any reasons:
The instance should now be in NO ARCHIVE LOG mode.
Going futher ...
Archive log parameters
Careful ...
... some parameter changes may require to restart the db instance.
Change archive log destination
By default Archive destination shows USE_DB_RECOVERY_FILE_DEST
, it means archive logs will be written to the flash recovery area path define by RECOVERY_FILE_DEST
parameter. But if LOG_ARCHIVE_DEST_n
is set then it will define the location where the archive logs will be written.
For more information, please check oracle documentation here.
Others useful archive log parameters
Here are some more parameters, you can be interrested in.
LOG_ARCHIVE_FORMAT
specifies the default filename format when archiving redo log files.
- The following variables can be used in the format:
- %s log sequence number
- %S log sequence number, zero filled
- %t thread number
- %T thread number, zero filled
- %a activation ID
- %d database ID
- %r resetlogs ID that ensures unique names are constructed for the archived log files across multiple incarnations of the database
- Example:
LOG_ARCHIVE_MAX_PROCESSES
specifies the maximum number of ARCn processes that can be created.
Enable archive log with manual archiving
It is not recommanded so use it if you really know what you are doing.
Careful ...
If all your online redo logs are filled up, then this mode will hang your database until you manually archive one of them at least.
For more information, please check oracle documentation here.
Some useful queries
Archive log views
Several dynamic performance views contain useful information about archived redo logs, as summarized in the following table.
Dynamic Performance View | Description |
---|---|
V$DATABASE | Shows if the database is in ARCHIVELOG or NOARCHIVELOG mode and if MANUAL (archiving mode) has been specified. |
V$ARCHIVED_LOG | Displays historical archived log information from the control file. If you use a recovery catalog, the RC_ARCHIVED_LOG view contains similar information. |
V$ARCHIVE_DEST | Describes the current instance, all archive destinations, and the current value, mode, and status of these destinations. |
V$ARCHIVE_PROCESSES | Displays information about the state of the various archive processes for an instance. |
V$BACKUP_REDOLOG | Contains information about any backups of archived logs. If you use a recovery catalog, the RC_BACKUP_REDOLOG contains similar information. |
V$LOG | Displays all redo log groups for the database and indicates which need to be archived. |
V$LOG_HISTORY | Contains log history information such as which logs have been archived and the SCN range for each archived log. |
TODO ...
- Check all commands
References ...
Enjoyed this article? Please like it or share it.
Comments
RSS feed for comments to this post