Oracle 视图 DBA_HIST_LOG 官方解释,作用,如何使用详细说明

本站中文解释

_FILES

Oracle中的视图DBA_HIST_LOG_FILES用于查看当前数据库中所有可用的日志文件大小(MB)及块大小(Bytes)。它是一个管理视图,提供了一个有效的方法来评估某台数据库所需日志空间大小,从而可以更好的预防数据库满日志文件的风险。

要使用DBA_HIST_LOG_FILES视图,首先要确定本地数据库的内部身份、标识符和路径,通过以下语句来查看:

SELECT MEMBER, THREAD#, LOG#, RESET#, RESETLOGS_TIME, BYTES
FROM DBA_HIST_LOG_FILES;

这条语句会返回当前数据库中所有归档日志文件的块大小(BYTES字段)、内部身份(MEMBER字段)、进程号(THREAD#字段)、日志号(LOG#字段)以及日志重建时间(RESETLOGS_TIME字段)。如果要查询当前数据库的每个日志文件的大小(MB),可以将返回的BYTES字段除以1024 * 1024:

SELECT MEMBER LOG_SIZE_MB
FROM DBA_HIST_LOG_FILES
WHERE BYTES/(1024*1024)>0;

使用DBA_HIST_LOG_FILES视图可以帮助DBA更好的估算所需的日志文件空间,从而降低满日志文件或错误回滚的风险。

官方英文解释

DBA_HIST_LOG displays historical log file information from the control file. This view contains snapshots of V$LOG.

Column Datatype NULL Description

SNAP_ID

NUMBER

NOT NULL

Unique snapshot ID

DBID

NUMBER

NOT NULL

Database ID for the snapshot

INSTANCE_NUMBER

NUMBER

NOT NULL

Instance number for the snapshot

GROUP#

NUMBER

NOT NULL

Log group number

THREAD#

NUMBER

NOT NULL

Log thread number

SEQUENCE#

NUMBER

NOT NULL

Log sequence number

BYTES

NUMBER

Size of the log (in bytes)

MEMBERS

NUMBER

Number of members in the log group

ARCHIVED

VARCHAR2(3)

Archive status (YES) or NO)

STATUS

VARCHAR2(16)

Log status:

  • UNUSED – Online redo log has never been written to. This is the state of a redo log that was just added, or just after a RESETLOGS, when it is not the current redo log.

  • CURRENT – Current redo log. This implies that the redo log is active. The redo log could be open or closed.

  • ACTIVE – Log is active but is not the current log. It is needed for crash recovery. It may be in use for block recovery. It may or may not be archived.

  • CLEARING – Log is being re-created as an empty log after an ALTER DATABASE CLEAR LOGFILE statement. After the log is cleared, the status changes to UNUSED.

  • CLEARING_CURRENT – Current log is being cleared of a closed thread. The log can stay in this status if there is some failure in the switch such as an I/O error writing the new log header.

  • INACTIVE – Log is no longer needed for instance recovery. It may be in use for media recovery. It may or may not be archived.

  • INVALIDATED – Archived the current redo log without a log switch.

FIRST_CHANGE#

NUMBER

Lowest system change number (SCN) in the log

FIRST_TIME

DATE

Time of the first SCN in the log

CON_DBID

NUMBER

The database ID of the PDB for the sampled session

CON_ID

NUMBER

The ID of the container that CON_DBID identifies. Possible values include:

  • 0: This value is used for rows containing data that pertain to the entire CDB. This value is also used for rows in non-CDBs.

  • 1: This value is used for rows containing data that pertain to only the root

  • n: Where n is the applicable container ID for the rows containing data

See Also:

“V$LOG”


数据运维技术 » Oracle 视图 DBA_HIST_LOG 官方解释,作用,如何使用详细说明