RAC+單例項DG的切換
RAC+單例項DG的切換
https://blog.csdn.net/xxzhaobb/article/details/79109155
RAC+單例項DG的搭建過程
https://blog.csdn.net/xxzhaobb/article/details/79108963
之前切換不成功,和引數設定有關。注意的引數是sid=* 之類的,剛搭建好的環境
racdbdg是單例項的,是備庫,rac節點是主庫。
搭建完畢,切換了一次,剛好主庫是單例項的racdbdg,rac節點是備庫了。
進行後續的切換
--------------------------------
primary :racdbdg 單例項
SYS@racdbdg>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SYS@racdbdg>
Standby : 是RAC節點
SYS@racdb2>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED
SYS@racdb1>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY NOT ALLOWED
或者這樣查詢
SYS@racdb2>select inst_id,database_role,switchover_status from gv$database;
INST_ID DATABASE_ROLE SWITCHOVER_STATUS
---------- ---------------- --------------------
2 PHYSICAL STANDBY NOT ALLOWED
1 PHYSICAL STANDBY NOT ALLOWED
--------開始切換
檢視主庫的狀態 在主機 racdbdg上檢視 。 是to standby ,可以切換
SYS@racdbdg>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SYS@racdbdg>
-- 將主庫切換到備庫狀態
alter database commit to switchover to physical standby with session shutdown;
SYS@racdbdg>alter database commit to switchover to physical standby with session shutdown;
Database altered.
將新的備庫啟動到mount狀態,這個時候新的備庫是關閉狀態,啟動後,狀態是備庫
SYS@racdbdg>archive log list
ORA-01012: not logged on
SYS@racdbdg>conn / as sysdba
Connected to an idle instance.
SYS@racdbdg>startup mount
ORACLE instance started.
Total System Global Area 1235959808 bytes
Fixed Size 2252784 bytes
Variable Size 922746896 bytes
Database Buffers 301989888 bytes
Redo Buffers 8970240 bytes
Database mounted.
SYS@racdbdg>
SYS@racdbdg>select database_role from v$database;
DATABASE_ROLE
----------------
PHYSICAL STANDBY
SYS@racdbdg>
-- 將原備庫切換為主庫。在rac 任意一個節點上執行
-- 檢視rac節點的狀態,是可以切換的
SYS@racdb1>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY
SYS@racdb2>select inst_id,database_role,switchover_status from gv$database;
INST_ID DATABASE_ROLE SWITCHOVER_STATUS
---------- ---------------- --------------------
1 PHYSICAL STANDBY SESSIONS ACTIVE
2 PHYSICAL STANDBY SESSIONS ACTIVE
SYS@racdb2>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY
SYS@racdb2>
-- 進行切換,在任何一個節點執行。其中另一個節點,會自動切換為mount狀態
--在節點2上執行:
SYS@racdb2>alter database commit to switchover to primary with session shutdown ;
Database altered.
SYS@racdb2>select switchover_status ,open_mode,database_role from v$database;
SWITCHOVER_STATUS OPEN_MODE DATABASE_ROLE
-------------------- -------------------- ----------------
NOT ALLOWED MOUNTED PRIMARY
SYS@racdb2>alter database open;
Database altered.
SYS@racdb2>
--另一個節點狀態
SYS@racdb1>archive log list
ORA-03135: connection lost contact
SYS@racdb1>conn / as sysdba
Connected.
SYS@racdb1>
-- 這個時候,主庫是rac。備庫是單例項的racdbdg了 在主庫上插入資料,備庫查詢
SYS@racdb2>select count(*) from t;
COUNT(*)
----------
6
SYS@racdb2>insert into t values(7);
1 row created.
SYS@racdb2>commit;
Commit complete.
SYS@racdbdg>select * from t;
ID
----------
1
2
3
4
5
6
7
7 rows selected.
------- 再切換一次,主備切換
現在的主庫是雙節點的rac, 備庫是單例項的racdbdg 。再切換一次,把主庫切換成單節點,備庫切換成rac
SYS@racdb1>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY TO STANDBY
SYS@racdb1>alter database commit to switchover to physical standby with session shutdown;
Database altered.
SYS@racdb1>
切換為備庫後,原來的雙節點的主庫變成備庫,兩個節點都被關閉。需要mount
SYS@racdb1>select open_mode ,database_role from v$database;
select open_mode ,database_role from v$database
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 9039
Session ID: 32 Serial number: 19
SYS@racdb1>conn / as sysdba
Connected to an idle instance.
SYS@racdb1>startup mount;
ORACLE instance started.
Total System Global Area 1235959808 bytes
Fixed Size 2252784 bytes
Variable Size 1090519056 bytes
Database Buffers 134217728 bytes
Redo Buffers 8970240 bytes
Database mounted.
SYS@racdb1>select open_mode ,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
MOUNTED PHYSICAL STANDBY
SYS@racdb1>
-- 切換單例項的備庫為主庫:
SYS@racdbdg>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY
SYS@racdbdg>
SYS@racdbdg>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PHYSICAL STANDBY TO PRIMARY
SYS@racdbdg>alter database commit to switchover to primary with session shutdown ;
Database altered.
Database altered.
SYS@racdbdg>conn / as sysdba
Connected.
SYS@racdbdg>select database_role,switchover_status from v$database;
DATABASE_ROLE SWITCHOVER_STATUS
---------------- --------------------
PRIMARY NOT ALLOWED
SYS@racdbdg>alter database open;
Database altered.
SYS@racdbdg>
--- 驗證 主庫插入資料
SYS@racdbdg>select count(*) from t;
COUNT(*)
----------
8
SYS@racdbdg>insert into t values(9);
1 row created.
SYS@racdbdg>commit;
Commit complete.
SYS@racdbdg>
-- 備庫查詢
SYS@racdb2>archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 0
Next log sequence to archive 0
Current log sequence 0
SYS@racdb2>archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 0
Next log sequence to archive 0
Current log sequence 0
SYS@racdb2>select count(*) from t;
COUNT(*)
----------
9
SYS@racdb2>
SYS@racdb1>archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination +FRA
Oldest online log sequence 23
Next log sequence to archive 0
Current log sequence 23
SYS@racdb1>
SYS@racdbdg>archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/archivelog
Oldest online log sequence 22
Next log sequence to archive 23
Current log sequence 23
SYS@racdbdg>
從上面可以看到,切換成功了 。
從alert log中看到的一些資訊。說明,在搭建的時候,要考慮sid
Archived Log entry 91 added for thread 2 sequence 16 ID 0x396d1acf dest 1:
Fri Jan 19 15:44:15 2018
ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*';
Fri Jan 19 15:45:43 2018
Thread 1 cannot allocate new log, sequence 23
Checkpoint not complete
Current log# 1 seq# 22 mem# 0: /u01/app/oracle/oradata/racdbdg/group_1.257.965769287
******************************************************************
LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2
******************************************************************
LGWR: Standby redo logfile selected for thread 1 sequence 23 for destination LOG_ARCHIVE_DEST_2
Thread 1 advanced to log sequence 23 (LGWR switch)
Current log# 2 seq# 23 mem# 0: /u01/app/oracle/oradata/racdbdg/group_2.258.965769287
Fri Jan 19 15:45:45 2018
Archived Log entry 94 added for thread 1 sequence 22 ID 0x396d1acf dest 1:
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2637887/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RAC+DG(asm單例項)ASM單例
- DG的切換操作
- js圖片切換例項JS
- dg切換操作文件
- oracle dg切換操作示例Oracle
- 純CSS的導航欄Tab切換例項CSS
- 使用Broker實現DG切換
- Oracle RAC DG手動切換Oracle
- vue移動端路由切換完整例項Vue路由
- 【DG】在Linux平臺上搭建單例項的dataguard--duplicateLinux單例
- 【DG】Data Guard主備庫Failove切換AI
- 【DG】Data Guard主備庫Switchover切換
- 一步一步搭建11gR2 rac+dg之配置單例項的DG(八)單例
- CentOS 7.3 ECS上搭建RAC 18c+單例項DG+EMCC+DG的FSFO快速故障轉移配置CentOS單例
- Oracle 11g dg switchover切換操作流程Oracle
- 5分鐘,徹底精通Oracle DG切換Oracle
- 【DG】在Linux平臺上搭建單例項的dataguard--rman還原方式Linux單例
- Oracle 18c&19c physical dg切換總結Oracle
- 路由交換例項路由
- 將RAC軟體轉換為單例項軟體單例
- 如何例項化不同頁面物件對應不同的 iframe,而不用頻繁切換物件
- 10g DG保護模式的切換:從最大效能到最大可用模式
- 如何將獨立例項轉換成叢集例項EU
- 基於單機的DataGuard切換文件
- 簡單實用的JDK版本切換JDK
- oracle 跨小版本dg切換應用補丁報錯處理Oracle
- PHP 完整表單例項PHP單例
- Redis單例項安裝Redis單例
- Swift 中單例模式的替換Swift單例模式
- JavaScript左右滑動切換的選項卡詳解JavaScript
- 流暢切換的彩色選單欄:ColorfulNavigationBarNavigation
- Java的Socket通訊簡單例項Java單例
- 實現點選"換一批"來切換內容,flutter之CustomScrollView【flutter20個例項之八】FlutterView
- C++學習隨筆——簡單的單例設計模式例項C++單例設計模式
- KindEditor如何切換成簡單模式??模式
- Selenium多表單切換switch_to.frame
- Oracle 單機切換為主備Oracle
- rac恢復到單例項單例