oracle 11g physical standby switchover
来源:互联网 发布:深圳众诚网络 编辑:程序博客网 时间:2024/05/19 14:36
本DG环境采用LGWR SYNC传输模式,使用ACTIVE DATAGUARD应用日志,即备库在OPEN状态下应用日志
1、查询主备库switchover_status
主库
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
RESOLVABLE GAP
备库
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
2、在主库上切换日志,解决日志断档的问题
SQL> alter system switch logfile;System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
3、再查询主备库switchover_status
主库
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
备库
SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
NOT ALLOW
4、将主库切换到备库
SQL> alter database commit to switchover to physical standby with session shutdown;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
Database mounted.
5、查询备库状态
SQL> select open_mode,db_unique_name,switchover_status,database_role from v$database;
OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS DATABASE_ROLE
-------------------- ------------------------------ ------------------------------ ------------------------------
READ ONLY WITH APPLY prim NOT ALLOWED PHYSICAL STANDBY
6、将备库切换到主库
SQL> alter database commit to switchover to primary with session shutdown;
Database altered.
SQL> alter database open;
Database altered.
7、查询主库状态
SQL> select open_mode,db_unique_name,switchover_status,database_role from v$database;OPEN_MODE DB_UNIQUE_NAME SWITCHOVER_STATUS DATABASE_ROLE
-------------------- ------------------------------ ------------------------------ ------------------------------
READ WRITE stby TO STANDBY PRIMARY
8、在备库应用redo日志
SQL> alter database recover managed standby database using current logfile disconnect from session;
alter database recover managed standby database using current logfile disconnect from session
*
ERROR at line 1:
ORA-38500: USING CURRENT LOGFILE option not available without standby redo logs
原因在于之前主库没有创建standby reo log,需要创建之后再应用
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Total System Global Area 217157632 bytes
Fixed Size 2211928 bytes
Variable Size 159387560 bytes
Database Buffers 50331648 bytes
Redo Buffers 5226496 bytes
Database mounted.
SQL> alter database add standby logfile group 7 '/oradata/standby_redo04.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 4 '/oradata/standby_redo01.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 5 '/oradata/standby_redo02.log' size 50m;
Database altered.
SQL> alter database add standby logfile group 6 '/oradata/standby_redo03.log' size 50m;
Database altered.
SQL> alter database open;
Database altered.
重新应用日志
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.
9、在主库切换日志
SQL> alter system switch logfile;
System altered.
SQL> /
System altered.
SQL> /
System altered.
SQL> /
System altered.
10、在主库上查询归档日志
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oradata/orcl
Oldest online log sequence 48
Next log sequence to archive 50
Current log sequence 50
SQL>
11、在备库上查询归档日志
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oracle/oradata/orcl
Oldest online log sequence 48
Next log sequence to archive 0
Current log sequence 50
12、在备库上查询日志应用进程
SQL> select process,client_process,sequence#,status from v$managed_standby;
PROCESS CLIENT_P SEQUENCE# STATUS
--------- -------- ---------- ------------
ARCH ARCH 49 CLOSING
ARCH ARCH 0 CONNECTED
RFS UNKNOWN 0 IDLE
RFS LGWR 50 IDLE
MRP0 N/A 50 APPLYING_LOG
- oracle 11g physical standby switchover
- oracle 11g physical standby switchover
- oracle 11g physical standby switchover steps
- Oracle 11G Physical Standby Database Active Data Guard Switchover & Failover
- Oracle 11g logical standby switchover
- Switchover to a Physical Standby Database
- oel6.2 创建11g physical standby
- Creating a Physical Standby Database 11g
- Data Guard Physical Standby Setup in Oracle Database 11g Release 2
- Oracle 11G Physical Standby Database Active Data Guard - 安装配置
- Oracle 11G Physical Standby Database Active Data Guard - 数据文件路径错误问题
- Oracle 11g DataGuard Physical Standby 测试环境搭建 For windows
- Data Guard Physical Standby Setup in Oracle Database 11g Release 2
- Oracle Physical Standby
- Oracle 11g Active Data Guard step by step: How to create a Physical Standby Database using RMAN
- Create Oracle Physical Standby Database
- Oracle 11gR2(MAA) Physical Standby Databases Role Transfer
- Oracle 11gR2(MAA) Physical Standby Database Failover
- CToolTipCtrl使用详细解说
- jQuery中常用的函数方法总结
- hdu-2079-选课时间(题目已修改,注意读题)【母函数】
- COM问题初步
- NodeJs环境搭建
- oracle 11g physical standby switchover
- A Simple Problem with Integers(线段树)
- [Java基础]用流进行byte字节流的读写
- VS2005 start debuging出现错误code 0x80004002
- 音视频开发技术,让智能家居更智能!
- 【002】【Xcode6-Beta5】IOS静态库的制作与使用
- 读取本地文件存放list集合中
- D3D 纹理 例子程序
- 最长回文子串