您好,登錄后才能下訂單哦!
Data Guard中Snapshot Standby Database配置是怎樣的,相信很多沒有經驗的人對此束手無策,為此本文總結了問題出現的原因和解決方法,通過這篇文章希望你能解決這個問題。
概述
--------
一般情況下,物理standby數據庫處于mount狀態接收和應用主庫的REDO日志,物理standby數據庫不能對外提供訪問。如果需要只讀訪問,那么可以臨時以read-only的方式open物理備庫,或者配置ACTIVE DATA GUARD,那么物理standby數據庫可以進行只讀(read-only)訪問(比如報表業務查詢),但是物理standby數據庫不能進行讀寫操作(read-write)。
有些情況下,為了實現系統的壓力測試或者Real Application Testing(RAT)或者其他讀寫操作測試,那么可以臨時將物理standby數據庫轉換為snapshot standby數據庫然后進行測試,因為snapshot standby數據庫是獨立于主庫的,并且是可以進行讀寫操作(read-write)。測試過程中snapshot standby數據庫正常接收主庫的歸檔日志,保證主庫的數據安全,但是不會應用這些日志,當壓力測試結束后,可以非常簡單的再將snapshot standby轉換為物理standby數據庫,繼續同步主庫日志。
配置
---------
1.物理standby配置閃回日志
SQL> Alter system set db_recovery_file_dest_size=500M;
System altered.
SQL> Alter system set db_recovery_file_dest='/u01/app/oracle/snapshot_standby';
System altered.
2.物理standby停止應用日志
SQL> alter database recover managed standby database cancel;
Database altered.
3.物理standby轉換為snapshot standby,并且open snapshot standby
SQL> alter database convert to snapshot standby;
Database altered.
SQL> alter database open;
Database altered.
檢查snapshot standby數據庫角色是SNAPSHOT STANDBY,open模式是READ WRITE:
SQL> select DATABASE_ROLE,name,OPEN_MODE from v$database;
DATABASE_ROLE NAME OPEN_MODE
---------------- --------- --------------------
SNAPSHOT STANDBY FSDB READ WRITE
4.對snapshot standby數據庫進行壓力測試或者Real Application Testing(RAT)或者其他讀寫操作。
5.測試結束后,再將snapshot standby轉換為physical standby,并且重新開始應用日志
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Database mounted.
SQL> ALTER DATABASE CONVERT TO PHYSICAL STANDBY;
Database altered.
SQL> shutdown immediate;
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.
Database mounted.
SQL>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
Database altered.
5.轉換為物理standby后,查看備庫角色是PHYSICAL STANDBY,open模式是MOUNTED
SQL> select DATABASE_ROLE,name,OPEN_MODE from v$database;
DATABASE_ROLE NAME OPEN_MODE
---------------- --------- --------------------
PHYSICAL STANDBY FSDB MOUNTED
6.檢查主庫和物理備庫日志是同步的
主庫日志:
SQL> select ads.dest_id,max(sequence#) "Current Sequence",
max(log_sequence) "Last Archived"
from v$archived_log al, v$archive_dest ad, v$archive_dest_status ads
where ad.dest_id=al.dest_id
and al.dest_id=ads.dest_id
and al.resetlogs_change#=(select max(resetlogs_change#) from v$archived_log )
group by ads.dest_id;
DEST_ID Current Sequence Last Archived
---------- ---------------- -------------
1 361 361
2 361 362
--備庫日志
SQL> select al.thrd "Thread", almax "Last Seq Received", lhmax "Last Seq Applied"
from (select thread# thrd, max(sequence#) almax
from v$archived_log
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) al,
(select thread# thrd, max(sequence#) lhmax
from v$log_history
where resetlogs_change#=(select resetlogs_change# from v$database)
group by thread#) lh
where al.thrd = lh.thrd;
Thread Last Seq Received Last Seq Applied
---------- ----------------- ----------------
1 361 361
看完上述內容,你們掌握Data Guard中Snapshot Standby Database配置是怎樣的的方法了嗎?如果還想學到更多技能或想了解更多相關內容,歡迎關注億速云行業資訊頻道,感謝各位的閱讀!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。