Flashing Back a Failed Primary Database into a Physical Standby Database(闪回FAILOVER失败的物理备库)
文档操作依据来自官方网址:https://docs.oracle.com/cd/E11882_01/server.112/e41134/scenarios.htm#SBYDB4888
闪回FAILOVER失败的物理备库的前提:
1、物理备库FAILOVER前设置db_recovery_file_dest_size足够大
2、物理备库AILOVER前设置db_recovery_file_dest路径
3、开启物理备库闪回数据库
The following steps assume that a failover has been performed to a physical standby database and that Flashback Database was enabled on the old primary database at the time of the failover. This procedure brings the old primary database back into the Data Guard configuration as a physical standby database.
查看主备库状态:
set lin 200
set pages 50
select inst_id,db_unique_name,database_role,open_mode,protection_mode,protection_level,switchover_status,force_logging,flashback_on from gv$database;
主:

备:

开启主备库闪回:(主库可以不用开启)
需要设置reco
show parameter recov;
alter system set db_recovery_file_dest_size=1g scope=both;
alter system set db_recovery_file_dest='+data' scope=both;
alter database flashback on;
主:


查看主库SCN(可以直接查看备库SCN,不用看主库SCN,如果DG是同步状态):
select current_scn from v$database;

Step 1 Determine the SCN at which the old standby database became the primary database.
On the new primary database, issue the following query to determine the SCN at which the old standby database became the new primary database:
select current_scn from v$database;
查看备库SCN:
SQL> SELECT TO_CHAR(STANDBY_BECAME_PRIMARY_SCN) FROM V$DATABASE;

Step 2 Flash back the failed primary database.
备库failover 之后:

Shut down the old primary database (if necessary), mount it, and flash it back
Shut down the old primary database (if necessary), mount it, and flash it back to the value for STANDBY_BECAME_PRIMARY_SCN that was determined in Step 1.
SQL> SHUTDOWN IMMEDIATE;

建议只开启节点1,后面转换成备库需要关闭节点2
SQL> STARTUP MOUNT;--只开启节点1,节点2开启了后面也需要shutdown
SQL> FLASHBACK DATABASE TO SCN standby_became_primary_scn;

Step 3 Convert the database to a physical standby database.
Perform the following steps on the old primary database:
- Issue the following statement on the old primary database:
建议只开启节点1,关闭节点2,如果不关闭其他节点,后续报错如后图(step 4)。

SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY; 闪回后,执行如下语句。
This statement will dismount the database after successfully converting the control file to a standby control file.
- Shut down and restart the database:
SQL> SHUTDOWN IMMEDIATE;
SQL> STARTUP MOUNT;
Step 4 Start transporting redo to the new physical standby database.

上图中需要关闭节点2实例,节点1mount 状态,convert成功后,后执行应用日志即可(Step 5 ):
Perform the following steps on the new primary database:
- Issue the following query to see the current state of the archive destinations:
SQL> SELECT DEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION, ERROR,SRL FROM V$ARCHIVE_DEST_STATUS;
- If necessary, enable the destination:
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_n=ENABLE;
- Perform a log switch to ensure the standby database begins receiving redo data from the new primary database, and verify it was sent successfully. Issue the following SQL statements on the new primary database:
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> SELECT DEST_ID, DEST_NAME, STATUS, PROTECTION_MODE, DESTINATION,ERROR,SRL FROM V$ARCHIVE_DEST_STATUS;
On the new standby database, you may also need to change the LOG_ARCHIVE_DEST_n initialization parameters so that redo transport services do not transmit redo data to other databases.
Step 5 Start Redo Apply on the new physical standby database.
Issue the following SQL statement on the new physical standby database:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;
Redo Apply automatically stops each time it encounters a redo record that is generated as the result of a role transition, so Redo Apply will need to be restarted one or more times until it has applied beyond the SCN at which the new primary database became the primary database. Once the failed primary database is restored and is running in the standby role, you can optionally perform a switchover to transition the databases to their original (pre-failure) roles. See Section 8.2.1, "Performing a Switchover to a Physical Standby Database" for more information.
闪回并转换为物理备库后后应用日志,并做同步测试

闪回后 备库追日志初始化一会儿后:
SQL> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE USING CURRENT LOGFILE DISCONNECT;


