我是靠谱客的博主 烂漫小懒虫,最近开发中收集的这篇文章主要介绍rman备份搭建DataGuard,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

前期参数设置部分忽略,可参考其它文章介绍。
1、从主库创建备库控制文件备份
backup current controlfile for standby format '/home/oracle/standby_controlfile.bak';
2、备份主库
run
{ 
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
allocate channel ch4 type disk;
backup database format '/home/oracle/DB0_%U.bak';
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
3、传输备份集到备库
scp xxxxxx.bak xxxxxx.bak oracle@xxx.xxx.xxx.xxx:/home/oracle/backup/
4、备库启动到umount状态
startup nomount
5、恢复备库控制文件
restore standby controlfile from '/home/oracle/xxxxxx.bak';
6、启动到mount状态
alter database mount;
7、注册备份集到控制文件
catalog start with '/home/oracle/backup/';
8、批量生成set newname语句
select 'set newname for datafile '||file#||' to ''/u01/app/oracle/oradata/orcl/'||substr(name,21,100)||''';' from v$datafile;
select 'set newname for tempfile '||file#||' to ''/u01/app/oracle/oradata/orcl/'||substr(name,21,100)||''';' from v$tempfile;
9、全库恢复
run
{ 
allocate channel ch1 type disk;
allocate channel ch2 type disk;
allocate channel ch3 type disk;
allocate channel ch4 type disk;
set newname for datafile 1 to '/u01/app/oracle/oradata/orclstd/system01.dbf';
set newname for datafile 2 to '/u01/app/oracle/oradata/orclstd/sysaux01.dbf';
set newname for datafile 3 to '/u01/app/oracle/oradata/orclstd/undotbs01.dbf';
set newname for datafile 4 to '/u01/app/oracle/oradata/orclstd/user01.dbf';
set newname for datafile 5 to '/u01/app/oracle/oradata/orclstd/test.dbf';
set newname for datafile 6 to '/u01/app/oracle/oradata/orclstd/testdg.dbf';
set newname for datafile 7 to '/u01/app/oracle/oradata/orclstd/testdg01.dbf';
set newname for datafile 8 to '/u01/app/oracle/oradata/orclstd/test02.dbf';
set newname for datafile 9 to '/u01/app/oracle/oradata/orclstd/testdg03.dbf';
restore database;
switch datafile all;
release channel ch1;
release channel ch2;
release channel ch3;
release channel ch4;
}
10、追加归档
recover database;
11、启用实时应用
alter database recover managed standby database using current logfile disconnect from session;
12、关闭实时应用
alter database recover managed standby database cancel;
13、打开数据库
alter database open;
14、开启实时应用
alter database recover managed standby database using current logfile disconnect from session;
15、测试是否同步
————————————————
版权声明:本文为CSDN博主「Mr.Lpp」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/u012232730/article/details/86229003

 

最后

以上就是烂漫小懒虫为你收集整理的rman备份搭建DataGuard的全部内容,希望文章能够帮你解决rman备份搭建DataGuard所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(41)

评论列表共有 0 条评论

立即
投稿
返回
顶部