在备库上进行热备份--11.2.0.4之后

简介: 一个经典的备份语句:backup database plus archivelog;

一个经典的备份语句:backup database plus archivelog;

完成的4个步骤:

  1. 备份现有的归档日志
  2. 备份数据文件
  3. 归档当前日志
  4. 再次备份归档日志

在备库上执行这条语句在第3步时可能会遇到问题。

用os用户登录rman时,不能滚主库的归档

[oracle@dg121-2 ~]$ rman target /
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Sep 8 19:29:13 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1461820645, not open)
RMAN> 2> 3> 4> 5> 6> 7> 
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=363 device type=SBT_TAPE
channel c1: DBackup3 Oracle MMS Library
Starting backup at Sep 08 2020 19:29:24
RMAN-06820: WARNING: failed to archive current log at primary database
ORACLE error from target database: 
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-00942: table or view does not exist
channel c1: starting archived log backup set

用数据库用户sys或sysbackup登录可以滚主库的归档

[oracle@dg121-2 ~]$ rman target sys/dingjia
Recovery Manager: Release 12.1.0.2.0 - Production on Tue Sep 8 19:31:14 2020
Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1461820645, not open)
RM                                    
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "advise, allocate, alter, analyze, associate statistics, audit, backup, begin, @, call, catalog, change, comment, commit, configure, connect, convert, copy, create, create catalog, create global, create script, create virtual, crosscheck, declare, delete, delete from, describe, describe catalog, disassociate statistics, drop, drop catalog, drop database, duplicate, exit, explain plan, flashback, flashback table, grant, grant catalog, grant register, host, import, insert, list, lock, merge, mount, noaudit, open, print, purge, quit, recover, register, release, rename, repair, replace, report, "
RMAN-01008: the bad identifier was: �
RMAN-01007: at line 1 column 1 file: standard input
RMAN> 
run{
allocate channel c1 type 'sbt_tape' parms='
SBT_LIBRARY=/opt/scutech/dbackup3/lib/libobk.so,
ENV=(URL=http://192.168.87.155:50306/d2/data/0d36020eecec11ea8000b49691622ac4/c7873e9aed0811ea8000b49691622ac4,
EXTRA=X-Access-Key:ea5350ac00fa61d08533a729da808de0)' trace=0;
backup database plus archivelog delete input;
}
RMAN> 2> 3> 4> 5> 6> 7> 
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=363 device type=SBT_TAPE
channel c1: DBackup3 Oracle MMS Library
Starting backup at Sep 08 2020 19:31:31
current log archived at primary database
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=273 RECID=166 STAMP=1050607241
input archived log thread=1 sequence=274 RECID=167 STAMP=1050607891
.....

检查备份集


RMAN> list backup summary;
163     B  A  A SBT_TAPE    Sep 08 2020 19:31:34 1       1       NO         TAG20200908T193133
164     B  F  A SBT_TAPE    Sep 08 2020 19:32:02 1       1       NO         TAG20200908T193135
165     B  F  A SBT_TAPE    Sep 08 2020 19:32:21 1       1       NO         TAG20200908T193135
166     B  F  A SBT_TAPE    Sep 08 2020 19:32:31 1       1       NO         TAG20200908T193135
167     B  F  A SBT_TAPE    Sep 08 2020 19:32:34 1       1       NO         TAG20200908T193135
168     B  A  A SBT_TAPE    Sep 08 2020 19:32:36 1       1       NO         TAG20200908T193236
RMAN>  list backup tag TAG20200908T193236;
List of Backup Sets
===================
BS Key  Size       Device Type Elapsed Time Completion Time     
------- ---------- ----------- ------------ --------------------
168     256.00K    SBT_TAPE    00:00:00     Sep 08 2020 19:32:36
        BP Key: 168   Status: AVAILABLE  Compressed: NO  Tag: TAG20200908T193236
        Handle: 59v9u0ak_1_1   Media: 59v9u0ak_1_1
  List of Archived Logs in backup set 168
  Thrd Seq     Low SCN    Low Time             Next SCN   Next Time
  ---- ------- ---------- -------------------- ---------- ---------
  1    275     10389987   Sep 08 2020 19:31:11 10390124   Sep 08 2020 19:32:14



我们可以看到最后一个备份集是归档日志,这个归档日志的时间范围正好cover整个备份过程,当然我们这个备份的时间跨度不算长,我们有客户100多T的数据库,通过光纤备份要10多个小时,在备份过程中大约会产生1T的数据,这样最后一个归档的备份集就不只包含一个归档日志了。


相关实践学习
日志服务之使用Nginx模式采集日志
本文介绍如何通过日志服务控制台创建Nginx模式的Logtail配置快速采集Nginx日志并进行多维度分析。
相关文章
|
12月前
|
数据库
在备库上进行热备份--10G之前
切换主库日志的脚本 logswitch.sh
|
12月前
|
数据库
在备库上进行冷备份的三个步骤
数据库处于mount状态不一定是一致的,要看mrp进程是否存在!
|
SQL 存储 数据库
在DG环境中,主库丢失归档,对主库进行基于SCN的增量备份来恢复物理DG环境
在DG环境中,主库丢失归档,对主库进行基于SCN的增量备份来恢复物理DG环境
357 0
|
Oracle 关系型数据库
dataguard 增量恢复
dataguard 增量恢复
105 0
dataguard级联备库设置
dataguard级联备库设置
95 0

相关实验场景

更多