暂无图片
暂无图片
1
暂无图片
暂无图片
暂无图片

oracle 11g adg 通过scn做增量备份追加

原创 四九年入国军 2024-09-10
179


主要步骤描述:
a.在主库上创建一个备库的控制文件 

b.以备库的当前SCN号为起点,在主库上做一个增量备份 

c.将增量备份拷贝到备库上 

d.使用新的控制文件将备库启动到mount状态 

e.将增量备份注册到RMAN的catalog,取消备库的恢复应用,恢复增量备份 

f.开启备库的恢复进程




--备库查询当前 scn 号

col checkpoint_change# for 99999999999999

select distinct checkpoint_change# from v$datafile_header;
select distinct checkpoint_change# from v$datafile;


查看数据文件的scn最准确,后面已这个为起点做增量恢复


TO_CHAR(CURRENT_SCN)
--------------------------------------------------------------------------------
1030626

--确认主备GAP期间是否新增数据文件:
sqlplus / as sysdba
select file# from v$datafile where creation_change# > =1030626;


--主库根据备库scn号进行增量备份:

rman target /
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup as compressed backupset  INCREMENTAL from scn 1084157 database format '/backup/incre_%U';
release channel c1;
release channel c2;
}



注意: 如果存在新增数据文件,备库恢复时会自动restore新添加的数据文件。

--主库做个standby  controlfile 随之前的增量传过去
sqlplus / as sysdba
alter database create standby controlfile as '/backup/standby116.ctl';


备库关闭数据库实例,开启至nomount状态:
shutdown immediate
startup nomount


备库恢复新的控制文件:


rman target /
restore controlfile from '/backup/standby116.ctl';

备库开启到mount状态:
sql 'alter database mount';




--备库rman注册增量备份文件:
rman target /
catalog start with '/backup/';

--备库开启恢复增量备份:
1、如果没新增文件执行:
recover database noredo;

2、如果有新增文件会报错:

recover database noredo;
Starting recover at 2022-04-04 14:33:29
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=132 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 04/04/2022 14:33:29
RMAN-06094: datafile 10 must be restored

先restore再recover:
restore datafile 10;
recover database noredo;

--主库的log_archive_dest_state_2记得是enable的
 alter  system set log_archive_dest_state_2=enable scope=both sid='*';
 

--开启备库的恢复进程
sqlplus / as sysdba
alter database open read only;
ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT FROM SESSION;
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论