select switchover_status from gv$database;查詢主備..."/>
溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

DG 查詢/切換的相關(guān)命令

發(fā)布時間:2020-07-30 09:42:39 來源:網(wǎng)絡(luò) 閱讀:681 作者:新夢傳奇 欄目:大數(shù)據(jù)

 查看數(shù)據(jù)庫可進行的角色轉(zhuǎn)換

1.    $sqlplus / as sysdba

2.    SQL> select switchover_status from gv$database;


查詢主備庫同步情況

3.    select unique thread# as thread,max(sequence#) over(partition by thread#) as last from gv$archived_log;

4.    select thread# ,low_sequence#,high_sequence# from gv$archive_gap;

將主庫切換為備庫

5.    alter database commit to switchover to physical standby with session shutdown ;

6.     select switchover_status from gv$database;


將備庫切換為主庫

7.    select open_mode from gv$database;

8.    select switchover_status from gv$database;

9.    select unique thread# as thread,max(sequence#) over(partition by thread#) as last from gv$archived_log;

10   $ srvctl stop instance –i ebiz2 –d ebizsh

11.SQL> alter database commit to switchover to primary with

session shutdown ;

12. alter database open;

13. $ srvctl start instance –i ebiz2 –d ebizsh

原主庫轉(zhuǎn)備庫后開始應(yīng)用日志

14. SQL> alter database recover managed  standby database using current logfile disconnect from session;

15. $ srvctl start instance -d ebiz -i ebiz2

16. SQL> select open_mode from gv$database;

(7) Oracle登錄數(shù)據(jù)庫服務(wù)器,原同城備庫需要在黑龍江和上海主備切換后重新啟動日志應(yīng)用

17. SQL> alter database recover managed  standby database

using current logfile disconnect from session;

18.  SQL> select status from v$managed_standby where

process like 'MRP%';

DG 查詢/切換的相關(guān)命令啟動數(shù)據(jù)庫節(jié)點1實例

19.  $ srvctl start instance –i ebiz1 –d ebiz

20.  $ srvctl stop instance –i ebiz2 –d ebiz

繼續(xù)進行redo apply

21. SQL> alter database recover managed standby database

using current logfile disconnect;

直至日志同步完畢,SCN號不變,同時檢查 gv$archived_log視圖,序列號達到源端最大值

22.  SQL> select  current_scn from  gv$database;

23. SQL>select unique thread# as thread,max(sequence#)

over(partition by thread#) as last from gv$archived_log;


24.  $asmcmd

25. Cp +DATA_DG/ebiz/archivelog/YYYYMMDD/XXXX 

/rman/backup/ --拷貝至文件系統(tǒng)

ftp或scp至上海

注冊歸檔日志文件

26. SQL >  ALTER DATABASE REGISTER PHYSICAL LOGFILE

'XXXX';


27. Database altered.


然后進行redo apply

28. SQL> alter database recover managed standby database using current logfile disconnect;


29. SQL> alter database commit to switchover to primary with

session shutdown ;

30. SQL> alter database open; SQL> select open_mode from

gv$database;

31.  SQL>  select switchover_status from gv$database;

32. $ srvctl start instance –i ebiz2 –d ebizsh


向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI