Just as you must specify a location for archived log files, you must also specify a "naming convention". The
log_archive_format
initialization parameter is used to do that. The four special character sequences listed here may be used as part of the filename:
%s |
The log sequence number. This continually increments as redo log files are produced. |
%t |
The log thread number, which uniquely identifies the instance producing the log file. This is necessary when the Parallel Server option is being used because the sequence numbers used by multiple instances will overlap. |
%S |
The log sequence number, but as a fixed-width field padded to the left with zeros. |
%T |
The thread number as a fixed-width field padded to the left with zeros. |
The following diagram illustrates a couple of typical settings and shows how the resulting filenames will look:
log_archive_format | The initialization parameter that specifies the format of archived log filenames. |
log_ | Archived log filenames will start with these characters. |
%s | Places the log sequence number into the name. |
%t | Places the thread number into the name. |
The numbers 387-389 | The log sequence number as it will appear in the actual filename. |
The three "1"s | The thread number as it will appear in the actual filename. |
%T | The thread number in a fixed-width format. |
%S | The log sequence number in a fixed-width format. |
The three 001s | The thread number appears as 001. |
00387 - 00389 | The log sequence numbers also appear with leading zeros. |
In Oracle 19c, the naming convention for archived log files is controlled by the `LOG_ARCHIVE_FORMAT` parameter. This parameter specifies the format of the archived redo log filenames.
Default Naming Convention
The default naming pattern for archived log files is:
log_archive_format = 'ARC%S_%R.%T'
Where:
%S
- Log sequence number (zero-filled)
%R
- Resetlogs ID (ensures uniqueness after database resets)
%T
- Thread number
Example File Name:
For a database with sequence number 1234, resetlogs ID 987654321, and thread 1, the archived log filename would be:
ARC01234_987654321.001
Customization:
You can modify `LOG_ARCHIVE_FORMAT` to suit your requirements. A common format is:
log_archive_format = 'arch_%t_%s_%r.log'
Where:
%t
- Thread number
%s
- Log sequence number
%r
- Resetlogs ID
Example:
arch_1_1234_987654321.log
### Setting the Parameter:
Modify `LOG_ARCHIVE_FORMAT` in `sqlplus`:
ALTER SYSTEM SET log_archive_format = 'arch_%t_%s_%r.log' SCOPE=SPFILE;
Then, restart the database for changes to take effect:
SHUTDOWN IMMEDIATE;
STARTUP;
Additional Considerations:
- The archive log destination is defined by
LOG_ARCHIVE_DEST_n
parameters.
- Ensure that the format includes a unique component (e.g.,
%r
for Resetlogs ID) to prevent overwriting files after a database reset.