目录
一、问题预览
二、问题解答
一、问题预览
大家都知道 Oracle 中 online redolog切换后会生成 archived redolog,心里默认的就是 online redolog 切换后 archived redolog 已经生成。切换示意图,如下图所示。
但事实真的是这样吗?
二、问题解答
参考文档:Managing Archived Redo Logs (oracle.com)
Oracle Database lets you save filled groups of redo log files to one or more offline destinations, known collectively as the archived redo log. The process of turning redo log files into archived redo log files is called archiving. This process is only possible if the database is running in ARCHIVELOG mode. You can choose automatic or manual archiving.
An archived redo log file is a copy of one of the filled members of a redo log group. It includes the redo entries and the unique log sequence number of the identical member of the redo log group. For example, if you are multiplexing your redo log, and if group 1 contains identical member files a_log1 and b_log1, then the archiver process (ARCn) will archive one of these member files. Should a_log1 become corrupted, then ARCn can still archive the identical b_log1. The archived redo log contains a copy of every group created since you enabled archiving.
When the database is running in ARCHIVELOG mode, the log writer process (LGWR) cannot reuse and hence overwrite a redo log group until it has been archived. The background process ARCn automates archiving operations when automatic archiving is enabled. The database starts multiple archiver processes as needed to ensure that the archiving of filled redo logs does not fall behind.
由上可知,oracle中的 archived redolog 文件是由专门的 ARCn 进程负责归档操作。归档操作应该是与 online redolog 的写入是并行的。
Oracle 内部保障未归档的 online redolog 文件是不能被复用的,但没保证 online redolog 切换后一定生成归档日志文件,但上一个切换轮回的 online redolog一定被归档了。
When you run a database in ARCHIVELOG mode, you enable the archiving of the redo log.
The database control file indicates that a group of filled redo log files cannot be reused by LGWR until the group is archived.
A filled group becomes available for archiving immediately after a redo log switch occurs.
online redolog 切换后立即会启动归档进程,一般情况下,online redolog切换了归档日志也会生成的。Oracle 数据库默认启动 4 个 ARCn。这个值是可以动态修改的。