Oracle Physical Dataguard环境使用RMAN备份和恢复

由于Physical Dataguard使用的是块恢复技术来保持和PRIMARY的一致性,因此可以在STANDBY

上进行rman备份,从而减轻PRIMARY的压力.当PRIMARY出现数据库故障时,可以使用在STANDBY上

的备份来进行恢复.

先决条件:需要配置catalog.

在PRIMARY上以catalog方式连接,并且注册数据库

[oracle@PRIMARY admin]$ $ORACLE_HOME/bin/rman target / catalog

> register database;

database registered in recovery catalog

starting full resync of recovery catalog

full resync complete

RMAN> configure db_unique_name CP connect identifier 'cp';

new RMAN configuration parameters:

CONFIGURE DB_UNIQUE_NAME 'cp' CONNECT IDENTIFIER  'cp';

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

RMAN> configure db_unique_name cepstby connect identifier 'cepstby';

new RMAN configuration parameters:

CONFIGURE DB_UNIQUE_NAME 'cepstby' CONNECT IDENTIFIER  'cepstby';

new RMAN configuration parameters are successfully stored

starting full resync of recovery catalog

full resync complete

查看已注册的数据库信息,rman自动识别数据库角色等信息.

RMAN> list db_unique_name of database;

List of Databases

DB Key  DB Name  DB ID            Database Role    Db_unique_name

------- ------- ----------------- ---------------  ------------------

1       CP    2894644313       PRIMARY          CP

1       CP    2894644313       STANDBY          CEPSTBY

rman 连接到STANDBY的target进行备份

[oracle@standby ~]$ $ORACLE_HOME/bin/rman target / catalog

Manager: Release 11.1.0.7.0 - Production on Sat Mar 26 10:52:00 2016

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: CP (DBID=2894644313, not open)

connected to recovery catalog database

在standby上执行备份操作.

RMAN> run

2> {

3> allocate channel c2 device type disk;

4> backup as backupset database format '/home/oracle/%U';

5> release channel c2;

6> }

allocated channel: c2

channel c2: SID=1085 device type=DISK

Starting backup at 26-MAR-16

Starting implicit crosscheck backup at 26-MAR-16

Finished implicit crosscheck backup at 26-MAR-16

.............................

我们通过在主库移动文件来摸拟数据文件被破坏的情形

[oracle@primary]$ mv /u01/app/oracle/oradata/cp/users01.dbf /u01/app/oracle/oradata/cp/oldusers01.dbf

DONGDONGTANG> startup;

ORACLE instance started.

Total System Global Area 1135747072 bytes

Fixed Size      2158992 bytes

Variable Size    822087280 bytes

Database Buffers   301989888 bytes

Redo Buffers      9510912 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/cp/users01.dbf'

接下来我们要做的是从备库上复制相关备份文件到主库中

[oracle@standby ~]$ scp /home/oracle/0* 192.168.56.21:/home/oracle/bak

在主库中对相关文件进行catalog

[oracle@PRIMARY admin]$ $ORACLE_HOME/bin/rman target / catalog

Manager: Release 11.1.0.7.0 - Production on Sat Mar 26 10:56:56 2016

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: CP (DBID=2894644313, not open)

connected to recovery catalog database

RMAN> catalog start with '/home/oracle/bak';

searching for all files that match the pattern /home/oracle/bak

List of Files Unknown to the Database

=====================================

File Name: /home/oracle/bak/09r1eku6_1_1

File Name: /home/oracle/bak/08r1ekse_1_1

Do you really want to catalog the above files (enter YES or NO)? yes

cataloging files...

cataloging done

List of Cataloged Files

=======================

File Name: /home/oracle/bak/09r1eku6_1_1

File Name: /home/oracle/bak/08r1ekse_1_1

现在可以发现4号文件的相关备份信息

RMAN> list backup of datafile 4;

List of Backup Sets

===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time

------- ---- -- ---------- ----------- ------------ ---------------

111     Full    1.08G      DISK        00:00:53     26-MAR-16

BP Key: 176   Status: AVAILABLE  Compressed: NO  Tag: TAG20160326T105302

PRIMARYece Name: /home/oracle/bak/08r1ekse_1_1

List of Datafiles in backup set 111

File LV Type Ckp SCN    Ckp Time  Name

---- -- ---- ---------- --------- ----

4       Full 927757     26-MAR-16 /u01/app/oracle/oradata/cp/users01.dbf

恢复/u01/app/oracle/oradata/cp/users01.dbf文件

RMAN> run

{

allocate channel c1 device type disk;

restore datafile 4;

recover datafile 4;

release channel c1;

}2> 3> 4> 5> 6> 7>

allocated channel: c1

channel c1: SID=1090 device type=DISK

Starting restore at 26-MAR-16

channel c1: starting datafile backup set restore

channel c1: specifying datafile(s) to restore from backup set

channel c1: restoring datafile 00004 to /u01/app/oracle/oradata/cp/users01.dbf

channel c1: reading from backup PRIMARYece /home/oracle/bak/08r1ekse_1_1

channel c1: PRIMARYece handle=/home/oracle/bak/08r1ekse_1_1 tag=TAG20160326T105302

channel c1: restored backup PRIMARYece 1

channel c1: restore complete, elapsed time: 00:00:03

Finished restore at 26-MAR-16

Starting recover at 26-MAR-16

starting media recovery

media recovery complete, elapsed time: 00:00:01

Finished recover at 26-MAR-16

released channel: c1

再次尝试打开数据库.

....................

Variable Size    822087280 bytes

Database Buffers   301989888 bytes

Redo Buffers      9510912 bytes

Database mounted.

ORA-01157: cannot identify/lock data file 4 - see DBWR trace file

ORA-01110: data file 4: '/u01/app/oracle/oradata/cp/users01.dbf'

DONGDONGTANG> alter database open;

Database altered.

DONGDONGTANG> select name,status from v$datafile where file#=4;

NAME

--------------------------------------------------------------------------------

STATUS

-------

/u01/app/oracle/oradata/cp/users01.dbf

ONLINE

主数据库已经可以成功打开.

oracle adg 备份,Oracle Physical Dataguard环境使用RMAN备份和恢复相关推荐

  1. DG环境数据库RMAN备份策略制定

    DG环境数据库RMAN备份策略制定: 主库(Primary) 全库备份 归档备份 删除历史文件夹 备库(Standby) 删除归档 引用说明 主库(Primary) $ crontab -l 0 1 ...

  2. 生产环境提升rman备份速度----启动块跟踪

    生产环境提升rman备份速度----启动块跟踪 [环境] AIX(5300-08).oracle10g(10.2.0.1.0-64bit) [目标] 因为生产环境数据量较大,欲加快rman备份的速度 ...

  3. linux单机到单机adg环境,Oracle 11.2.0.4 DataGuard 环境打PSU,OJVM PSU补丁快速参考

    环境:RHEL6.5 + Oracle 11.2.0.4 DataGuard physical standby 主库和备库都是单节点. 需求:主备库同时应用160719的PSU和OJVM PSU补丁. ...

  4. oracle adg维护,Oracle11gR2 Aactive DataGuard(手动)装配部署及维护文档(三)之升级及rman...

    Oracle11gR2 Aactive DataGuard(手动)安装部署及维护文档(三)之升级及rman l          第六部分: dataguard其它管理问题 一.滚动升级DG 升级概要 ...

  5. oracle改成归档模式_将Oracle数据库改为归档模式并启用Rman备份

    如下Linux环境下对单节点数据库采用文件系统情况的配置归档模式过程. 首先查看数据库归档模式和磁盘使用情况,确定归档文件放到什么位置: [oracle@gisdbserver ~]$ sqlplus ...

  6. 玩转oracle 11g(10):初步了解Rman备份

    备份与恢复的定义及分类 备份的定义及分类: 备份就是把数据库复制到转储设备的过程.其中,转储设备是指用于放置数据库副本的磁带或磁盘.通常也将存放于转储设备中的数据库的副本称为原数据库的备份或转储.备份 ...

  7. Oracle 单实例 迁移到 RAC 实例 -- 使用RMAN 异机恢复

    Oracle 官网有关单实例迁移到RAC的一个步骤说明: How to Convert 10g Single-Instance database to 10g RAC using Manual Con ...

  8. Linux环境下rman备份的实例脚本

    背景:目标数据库192.168.1.172   Redhat Linux AS 3.0   Oracle 9.2.0.6           恢复目录数据库 192.168.1.244   Windo ...

  9. oracle adg 人工干预,Oracle DataGuard

    DataGuard是甲骨文推出的一种高可用性数据库方案,在Oracle 8i之前被称为Standby Database.从Oracle 9i开始,正式更名为Data Guard.它是在主节点与备用节点 ...

最新文章

  1. php在线备忘录,备忘录模式(Memento)
  2. VC中TXT文件的存取
  3. make things simple
  4. python sys.argv[]用法
  5. 【前缀和】【DP】登机(jzoj 5535)
  6. mysql查询报错: ORDER BY clause is not in GROUP BY..this is incompatible with sql_mode=only_full_group_by
  7. MATLAB2016打开mat格式图片
  8. Socket通信学习(一):Socket通信原理
  9. 为什么修改配置文件要重启server
  10. vscode 头文件包含问题_VScode编译C++ 头文件显示not found的问题
  11. Spring Cloud Sleuth服务链路跟踪之入门篇(学习总结)
  12. 关于eclipse反编译插件不起作用问题的解决
  13. 软件测试固态硬盘健康状态良好,HDTune太老鲁大师太傻 用专业软件洞悉固态硬盘健康状态...
  14. 搜狗输入法关闭快捷键
  15. word 输入数学公式(1)
  16. 5、实现登陆功能:如果用户名输入“tom”,密码“123”,提示登陆成功,否则提示输入错误,请重新输入!您还有XX次机会。 三次输入错误后将不可以再输入,并提示对不起,你的账号将被锁定
  17. 解决Ubuntu终端里面显示路径名称太长
  18. gitbook安装中installing gitbook xxx 时间过长的问题
  19. 勿以自己的经历来审视他人
  20. 数据结构:网上公开课

热门文章

  1. 检索COM类工厂中CLSID为{00024500-0000-0000-C000-000000000046}的组件时失败
  2. PyQt5 Python主对话框创建关于对话框源代码
  3. Linux(Ubuntu20.10)安装GIMP
  4. Yolov4训练自己的数据集
  5. ztree 指定节点清空_节点操作
  6. 用统计功能计算机计算js,js实现计算器功能
  7. gradle compile mysql_Gradle配置implementation、api与compile的区别
  8. 防抖 节流_防抖节流与前端性能优化
  9. apmserv 5.2.6 升级php,APMServ5.2.6 升级PHP版本 到高版本 5.3,5.4
  10. 桔子浏览器电脑版不显示图片怎么办 看不到图片怎么解决