您好,登錄后才能下訂單哦!
這篇文章主要介紹oracle dg如何安裝,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
主備庫均為歸檔模式,并且force logging
==開啟歸檔并設(shè)為強(qiáng)制日志模式==
select log_mode,force_logging from v$database;
alter database archivelog;
alter database force logging;
===修改主庫參數(shù)===
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;
===創(chuàng)建參數(shù)文件,修改后用于備庫===
create pfile='/tmp/tt/initdg01.ora' from spfile;
===tnsnames.ora和監(jiān)聽(兩端均為靜態(tài)監(jiān)聽)===
===復(fù)制主庫準(zhǔn)備好的參數(shù)文件和密碼文件到備庫===
環(huán)境準(zhǔn)備好后:
===備庫利用修改好的參數(shù)文件,啟動數(shù)據(jù)庫到nomount狀態(tài)===
===主庫操作===
rman target / auxiliary sys/oracle@dg01
duplicate target database for standby from active database;
或者
duplicate target database for standby nonamefilecheck from active database;(無需目錄轉(zhuǎn)換)
===建立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驗(yàn)證===
驗(yàn)證物理備庫是否工作:
檢查是否存在報(bào)錯(cuò):
select error,destination from v$archive_dest;
(1)在備庫上檢查已經(jīng)存在的歸檔日志
select sequence# , first_time , next_time from v$archived_log order by sequence#;
(2)在主庫上強(qiáng)制進(jìn)行日志切換,手動歸檔
alter system switch logfile;
(3)在備庫上檢查歸檔日志(是否出現(xiàn)新的歸檔日志)
select sequence# , first_time , next_time from v$archived_log order by sequence#;
(4)檢查歸檔日志是否被“應(yīng)用”
select sequence# , applied from v$archived_log order by sequence#;
===當(dāng)備庫正在應(yīng)用日志,把備庫啟動到只讀模式
停掉日志應(yīng)用
alter database recover managed standby database cancel;
以只讀方式打開備庫
alter database open;
當(dāng)數(shù)據(jù)庫處于只讀模式,把備庫切換到Redo Apply
1. 讓所有活動的會話退出備庫
2. 日志應(yīng)用
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、主庫切換到備庫
查看主庫狀態(tài):
select database_role,switchover_status from v$database;
to standby
alter database commit to switchover to physical standby;
備注:
A:switchover_status出現(xiàn)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;
重復(fù)驗(yàn)證dg。
=================
注意:
一般switchover切換都是計(jì)劃中的切換,特點(diǎn)是切換后,不會丟失任何數(shù)據(jù),而且這個(gè)過程是
可逆的,整個(gè)data guard環(huán)境不會被破壞,原來的data guard環(huán)境中的所有standby
都可以繼續(xù)工作。
在進(jìn)行data guard的物理standby切換前:
1)確認(rèn)主從庫之間的網(wǎng)絡(luò)連接暢通;
2)確認(rèn)沒有活動的會話連接在數(shù)據(jù)庫中;
3)primary數(shù)據(jù)庫處于打開狀態(tài),standby數(shù)據(jù)庫處于mount狀態(tài)。
以上是“oracle dg如何安裝”這篇文章的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對大家有幫助,更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。