Oracle11gr2_ADG管理之在备库上模拟failover的过程实战
技术建议和方案。
要求failover后不重建备库,并能够把failover的数据库重新切换回备库
主库为newtest,备库为snewtest
备库上已经开启了闪回
得到一个参考的SCN
SQL> select current_scn from v$database;
CURRENT_SCN
-----------
4491930
查看闪回数据库特性是打开的。
SQL> select flashback_on from v$database;
FLASHBACK_ON
------------------------------------
YES
然后我们在备库上开始failover
DGMGRL> failover to snewtest;
Performing failover NOW, please wait...
Failover succeeded, new primary is "snewtest"
操作很快完成,我们查看备库此时的状态和角色
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
当然这个步骤可以做一些读写操作之类的.
然后我们开始计划切回备库。
SQL> shutdown immediate
SQL> startup mount
闪回数据库到指定的SCN,
SQL> flashback database to scn 4491930;
Flashback complete.
切换这个新主库为备库
SQL> alter database convert to physical standby;
Database altered.
需要重启备库
SQL> shutdown immediate
SQL> startup mount
最关键的步骤,重新配置DG Broker
主库上删除DG Broker配置
SQL> alter system set dg_broker_start = false;
System altered.
SQL> !ps -ef |grep dmon
oracle 24648 24644 0 00:13 pts/3 00:00:00 /bin/bash -c ps -ef |grep dmon
oracle 24650 24648 0 00:13 pts/3 00:00:00 grep dmon
[oracle@localhost ~]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ll
total 10048
-rw-r-----. 1 oracle dba 8192 Mar 30 00:07 dr1newtest.dat
-rw-r-----. 1 oracle dba 8192 Mar 30 00:07 dr2newtest.dat
-rw-rw----. 1 oracle dba 1544 Mar 12 00:02 hc_DBUA1321268.dat
-rw-rw----. 1 oracle dba 1544 Mar 27 21:10 hc_newtest.dat
-rw-r--r--. 1 oracle dba 982 Mar 21 23:12 initnewtest.ora
-rw-r--r--. 1 oracle dba 2851 May 15 2009 init.ora
-rw-r-----. 1 oracle dba 24 Jan 31 20:16 lkNEWTEST
-rw-r-----. 1 oracle dba 1536 Jan 31 20:18 orapwnewtest
-rw-r-----. 1 oracle dba 10240000 Mar 27 23:53 snapcf_newtest.f
-rw-r-----. 1 oracle dba 3584 Mar 30 00:12 spfilenewtest.ora
[oracle@localhost dbs]$ rm -rf dr*newtest.dat
[oracle@localhost dbs]$ ll
total 10032
-rw-rw----. 1 oracle dba 1544 Mar 12 00:02 hc_DBUA1321268.dat
-rw-rw----. 1 oracle dba 1544 Mar 27 21:10 hc_newtest.dat
-rw-r--r--. 1 oracle dba 982 Mar 21 23:12 initnewtest.ora
-rw-r--r--. 1 oracle dba 2851 May 15 2009 init.ora
-rw-r-----. 1 oracle dba 24 Jan 31 20:16 lkNEWTEST
-rw-r-----. 1 oracle dba 1536 Jan 31 20:18 orapwnewtest
-rw-r-----. 1 oracle dba 10240000 Mar 27 23:53 snapcf_newtest.f
-rw-r-----. 1 oracle dba 3584 Mar 30 00:12 spfilenewtest.ora
备库上删除DG Broker配置
SQL> alter system set dg_broker_start = false;
System altered.
SQL> !ps -ef |grep dmon
oracle 15200 15198 0 00:15 pts/2 00:00:00 /bin/bash -c ps -ef |grep dmon
oracle 15202 15200 0 00:15 pts/2 00:00:00 grep dmon
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost backup_stage]$ cd $ORACLE_HOME/dbs
[oracle@localhost dbs]$ ll
total 10064
-rw-r-----. 1 oracle dba 20480 Mar 30 00:13 dr1snewtest.dat
-rw-r-----. 1 oracle dba 20480 Mar 30 00:08 dr2snewtest.dat
-rw-rw----. 1 oracle dba 1544 Mar 30 00:12 hc_newtest.dat
-rw-r--r--. 1 oracle dba 1062 Mar 21 23:30 initnewtest.ora
-rw-r-----. 1 oracle dba 24 Mar 21 23:38 lkSNEWTEST
-rw-r-----. 1 oracle dba 1536 Mar 27 23:34 orapwnewtest
-rw-r-----. 1 oracle dba 10240000 Mar 29 06:45 snapcf_newtest.f
-rw-r-----. 1 oracle dba 4608 Mar 30 00:15 spfilenewtest.ora
[oracle@localhost dbs]$ rm -rf dr*snewtest.dat
[oracle@localhost dbs]$ ll
total 10024
-rw-rw----. 1 oracle dba 1544 Mar 30 00:12 hc_newtest.dat
-rw-r--r--. 1 oracle dba 1062 Mar 21 23:30 initnewtest.ora
-rw-r-----. 1 oracle dba 24 Mar 21 23:38 lkSNEWTEST
-rw-r-----. 1 oracle dba 1536 Mar 27 23:34 orapwnewtest
-rw-r-----. 1 oracle dba 10240000 Mar 29 06:45 snapcf_newtest.f
-rw-r-----. 1 oracle dba 4608 Mar 30 00:15 spfilenewtest.ora
主库上重新配置 DG Broker
SQL> alter system set dg_broker_start =true;
System altered.
[oracle@localhost dbs]$ dgmgrl /
DGMGRL for Linux: Version 11.2.0.4.0 - 64bit Production
Copyright (c) 2000, 2009, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.
Connected.
DGMGRL> create configuration dg_newtest as primary database is newtest connect identifier is newtest;
Configuration "dg_newtest" created with primary database "newtest"
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
DISABLED
DGMGRL> enable configuration ;
Enabled.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
DGMGRL> add database snewtest as connect identifier is snewtest maintained as physical;
Database "snewtest" added
DGMGRL> enable database snewtest;
Enabled.
DGMGRL> show configuration;
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
snewtest - Physical standby database
Error: ORA-16525: the Data Guard broker is not yet available
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
此时提示备库的 Data Guard broker不可用
配置备库的DG Broker
SQL> alter system set dg_broker_start = true;
System altered.
在主库上再次查看dg broke 的状态
DGMGRL> show configuration
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
snewtest - Physical standby database
Error: ORA-16613: initialization in progress for database
Fast-Start Failover: DISABLED
Configuration Status:
ERROR
此时是初始化状态
open 备库
SQL> alter database open;
Database altered.
在主库上再次查看dg broke 的状态
DGMGRL> show configuration
Configuration - dg_newtest
Protection Mode: MaxPerformance
Databases:
newtest - Primary database
snewtest - Physical standby database
Fast-Start Failover: DISABLED
Configuration Status:
SUCCESS
查看备库的状态
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ ONLY WITH APPLY PHYSICAL STANDBY
Oracle11gr2_ADG管理之在备库上模拟failover的过程实战的更多相关文章
- Oracle 19c Data Guard DML Redirection ADG备库上执行DML重定向(未来更好的进行读写分离)
资料来自官方网站: https://docs.oracle.com/en/database/oracle/oracle-database/19/sbydb/managing-oracle-data-g ...
- oracle 利用flashback将备库激活为read wirte(10g 及上)
oracle 利用flashback将备库激活为read wirte(10g 及上) 环境: OS: CENTOS 6.5 X64 DB: ORACLE 10.2.0.5 主库操作: SQL> ...
- Oracle11gr2_ADG管理之switchover补充
之前演示的switchver总是提示下面的错误,并且需要人工干预: Oracle11gr2_ADG管理之switchover实战 DGMGRL> switchover to snewtest; ...
- 【转载】mysql主键的缺少导致备库hang
最近线上频繁的出现slave延时的情况,经排查发现为用户在删除数据的时候,由于表主键的主键的缺少,同时删除条件没有索引,或或者删除的条件过滤性极差,导致slave出现hang住,严重的影响了生产环境的 ...
- mysql主键的缺少导致备库hang
最近线上频繁的出现slave延时的情况,经排查发现为用户在删除数据的时候,由于表主键的主键的缺少,同时删除条件没有索引,或或者删除的条件过滤性极差,导致slave出现hang住,严重的影响了生产环境的 ...
- 备份一篇SVN的文章, 从搭建到主备库
来源: http://h2ofly.blog.51cto.com/6834926/1539141 [svn简介] svn用于版本管理数据,它采用了分支管理系统.在它出现之前存在C ...
- Oracle11gr2_ADG管理之跳归档恢复dg实战
模拟故障 关闭备库 SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut dow ...
- Oracle备库TNS连接失败的分析
今天在测试12c的temp_undo的时候,准备在备库上测试一下,突然发现备库使用TNS连接竟然失败. 抛出的错误如下: $ sqlplus sys/oracle@testdb as sysdba S ...
- ORACLE 11g 用Duplicate恢复Data Guard 备库详细过程
1.先查找备库控制文件路径 先在备库上找出控制文件的路径,通过和主库一样,不过为了以防万一,还是check为好. SQL> select name from v$controlfile; NA ...
随机推荐
- java 输入输出流 关于InputStream 和 OutputSteam 实现文本一行一行读入和 文本一行一行输出
对 byte 有了新的认知:byte表示一个字节 因此他可以表示成 一个 数字: 一个数字可以映射成一个字符:InputStream 中的 read() 函数 的意思是读入一个整数,读入一个整数的 ...
- window.inner 兼容IE8
window.getHeight = function() { if (window.innerHeight != undefined) { return window.inn ...
- BZOJ1101 POI2007 Zap 【莫比乌斯反演】
BZOJ1101 POI2007 Zap Description FGD正在破解一段密码,他需要回答很多类似的问题:对于给定的整数a,b和d,有多少正整数对x,y,满足x<=a,y<=b, ...
- Python 实现汉诺塔问题(递归)
有三根柱子一次为A,B,C 现在A柱子上有3个块,按照汉诺塔规则移动到C柱子上去,打印步骤? 我们这样理解:A为原始柱,C为目标柱,B为缓冲柱 1.定义一个函数move(n,a,b,c),n为原始柱上 ...
- istio 安装试用
1. 命令行工具 curl -L https://git.io/getIstio | sh - 2. 环境变量配置 export PATH=$PWD/bin:$PATH 3. RBAC 检验 kube ...
- Google服务,你都用了多少?
今天无意中发现这些东西,Google提供的服务还真是多,大家经常用到的不知道有哪些呢?就我个人而言,经常用到的就是Google搜索,Gmail邮箱,还有Google论坛了. Google Ad Sen ...
- keil 赋值之后再声明变量提示错误error: #268: declaration may not appear after executable statement in block
勾选 C99 Mode 即可 假如没有C99 Mode的选项,那么我们可以用大括号将代码括起来,这样编译也不会报错 if( (! bMemAddrAllowAccess(checkAddr) )) { ...
- VB.NET实现32位、64位远线程运行ASM,注入非托管、托管DLL
这是一个老话题,远线程函数给我们提供了机会在其他进程中启动一个新线程,所以我们可以做很多事情.但事情远远没有结束,如果我们要做的事情非常复杂,那么将面临编写大量的ASM代码,虽然我们可以用VC之类的工 ...
- Jquery each循环中中断
在each代码块内不能使用break和continue,要实现break和continue的功能的话,要使用其它的方式 break----用return false; continue --用retu ...
- angula的factory service provider
本人学了一段时间的angular的服务(factory.service.provider),有了自己的一些对于他们的见解,如果说的对,敬请赐教!!! 以后更新