【DataGuard】10g物理standby主備switchover方式切換詳述
以下給大家展現一下10g物理standby主備之間透過switchover方式進行切換的詳細步驟,供參考。
1、主庫檢查是否為“TO STANDBY”狀態,若不是,需要重新啟動一下主庫(主庫ora10g操作)
sys@ora10g> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
sys@ora10g> startup force ;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1266056 bytes
Variable Size 83889784 bytes
Database Buffers 16777216 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
sys@ora10g> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
2.將primary轉換為standby角色(主庫ora10g操作)
sys@ora10g> alter database commit to switchover to physical standby;
Database altered.
3.原主庫重啟動到mount狀態(原主庫ora10g操作)
NotConnected@> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
NotConnected@>
NotConnected@> startup mount;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1266056 bytes
Variable Size 88084088 bytes
Database Buffers 12582912 bytes
Redo Buffers 2924544 bytes
Database mounted.
4.檢查原備庫是否為“TO PRIMARY”狀態,如果為“SWITCHOVER PENDING”狀態,需要先進行一下恢復再切換 (待切換備庫ora10gdg操作)
ora10g@linux5 /home/oracle$ export ORACLE_SID=ora10gdg
ora10gdg@linux5 /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Mar 28 08:26:53 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
NotConnected@> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SWITCHOVER PENDING
NotConnected@> alter database commit to switchover to primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
NotConnected@> alter database recover managed standby database disconnect from session;
Database altered.
NotConnected@> alter database recover managed standby database cancel;
Database altered.
NotConnected@> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
5.原備庫轉換角色到primary (待切換備庫ora10gdg操作)
NotConnected@> alter database commit to switchover to primary;
Database altered.
6.主備切換完成,open新的primary資料庫 (待切換備庫ora10gdg操作)
NotConnected@> alter database open;
Database altered.
7.最後驗證階段
1).新的primary庫在sec使用者建立一個新表test_new
sec@ora10g> create table test_new (a int);
Table created.
sec@ora10g> insert into test_new values ( 100 );
1 row created.
sec@ora10g> commit;
Commit complete.
sec@ora10g> select * from test_new;
A
----------
100
sec@ora10g> conn / as sysdba
Connected.
sys@ora10g> alter system switch logfile;
System altered.
sys@ora10g> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
69
2).檢視新standby庫,驗證切換是否成功
ora10gdg@linux5 /home/oracle$ export ORACLE_SID=ora10g
ora10g@linux5 /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Mar 28 08:55:09 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
NotConnected@> alter database recover managed standby database disconnect from session;
Database altered.
NotConnected@> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
69
NotConnected@> alter database recover managed standby database cancel;
Database altered.
NotConnected@> alter database open read only;
Database altered.
NotConnected@> conn sec/sec
Connected.
sec@ora10g> select * from test_new;
A
----------
100
OK!到此主備之間的switchover方式切換成功。
secooler
09.03.27
-- The End --
1、主庫檢查是否為“TO STANDBY”狀態,若不是,需要重新啟動一下主庫(主庫ora10g操作)
sys@ora10g> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE
sys@ora10g> startup force ;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1266056 bytes
Variable Size 83889784 bytes
Database Buffers 16777216 bytes
Redo Buffers 2924544 bytes
Database mounted.
Database opened.
sys@ora10g> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO STANDBY
2.將primary轉換為standby角色(主庫ora10g操作)
sys@ora10g> alter database commit to switchover to physical standby;
Database altered.
3.原主庫重啟動到mount狀態(原主庫ora10g操作)
NotConnected@> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
NotConnected@>
NotConnected@> startup mount;
ORACLE instance started.
Total System Global Area 104857600 bytes
Fixed Size 1266056 bytes
Variable Size 88084088 bytes
Database Buffers 12582912 bytes
Redo Buffers 2924544 bytes
Database mounted.
4.檢查原備庫是否為“TO PRIMARY”狀態,如果為“SWITCHOVER PENDING”狀態,需要先進行一下恢復再切換 (待切換備庫ora10gdg操作)
ora10g@linux5 /home/oracle$ export ORACLE_SID=ora10gdg
ora10gdg@linux5 /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Mar 28 08:26:53 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
NotConnected@> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SWITCHOVER PENDING
NotConnected@> alter database commit to switchover to primary;
alter database commit to switchover to primary
*
ERROR at line 1:
ORA-16139: media recovery required
NotConnected@> alter database recover managed standby database disconnect from session;
Database altered.
NotConnected@> alter database recover managed standby database cancel;
Database altered.
NotConnected@> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY
5.原備庫轉換角色到primary (待切換備庫ora10gdg操作)
NotConnected@> alter database commit to switchover to primary;
Database altered.
6.主備切換完成,open新的primary資料庫 (待切換備庫ora10gdg操作)
NotConnected@> alter database open;
Database altered.
7.最後驗證階段
1).新的primary庫在sec使用者建立一個新表test_new
sec@ora10g> create table test_new (a int);
Table created.
sec@ora10g> insert into test_new values ( 100 );
1 row created.
sec@ora10g> commit;
Commit complete.
sec@ora10g> select * from test_new;
A
----------
100
sec@ora10g> conn / as sysdba
Connected.
sys@ora10g> alter system switch logfile;
System altered.
sys@ora10g> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
69
2).檢視新standby庫,驗證切換是否成功
ora10gdg@linux5 /home/oracle$ export ORACLE_SID=ora10g
ora10g@linux5 /home/oracle$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Sat Mar 28 08:55:09 2009
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, Data Mining and Real Application Testing options
NotConnected@> alter database recover managed standby database disconnect from session;
Database altered.
NotConnected@> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
69
NotConnected@> alter database recover managed standby database cancel;
Database altered.
NotConnected@> alter database open read only;
Database altered.
NotConnected@> conn sec/sec
Connected.
sec@ora10g> select * from test_new;
A
----------
100
OK!到此主備之間的switchover方式切換成功。
secooler
09.03.27
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-580380/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DataGuard---->物理StandBy的角色切換之switchover
- Oracle DataGuard 主備切換 (switchover) oracle11gOracle
- 【DATAGUARD】Oracle Dataguard物理備庫切換最佳實踐(sqlplus)OracleSQL
- openGauss主備切換之switchover與failoverAI
- 【DG】Data Guard主備庫Switchover切換
- 物理DataGuard客戶端無縫切換--客戶端TAF 配置客戶端
- DATAGUARD失敗切換
- DATAGUARD強行切換
- Oracle 11.2.0.4 physical dataguard和snapshot dataguard切換Oracle
- ORACLE 12C DATAGUARD環境搭建和主從切換Oracle
- Oracle 單機切換為主備Oracle
- oracle11g dataguard切換Oracle
- Oracle 11g dg switchover切換操作流程Oracle
- Oracle 10g/11g下如何將物理Standby庫臨時啟用用於災備測試Oracle 10g
- 【DG】Data Guard主備庫Failove切換AI
- Mysql 5.6 Master和Slave 主備切換MySqlAST
- mysql 5.7+keepalived主從切換步驟簡述MySql
- MySQL高可用之MHA切換測試(switchover & failover)MySqlAI
- 基於單機的DataGuard切換文件
- 含有replication環境的sqlserver切換到standbySQLServer
- Oracle 11g 一主多備切換方案Oracle
- 基於多種場景DataGuard切換方案
- Physical Standby Switchover_status Showing Not Allowed. (Doc ID 1392763.1)
- DATAGUARD手記(PRIMARY+2STANDBY)(一)
- DATAGUARD手記(PRIMARY+2STANDBY)(二)
- 【PG流複製】Postgresql流複製主備切換SQL
- mysql主備切換canal出現的問題解析MySql
- oracle 19c使用dgmgrl來執行switchover和failover切換OracleAI
- (九)主題切換
- Redis主從切換Redis
- Oracle dataguard報錯:Error 1017 received logging on to the standbyOracleError
- 12c data guard 使用 sqlplus 主備切換最佳實踐SQL
- standby_file_management為manual造成dataguard延遲
- 手工切換MySQL主從MySql
- Redis sentinel主從切換Redis
- 【dgmgrl】使用dgmgrl做switchover切換報錯ORA-16501, ORA-16625等
- DG -- READ ONLY模式開啟物理Standby模式
- Spring Boot中自定義註解+AOP實現主備庫切換Spring Boot
- SQLServer2012映象主庫掛掉如何切換到映象備庫SQLServer