Home >Database >Oracle >How long will Oracle database logs be kept?

How long will Oracle database logs be kept?

下次还敢
下次还敢Original
2024-05-10 03:27:191071browse

The retention period of Oracle database logs depends on the log type and configuration, including: Redo log: determined by the maximum size configured by the "LOG_ARCHIVE_DEST" parameter. Archived redo logs: Determined by the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Online redo logs: not archived, lost when the database is restarted, and the retention period is consistent with the instance running time. Audit log: Configured by the "AUDIT_TRAIL" parameter, retained for 30 days by default.

How long will Oracle database logs be kept?

Retention period of Oracle database logs

The logs in Oracle database are critical to the recovery and integrity of the database important. Oracle provides several log types, and the specific retention period depends on the log type and configuration.

Redo Log (REDO)

Redo log records committed changes made in the database. In the event of a database failure or instance crash, redo logs are used to restore the database to a consistent state.

By default, the redo log continues to grow until it reaches the maximum size configured by the "LOG_ARCHIVE_DEST" parameter. Once the maximum size is reached, Oracle will begin overwriting old redo logs unless archived redo logs are configured.

Archived redo log (ARCHIVELOG)

Archived redo log is a backup copy of the redo log. When the redo logs reach their maximum size, if archived redo logging is enabled, Oracle will no longer overwrite the old logs but save them to archive files.

The retention period of archived redo logs depends on the maximum size configured by the "DB_RECOVERY_FILE_DEST_SIZE" parameter. Once the maximum size is reached, Oracle begins overwriting old archived redo logs.

ONLINE REDO LOG (ONLINE REDO LOG)

The online redo log is a special type of redo log that is stored in SGA. Unlike regular redo logs, online redo logs are not archived and are lost when the database is restarted.

Online redo logs are key to maintaining high availability, allowing rapid recovery after a database crash. Its retention period generally coincides with the running time of the Oracle instance.

Audit log

The audit log records information about user activity in the database. The retention period of audit logs depends on the "AUDIT_TRAIL" parameter configuration. By default, audit logs are retained in the history table for 30 days.

Therefore, the retention period of Oracle database logs depends on the log type and the following configuration:

  • Redo logs: LOG_ARCHIVE_DEST
  • Archived redo logs: DB_RECOVERY_FILE_DEST_SIZE
  • Online redo log: no configuration
  • Audit log: AUDIT_TRAIL

The above is the detailed content of How long will Oracle database logs be kept?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn