10G/11G/12cr1版本中backup archivelog命令是否会触发归档current logfile操作

被同事指出备份脚本中缺少手动切换日志的命令,事实上在10G及以上版本已经不需要此在脚本中加上此语句。主要通过查阅官方文档及实验,验证10G/11G/12cr1版本中backup archivelog命令是否会触发归档current logfile操作。

结果如下;
如果数据库在OPEN状态,运行BACKUP ARCHIVELOG命令时,如果不使用UNTIL/SEQUENCE关键字,会自动执行日志切换命令。

参考官方文档中描述:http://docs.oracle.com/cd/E11882_01/backup.112/e10643/rcmsynta007.htm#CHDCFGEI
http://docs.oracle.com/database/121/RCMRF/rcmsynta006.htm


If the database is open when you run BACKUP ARCHIVELOG, and if the UNTIL clause or SEQUENCE parameter is not specified, then RMAN runs ALTER SYSTEM ARCHIVE LOG CURRENT.  ---这一句,如果数据库在OPEN状态,运行BACKUP ARCHIVELOG命令时,如果不使用UNTIL/SEQUENCE关键字,会执行日志切换命令。

Note: If you run BACKUP ARCHIVELOG ALL, or if the specified log range includes logs from prior incarnations, then RMAN backs up logs from prior incarnations to ensure availability of all logs that may be required for recovery through an OPEN RESETLOGS.
----------------------------------

以下以11.2.0.4版本验证:
开始备份操作:
[oracle@bys1 ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Sat Jan 21 18:04:53 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: BYS1 (DBID=4052277609)

RMAN> backup archivelog from time 'sysdate-1' format '/home/orcale/arch_%d_%t_%s.bak';

Starting backup at 2017/01/21 18:04:55   ------------>备份命令开始时间,与ALERT日志中可以对应。
current log archived    ------------>这句输出可以发现是做了current redolog的归档;
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=58 device type=DISK


观察ALERT日志:
Sat Jan 21 18:02:20 2017
ALTER SYSTEM ARCHIVE LOG
Sat Jan 21 18:02:20 2017
Thread 1 advanced to log sequence 99 (LGWR switch)
  Current log# 3 seq# 99 mem# 0: /u01/app/oradata/bys1/redo03.log
Sat Jan 21 18:02:20 2017
Archived Log entry 131 added for thread 1 sequence 98 ID 0xf1898b69 dest 1:
Sat Jan 21 18:04:55 2017     ------------>ALTER SYSTEM ARCHIVE LOG命令执行时间,与备份时输出可以对应。
ALTER SYSTEM ARCHIVE LOG
Sat Jan 21 18:04:55 2017
Thread 1 advanced to log sequence 100 (LGWR switch)
  Current log# 1 seq# 100 mem# 0: /u01/app/oradata/bys1/redo01.log
Sat Jan 21 18:04:56 2017
Archived Log entry 132 added for thread 1 sequence 99 ID 0xf1898b69 dest 1:


10G/11G/12cr1版本中backup archivelog命令是否会触发归档current logfile操作_第1张图片


---------------------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

你可能感兴趣的:(ORACLE,RMAN备份与恢复)