ITPub博客

首页 > 数据库 > Oracle > 使用RMAN backup和restore方式部署物理备库

使用RMAN backup和restore方式部署物理备库

原创 Oracle 作者:db_wjw 时间:2016-06-14 19:22:23 0 删除 编辑
本文档不包含以下内容:
主数据库配置、参数、创建相关目录、监听器配置、tnsnames.ora配置、密码文件配置等,只列出主要步骤

一、主:

创建/u01/oracle_backup目录:
备份参数文件:
SQL> create pfile='/u01/oracle_backup/initlis.ora' from spfile;
备份数据:
rman target /
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
backup as compressed backupset format '/u02/orabackup/level0/ncf_db%U' database plus archivelog;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}
备份控制文件:
run{
allocate channel c1 type disk;
backup format '/u02/orabackup/level0/control%U' current controlfile for standby;
release channel c1;
}



二、拷贝备份文件到备库主机,也就是/u01/oracle_backup


三、备:

按需修改目标端参数文件

rman target /
RMAN> startup nomount;
RMAN> restore standby controlfile from '/u01/oracle_backup/control1bqgo42a_1_1';
RMAN> sql 'alter database mount standby database';
restore数据库
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate channel c5 type disk;
restore database;
release channel c1;
release channel c2;
release channel c3;
release channel c4;
release channel c5;
}

recover数据库
RMAN> list backup of archivelog all;
找到要恢复到的最大序列号,比如有36的话,那就应该until 37
RMAN> recover database until sequence 37;
RMAN> exit

sqlplus / as sysdba;
SQL> alter database recover managed standby database using current logfile disconnect;
SQL> alter database recover managed standby database cancel;
SQL> alter database open;
SQL> alter database recover managed standby database using current logfile disconnect;


在主库上多切换几次日志,使用以下命令检查备库状态:
select process,status from v$managed_standby;


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/26194851/viewspace-2120137/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2011-08-21

  • 博文量
    96
  • 访问量
    452073