被同事指出备份脚本中缺少手动切换日志的命令,事实上在10G及以上版本已经不需要此在脚本中加上此语句。主要通过查阅官方文档及实验,验证10G/11G/12cr1版本中backup archivelog命令是否会触发归档current logfile操作。
结果如下;---------------------11GR2 RAC环境的验证--在任意节点上执行两个节点都进行切换
RAC节点1执行备份backup archivelog操作
[oracle@bys1 ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Tue Feb 7 12:06:02 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: BYSRAC (DBID=2682487210)
RMAN> backup archivelog from time 'sysdate-1/12' format '/home/oracle/arch_%d_%t_%s.bak';
Starting backup at 20170207 12:06:29
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=32 instance=bysrac1 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=49 RECID=79 STAMP=935323590
input archived log thread=2 sequence=34 RECID=80 STAMP=935323591
channel ORA_DISK_1: starting piece 1 at 20170207 12:06:39
channel ORA_DISK_1: finished piece 1 at 20170207 12:06:40
piece handle=/home/oracle/arch_BYSRAC_935323599_3.bak tag=TAG20170207T120639 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20170207 12:06:40
RMAN> backup archivelog from time 'sysdate-1/12' format '/home/oracle/arch_%d_%t_%s.bak';
Starting backup at 20170207 12:08:32
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=49 RECID=79 STAMP=935323590
input archived log thread=2 sequence=34 RECID=80 STAMP=935323591
input archived log thread=1 sequence=50 RECID=81 STAMP=935323713
input archived log thread=2 sequence=35 RECID=82 STAMP=935323713
channel ORA_DISK_1: starting piece 1 at 20170207 12:08:36
channel ORA_DISK_1: finished piece 1 at 20170207 12:08:37
piece handle=/home/oracle/arch_BYSRAC_935323716_4.bak tag=TAG20170207T120835 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20170207 12:08:37
观察两个节点的ALERT日志:
节点1
Tue Feb 07 12:06:29 2017
ALTER SYSTEM ARCHIVE LOG
Tue Feb 07 12:06:30 2017
Thread 1 advanced to log sequence 50 (LGWR switch)
Current log# 2 seq# 50 mem# 0: +DATA/bysrac/onlinelog/group_2.258.927541487
Current log# 2 seq# 50 mem# 1: +DATA/bysrac/onlinelog/group_2.257.927541487
Tue Feb 07 12:06:30 2017
Archived Log entry 79 added for thread 1 sequence 49 ID 0x9fe402a6 dest 1:
Tue Feb 07 12:08:32 2017
ALTER SYSTEM ARCHIVE LOG
Tue Feb 07 12:08:33 2017
Thread 1 advanced to log sequence 51 (LGWR switch)
Current log# 1 seq# 51 mem# 0: +DATA/bysrac/onlinelog/group_1.267.927541485
Current log# 1 seq# 51 mem# 1: +DATA/bysrac/onlinelog/group_1.259.927541485
Tue Feb 07 12:08:33 2017
Archived Log entry 81 added for thread 1 sequence 50 ID 0x9fe402a6 dest 1:
节点2
Tue Feb 07 12:06:30 2017
Thread 2 advanced to log sequence 35 (LGWR switch)
Current log# 3 seq# 35 mem# 0: +DATA/bysrac/onlinelog/group_3.261.927541697
Current log# 3 seq# 35 mem# 1: +DATA/bysrac/onlinelog/group_3.269.927541699
Tue Feb 07 12:06:31 2017
Archived Log entry 80 added for thread 2 sequence 34 ID 0x9fe402a6 dest 1:
Tue Feb 07 12:08:33 2017
Thread 2 advanced to log sequence 36 (LGWR switch)
Current log# 4 seq# 36 mem# 0: +DATA/bysrac/onlinelog/group_4.270.927541701
Current log# 4 seq# 36 mem# 1: +DATA/bysrac/onlinelog/group_4.271.927541701
Tue Feb 07 12:08:33 2017
Archived Log entry 82 added for thread 2 sequence 35 ID 0x9fe402a6 dest 1:
查看备份集信息
RMAN> list backup of archivelog all;
List of Backup Sets
===================
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -----------------
3 3.00K DISK 00:00:00 20170207 12:06:39
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20170207T120639
Piece Name: /home/oracle/arch_BYSRAC_935323599_3.bak
List of Archived Logs in backup set 3
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ----------------- ---------- ---------
1 49 2344159 20170207 12:04:32 2344293 20170207 12:06:30
2 34 2344163 20170207 12:04:33 2344297 20170207 12:06:30
BS Key Size Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ -----------------
4 4.50K DISK 00:00:00 20170207 12:08:36
BP Key: 4 Status: AVAILABLE Compressed: NO Tag: TAG20170207T120835
Piece Name: /home/oracle/arch_BYSRAC_935323716_4.bak
List of Archived Logs in backup set 4
Thrd Seq Low SCN Low Time Next SCN Next Time
---- ------- ---------- ----------------- ---------- ---------
1 49 2344159 20170207 12:04:32 2344293 20170207 12:06:30
1 50 2344293 20170207 12:06:30 2344410 20170207 12:08:33
2 34 2344163 20170207 12:04:33 2344297 20170207 12:06:30
2 35 2344297 20170207 12:06:30 2344414 20170207 12:08:33