您好,登錄后才能下訂單哦!
這篇文章主要介紹oracle dg如何安裝,文中介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們一定要看完!
主備庫均為歸檔模式,并且force logging
==開啟歸檔并設為強制日志模式==
select log_mode,force_logging from v$database;
alter database archivelog;
alter database force logging;
===修改主庫參數===
alter system set log_archive_config="dg_config=(db01,dg01)" scope=both;
alter system set standby_file_management=auto scope=both;
alter system set log_archive_dest_1="location=/oracle/app/oracle/oradata/arch/ valid_for=(all_logfiles,all_roles) db_unique_name=db01" scope=both;
alter system set log_archive_dest_state_1="enable";
alter system set log_archive_dest_2="service=dg01 lgwr async valid_for=(online_logfile,primary_role) db_unique_name=dg01" scope=both;
alter system set log_archive_dest_state_2="enable";
alter system set fal_server=dg01 scope=both;
alter system set fal_client=db01 scope=both;
alter system set db_file_name_convert="/oracle/app/oracle/oradata/dg01/","/oracle/app/oracle/oradata/db01/" scope=spfile;
alter system set log_file_name_convert="/oracle/app/oracle/oradata/dg01/","/oracle/app/oracle/oradata/db01/" scope=spfile;
===創建參數文件,修改后用于備庫===
create pfile='/tmp/tt/initdg01.ora' from spfile;
===tnsnames.ora和監聽(兩端均為靜態監聽)===
===復制主庫準備好的參數文件和密碼文件到備庫===
環境準備好后:
===備庫利用修改好的參數文件,啟動數據庫到nomount狀態===
===主庫操作===
rman target / auxiliary sys/oracle@dg01
duplicate target database for standby from active database;
或者
duplicate target database for standby nonamefilecheck from active database;(無需目錄轉換)
===建立standy log(redolog+1)===
alter database add standby logfile thread 1 group 11 '/oracle/app/oracle/oradata/dg01/standby_group_11.log' size 52428800;
alter database add standby logfile thread 1 group 12 '/oracle/app/oracle/oradata/dg01/standby_group_12.log' size 52428800;
alter database add standby logfile thread 1 group 13 '/oracle/app/oracle/oradata/dg01/standby_group_13.log' size 52428800;
===dg驗證===
驗證物理備庫是否工作:
檢查是否存在報錯:
select error,destination from v$archive_dest;
(1)在備庫上檢查已經存在的歸檔日志
select sequence# , first_time , next_time from v$archived_log order by sequence#;
(2)在主庫上強制進行日志切換,手動歸檔
alter system switch logfile;
(3)在備庫上檢查歸檔日志(是否出現新的歸檔日志)
select sequence# , first_time , next_time from v$archived_log order by sequence#;
(4)檢查歸檔日志是否被“應用”
select sequence# , applied from v$archived_log order by sequence#;
===當備庫正在應用日志,把備庫啟動到只讀模式
停掉日志應用
alter database recover managed standby database cancel;
以只讀方式打開備庫
alter database open;
當數據庫處于只讀模式,把備庫切換到Redo Apply
1. 讓所有活動的會話退出備庫
2. 日志應用
alter database recover managed standby database disconnect from session;
或者(啟動real-time apply)
alter database recover managed standby database using current logfile disconnect from session;
====主備切換===
1、主庫切換到備庫
查看主庫狀態:
select database_role,switchover_status from v$database;
to standby
alter database commit to switchover to physical standby;
備注:
A:switchover_status出現session active/not allow
session active 表示還有活動的session
alter database commit to switchover to physical standby with session shut down;
B:not allow,ora-01153:an incompatible media recovery is active
alter database recover managed standby database finish;
或者
alter database recover managed standby database finish force;
重啟主庫
shutdown immediate
startup mount
alter database recover managed standby database disconnect from session;
select database_role,switchover_status from v$database;
to primary
2、備庫切換到主庫
select database_role,switchover_status from v$database;
to primary
alter database commit to switchover to primary;
shutdown immediate;
startup
alter system switch logfile;
重復驗證dg。
=================
注意:
一般switchover切換都是計劃中的切換,特點是切換后,不會丟失任何數據,而且這個過程是
可逆的,整個data guard環境不會被破壞,原來的data guard環境中的所有standby
都可以繼續工作。
在進行data guard的物理standby切換前:
1)確認主從庫之間的網絡連接暢通;
2)確認沒有活動的會話連接在數據庫中;
3)primary數據庫處于打開狀態,standby數據庫處于mount狀態。
以上是“oracle dg如何安裝”這篇文章的所有內容,感謝各位的閱讀!希望分享的內容對大家有幫助,更多相關知識,歡迎關注億速云行業資訊頻道!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。