本文主要是介绍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 nomount5、恢复备库控制文件
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的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!