问题描述:rac dg节点2在修改完alert_oracle_sid.log文件名,主库切换日志后备库节点2不产生新的日志文件.标签:主库,备库,log,alert,oracle,日志,节点 From: https://blog.51cto.com/u_12991611/5897258
主库:主机名hisdb1&hisdb2 + oracle 11.2.0.4 rac
备库:主机名hisdb3&hisdb4 + oracle 11.2.0.4 rac dg
1、问题重现
--备库节点2修改日志文件名.
[oracle@hisdb4 trace]$ ll |grep alert
-rw-r----- 1 oracle asmadmin 47473 Nov 28 13:39 alert_healdg2.log
[oracle@hisdb4 trace]$ mv alert_healdg2.log alert_healdg2.log20221128
--主库节点1切换日志.
SQL> alter system switch logfile;
System altered.
--备库节点2查看alert文件
[oracle@hisdb4 trace]$ ll |grep alert
-rw-r----- 1 oracle asmadmin 47473 Nov 28 13:39 alert_healdg2.log20221128
[oracle@hisdb4 trace]$ mv alert_healdg2.log20221128 alert_healdg2.log
说明:可以看到备库节点2并未产生新的日志文件.
--在来验证备库节点1的情况.
[oracle@hisdb3 trace]$ ll |grep alert
-rw-r----- 1 oracle oinstall 184984 Nov 28 13:50 alert_healdg1.log
[oracle@hisdb3 trace]$ mv alert_healdg1.log alert_healdg1.log20221128
--主库节点1切换日志.
[oracle@hisdb1 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 28 21:59:23 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> alter system switch logfile;
System altered.
--备库节点1确认日志文件.
[oracle@hisdb3 trace]$ ll |grep alert
-rw-r----- 1 oracle asmadmin 472 Nov 28 21:58 alert_healdg1.log
-rw-r----- 1 oracle oinstall 184984 Nov 28 13:50 alert_healdg1.log20221128
说明:可以看到备库节点1在主库切换日志后,有新的日志文件产生.
2、mrp进程
值得注意的是mrp进程,查备库节点2该进程情况.
[oracle@hisdb4 trace]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Nov 28 21:50:45 2022
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
说明:在备库节点2上并未找到mrp进程.
--查备库节点1该进程情况.
SQL> select process,status from v$managed_standby
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
ARCH CLOSING
ARCH CLOSING
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
MRP0 APPLYING_LOG
11 rows selected.
说明:在备库节点1上可以看到该进程.
--查数据库状态.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
说明:虽然mrp进程只在备库节点1存在,但两个rac备库状态均在实时应用状态中.
3、验证转移mrp
经确认,当备库为rac环境时,mrp进程只能在一个节点上运行.测试环境中该进程在备库节点1上,所以该节点会产生新的日志文件.验证若将该进程转移到备库节点2,确认该节点是否会产生新的日志文件.
--备库节点1停止实时应用.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CLOSING
ARCH CONNECTED
ARCH CLOSING
ARCH CLOSING
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
RFS IDLE
10 rows selected.
--备库节点2开启实时应用.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
SQL> select process,status from v$managed_standby;
PROCESS STATUS
--------- ------------
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
ARCH CONNECTED
MRP0 APPLYING_LOG
--备库节点2修改日志文件名.
[oracle@hisdb4 trace]$ ll |grep alert
-rw-r----- 1 oracle asmadmin 50012 Nov 28 22:03 alert_healdg2.log
[oracle@hisdb4 trace]$ mv alert_healdg2.log alert_healdg2.log20221128
--主库节点1切换日志.
SQL> alter system switch logfile;
System altered.
--备库节点2查看alert文件
[oracle@hisdb4 trace]$ ll |grep alert
-rw-r----- 1 oracle asmadmin 265 Nov 28 22:04 alert_healdg2.log
-rw-r----- 1 oracle asmadmin 50012 Nov 28 22:03 alert_healdg2.log20221128
结论:如上所示,当mrp进程转移到备库节点2时,该节点会产生新的日志文件.