中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

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

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

【Data guard】Switchover切換

發布時間:2020-08-11 07:35:06 來源:ITPUB博客 閱讀:141 作者:恩強Boy 欄目:關系型數據庫

主備庫切換操作驗證 switchover

1.   主庫執行切換(A機)

1   查看 主庫狀態

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE    DATABASE_ROLE    SWITCHOVER_STATUS

--------------- -------------------- ---------------- --------------------

bhtc db               READ WRITE             PRIMARY             TO STANDBY

 

2 )主庫執行切換命令

SQL> alter database commit to switchover to physical standby with session shutdown wait;

Database altered.


2 )重啟主庫角色變為備庫( mount 狀態

 

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 1.3429E+10 bytes

Fixed Size                  2265944 bytes

Variable Size            6878661800 bytes

Database Buffers         6543114240 bytes

Redo Buffers                4612096 bytes

Database mounted.

 

4 )查看 主庫狀態

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE    DATABASE_ROLE    SWITCHOVER_STATUS

--------------- -------------------- ---------------- --------------------

Bhtc db                MOUNTED     PHYSICAL STANDBY      RECOVERY NEEDED  

 

2.   備庫切換成主庫 B 機)

 

1 )查看備庫狀態

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME   OPEN_MODE   DATABASE_ROLE    SWITCHOVER_STATUS

---------------    --------------------     ----------------       --------------------

bhtcdg              MOUNTED          PHYSICAL STANDBY      TO PRIMARY

 

2 )將備庫切換成主庫

 

SQL> alter database commit to switchover to primary with session shutdown  wait ;

Database altered.


3 )查看備庫狀態

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE     DATABASE_ROLE   SWITCHOVER_STATUS

--------------- -------------------- ---------------- --------------------

bhtcdg             MOUNTED           PRIMARY            NOT ALLOWED


4 )開啟

 

SQL> alter database open;

Database altered.

 

SQL>  select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE  DATABASE_ROLE    SWITCHOVER_STAT

--------------- ---------- ---------------- ---------------

bhtcdg         READ WRITE    PRIMARY          RESOLVABLE GAP

 

3.  打開數據庫( A 機)

 

SQL> alter database open read only;

 

4.  應用日志( A 機)

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

 

3. 驗證數據

1 )在新主庫創建用戶( B 機)

 

SQL> create user test1 identified by test1;

SQL> commit;

 

SQL> alter system switch logfile;

System altered.


2 )在新備庫查看( A 機)

SQL> select username from dba_users where username='TEST1';

 

USERNAME

------------------------------

TEST1

 

 

4. 切換回 最初的狀態

 

(1) 主庫操作( B

SQL> alter database commit to switchover to physical standby with session shutdown;

Database altered.

 

SQL> startup mount;

ORACLE instance started.

 

Total System Global Area 1.3429E+10 bytes

Fixed Size                  2265944 bytes

Variable Size            6878661800 bytes

Database Buffers         6543114240 bytes

Redo Buffers                4612096 bytes

Database mounted.

 

 

(2) 備庫 操作( A 機)

 

SQL> alter database commit to switchover to primary with session shutdown;

Database altered.

 

SQL> alter database open;

Database altered.

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE    DATABASE_ROLE    SWITCHOVER_STATUS

--------------- -------------------- ---------------- --------------------

bhtcdb               READ WRITE            PRIMARY            RESOLVABLE GAP

 

3 B 操作

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME   OPEN_MODE   DATABASE_ROLE    SWITCHOVER_STATUS

-------------------- -------------------- ---------------- --------------------

bhtcdg                MOUNTED      PHYSICAL STANDBY  NOT ALLOWED

 

4 )打開備庫開啟實時同步

 

SQL> alter database open read only;

Database altered.

 

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

Database altered.

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE  DATABASE_ROLE    SWITCHOVER_STAT

--------------- ---------- ---------------- ---------------

bhtcdg          READ ONLY  PHYSICAL STANDBY NOT ALLOWED

                WITH APPLY

 

5 )再次查看 A

 

SQL> select db_unique_name,open_mode,database_role,switchover_status from v$database;

 

DB_UNIQUE_NAME  OPEN_MODE    DATABASE_ROLE    SWITCHOVER_STATUS

--------------- -------------------- ---------------- --------------------

bhtc db             READ WRITE            PRIMARY           TO STANDBY

 

此時 ,已經切換回最初的狀態

 

6 )備庫查看日志應用情況

 

SQL> select sequence#,applied from v$archived_log;

 

 SEQUENCE# APPLIED

---------- ---------

         8 YES

         7 YES

         9 YES

        10 YES

        11 YES

        12 YES

        13 YES

        13 YES

        14 YES

        14 YES

        15 YES

 

 SEQUENCE# APPLIED

---------- ---------

        15 YES

        16 YES

        16 YES

        17 YES

        17 NO

        18 YES

        19 YES

        20 YES

        21 IN-MEMORY

 

---------- end ----------

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

乌兰浩特市| 岳阳市| 桐庐县| 凌云县| 沽源县| 高邑县| 平利县| 临沭县| 黎川县| 巴林左旗| 阿克苏市| 遂宁市| 保康县| 黄山市| 静宁县| 鄂伦春自治旗| 金溪县| 鞍山市| 河源市| 都匀市| 寿宁县| 尉氏县| 株洲市| 武威市| 如皋市| 扎兰屯市| 瑞安市| 宁都县| 嘉祥县| 余江县| 汝南县| 桂阳县| 曲周县| 大冶市| 云南省| 嘉善县| 水富县| 祁东县| 香格里拉县| 浦北县| 永昌县|