附带几句查看主备库状态以及同步语句:
查看主备库状态
set lines 150;
col db_unique_name for a10
select inst_id,db_unique_name,database_role,open_mode,protection_mode,protection_level,switchover_status,force_logging from gv$database;
查看日志序列号:
set lin 200
select thread#,max(sequence#) from v$archived_log group by thread#;
select pid,process,client_process,client_pid,thread#,sequence#,status,DELAY_MINS from v$managed_standby;
查看备库STANDBY REDO LOG状态
set pages 100
set lines 200
select group#,thread#,sequence#,bytes/1024/1024,archived,used,status,first_change#,last_change# from v$standby_log;
Flashing Back a Failed Primary Database into a Physical Standby Database(闪回FAILOVER失败的物理备库)的更多相关文章
- 【原】Configuring Oracle Data Guard In Physical Standby Database
作者:david_zhang@sh [转载时请以超链接形式标明文章] http://www.cnblogs.com/david-zhang-index/p/5042640.html参照文档:https ...
- Physical Standby Database Failover
1.物理standby failover 切换 故障转移时在一些糟糕的事情发生时执行的计划外事件,需要将生产库移动到DR站点.有意思的是,这时候人们通常忙来忙去,试图弄明白发生了什么,需要做些什么才能 ...
- 转 Logs are not shipped to the physical standby database
http://www.oracle-ckpt.com/dataguard_troubleshoot_snapper/ ######sample primay scripts: spool dg_Pri ...
- Oracle_Data_Gard Create a physical standby database
创建之前要对DG的环境有一个总体的规划和了解. 规划 IP 192.168.3.161 192.16 ...
- Oracle Database 12c Using duplicate standby database from active database Created Active DataGuard
primary database db_name=zwc, db_unique_name=zwc standby database db_name=zwc, db_unique_name=standb ...
- Creating a Physical Standby Database 11g
1.Environment Item Primary database standby database Platform Redhat 5.4 Redhat 5.4 Hostname gc1 gc2 ...
- 聊聊Oracle 11g的Snapshot Standby Database(下)
3.Snapshot Standby行为研究 下面我们分析一下Snapshot Standby的工作性质和行为性质.我们在主库方向研究当前状态. --主库日志情况 SQL> select gro ...
- snapshot standby database
快照备库接收和归档主库发送来的redo,但是不会应用:切换成physical standby之后会自动开启redo apply.快照standby不可以参加主备切换:在最大保护性模式下,如果只有一个备 ...
- 使用RMAN DUPLICATE...FROM ACTIVE DATABASE创建物理standby database
Applies to: Oracle Server - Enterprise Edition - Version 11.1.0.6 to 11.2.0.4 [Release 11.1 to 11.2] ...
随机推荐
- 质量管理:PDCA循环
PDCA循环又叫质量环,是管理学中的一个通用模型,最早由休哈特于1930年构想,后来被美国质量管理专家戴明博士在1950年再度挖掘出来,并加以广泛宣传和运用于持续改善产品质量的过程.[1] 中文名 P ...
- $_FILES数组为空的原因
今天做上传的文件时候,打印$_files总是为空,查阅了下资料. 发现是 max_file_uploads=0 知道了原因 file_uploads = On upload_max_filesize ...
- javascript中的内存管理和垃圾回收
前面的话 不管什么程序语言,内存生命周期基本是一致的:首先,分配需要的内存:然后,使用分配到的内存:最后,释放其内存.而对于第三个步骤,何时释放内存及释放哪些变量的内存,则需要使用垃圾回收机制.本文将 ...
- CSS3 2D、3D转换
2D转换方法:transform().rotate().scale().skew().matrix() 3D转换方法:rotateX().rotateY() 1.示例代码 <!DOCTYPE h ...
- 【SHOI2012】魔法树(树链剖分,线段树)
[SHOI2012]魔法树 题面 BZOJ上找不到这道题目 只有洛谷上有.. 所以粘贴洛谷的题面 题解 树链剖分之后直接维护线段树就可以了 树链剖分良心模板题 #include<iostream ...
- 【NOI2002】银河英雄传说(并查集)
[NOI2002]银河英雄传说 题面 题目描述 公元五八○一年,地球居民迁至金牛座α第二行星,在那里发表银河联邦创立宣言,同年改元为宇宙历元年,并开始向银河系深处拓展. 宇宙历七九九年,银河系的两大军 ...
- [BZOJ1024] [SCOI2009] 生日快乐 (搜索)
Description windy的生日到了,为了庆祝生日,他的朋友们帮他买了一个边长分别为 X 和 Y 的矩形蛋糕.现在包括windy,一共有 N 个人来分这块大蛋糕,要求每个人必须获得相同面积的蛋 ...
- 关于设计SQL表的一些问题
1.设计问题: 当sql语句输入时,需要输入表名,表名内需要输入日期,而且譬如"第二天安装"这种,sql语句中有两个地方需要输入日期,一个是昨天,一个是今天,这种情况将输入日期的部 ...
- 浅谈API安全设计
一.简述 安全是恒久的话题,如果不注意防范,会带来很严重的后果.比如: 1.接口被大规模调用消耗系统资源,影响系统的正常访问,甚至系统瘫痪 2.数据泄露 3.伪造(篡改)数据,制造垃圾数据 4.App ...
- createjs绘制扇形的方法
扇形由三段线条组成,两条直线和一条弧线,直线可以用createjs中的lineTo函数画出,弧线用Graphics.arc函数来画. 一.关于createjs中的Graphics.Arc API Gr ...