Data Guard Broker系列之二:Data Guard Broker配置實戰
轉自:
[@more@]
測試的DG環境安裝在同一個機器上,當前兩個資料庫處於同步的狀態,兩個例項的名字分別是TORCLA和TORCLB,資料庫的名字TORCL,資料庫DB_DOMAIN設定為mycompany,其他的設定如下。
listener.ora設定
(address=
(protocol=tcp) (host=orainst.desktop.mycompany.com) (port=8000) (queuesize=32)
)log_file_L_torcla_001=/tmp/L_torclb_001.logSID_LIST_L_dg=
(SID_LIST =
(SID_DESC=
(ORACLE_HOME=/data1/dg/10.2.0.2/A10db)
(SID_NAME=torcl)
)
)
本地tnsname.ora的設定
(DESCRIPTION=
(ENABLE=BROKEN)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=orainst.desktop.mycompany.com)(PORT=8000))
)
(CONNECT_DATA=
(SID=torcl)
)
)
torcla.mycompany=
(DESCRIPTION=
(SDU= 32767)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=orainst.desktop.mycompany.com)(PORT=8000))
(ADDRESS=(PROTOCOL=TCP)(HOST=orainst.desktop.mycompany.com)(PORT=8000))
)
(CONNECT_DATA=
(SERVICE_NAME=torcla.mycompany)
(SERVER=DEDICATED)
)
)
torclb.mycompany=
(DESCRIPTION=
(SDU= 32767)
(ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=orainst.desktop.mycompany.com)(PORT=8000))
(ADDRESS=(PROTOCOL=TCP)(HOST=orainst.desktop.mycompany.com)(PORT=8000))
)
(CONNECT_DATA=
(SERVICE_NAME=torclb.mycompany)
(SERVER=DEDICATED)
)
)
DG的相關設定
-------------------- ------------------------- --------------- --------------------primary MAXIMUM PERFORMANCE READ WRITE SESSIONS ACTIVE
-- 日誌歸檔相關設定SYS@torclb> show parameter log_archive_dest_1NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------log_archive_dest_1 string location="/data1/dg/databases/
torclb/redolog", valid_for=(ONL
INE_LOGFILE,ALL_ROLES)
SYS@torclb> show parameter log_archive_dest_2NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------log_archive_dest_1 string SERVICE=torcla.mycompany valid_fo
tr=(online_logfile, primary_ro
tle) REOPEN=60 OPTIONAL LGWR S
tYNC AFFIRM db_unique_name=torcla
topbroker設定準備工作
下面按照上一篇文章所列出的準備工作清單一一做一遍。
top設定primary和standby使用spfile
不管是primary資料庫還是standby資料庫都要完成這一步,設定完畢後重啟下資料庫使設定生效。
File created.
--在當前的standby上SYS@torcla> create spfile='/data1/dg/10.2.0.2/A10db/dbs/spfiletorclb.ora' from pfile;
File created.
然後修改init檔案設定spfile引數:
$cat inittorclb.oraspfile='spfiletorclb.ora'
-- standby的init檔案
$cat inittorcla.oraspfile='spfiletorcla.ora'
top配置DG_BROKER_CONFIG_FILEn
這裡我們的DG_BROKER_CONFIG_FILEn不做特別的設定,使用預設的$ORACLE_HOME/dbs目錄以及兩個預設的檔名dr1
當然也可以用sqlplus透過下面語句設定不同的目錄,要注意在兩個資料庫上面都要設定:
top設定local_listener
這一步設定是為了保證一些service name能正確的被註冊上。
System altered.
top新增靜態的_unique_name_DGMGRL.db_domain註冊
在當前的測試環境中primary和standby是在同一機器上面,因此這個service name的設定也是在同一個listener.ora檔案上,設定完了以後的listener.ora如下
(address=
(protocol=tcp) (host=orainst.desktop.mycompany.com) (port=8000) (queuesize=32)
)log_file_L_torcla_001=/tmp/L_torclb_001.logSID_LIST_L_dg=
(SID_LIST =
(SID_DESC=
(ORACLE_HOME=/data1/dg/10.2.0.2/A10db)
(SID_NAME=torcl)
)
(SID_DESC=
(ORACLE_HOME=/data1/dg/10.2.0.2/A10db)
(SID_NAME=torcla)
(GLOBAL_DBNAME=torcla_DGMGRL.mycompany)
)
(SID_DESC=
(ORACLE_HOME=/data1/dg/10.2.0.2/A10db)
(SID_NAME=torclb)
(GLOBAL_DBNAME=torclb_DGMGRL.mycompany)
)
)
設定完畢後記得重啟下listener,然後檢視一下設定的效果:
$lsnrctl service L_dg|grep 'Service 'Service "torcl" has 1 instance(s).Service "torcla.mycompany" has 1 instance(s).Service "torcla_DGMGRL.mycompany" has 1 instance(s).Service "torcla_XPT.mycompany" has 1 instance(s).Service "torclb.mycompany" has 1 instance(s).Service "torclb_DGMGRL.mycompany" has 1 instance(s).Service "torclb_XPT.mycompany" has 1 instance(s).
從上面的listener上註冊的服務我們可以看到動態註冊的_XPT已經有了,說明local_listener設定正確,_DGMGRL也配置正確。
top設定dg_broker_start為TRUE
這一步是啟動Data Guard broker monitor(DMON)程式,在兩個資料庫上面都執行下下面的命令
然後檢視下結果,先看程式是否起來了
$ps -ef|grep dmon|grep -v greporacle 19389 1 0 09:51 ? 00:00:00 ora_dmon_torclaoracle 19420 1 0 09:51 ? 00:00:00 ora_dmon_torclb
可以看到兩個dmon程式都起來了,接下來看看service name _DGB有沒有被正確的註冊上
$lsnrctl service L_dg|grep 'Service 'Service "torcl" has 1 instance(s).Service "torcla.mycompany" has 1 instance(s).Service "torcla_DGB.mycompany" has 1 instance(s).Service "torcla_DGMGRL.mycompany" has 1 instance(s).Service "torcla_XPT.mycompany" has 1 instance(s).Service "torclb.mycompany" has 1 instance(s).Service "torclb_DGB.mycompany" has 1 instance(s).Service "torclb_DGMGRL.mycompany" has 1 instance(s).Service "torclb_XPT.mycompany" has 1 instance(s).
可以看到service name _DGB也正常的註冊上了,到現在我們前期的準備工就已經全部完成了。
top配置broker
現在我們可以來配置broker了,為了保證配置過程不會因為許可權問題導致問題,我們始終都是用sys連線資料庫的。
首先使用DGMGRL連線到primary機器上,執行下面的命令:
$dgmgrl sys/12345@torclb.mycompanyDGMGRL for Linux: Version 10.2.0.2.0 - Production
Copyright (c) 2000, 2005, Oracle. All rights reserved.
Welcome to DGMGRL, type "help" for information.Connected.DGMGRL> show configurationError: ORA-16532: Data Guard broker configuration does not exist
Configuration details cannot be determined by DGMGRLDGMGRL>
當前還沒有任何的配置資訊,現在建立一個配置
> primary database is 'torclb'
> connect identifier is torclb.mycompany;Configuration "FSF" created with primary database "torclb"DGMGRL>
這樣我們就建立了一個名為FSF的broker配置,接下來把standby機器也就入到配置中
> connect identifier is torcla.mycompany
> maintained as physical;Database "torcla" addedDGMGRL>
就這兩步,broker的最基本配置就完成了,這下可以用show configuration來看成果了。
Configuration
Name: FSF
Enabled: NO
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torclb - primary database
torcla - Physical standby database
Current status for "FSF":DISABLED
DGMGRL>
可以看到torclb是primary資料庫,而torcla是physical standby資料庫,不過這是的broker配置的狀態是禁用的,說明我們的兩個資料庫是沒有被broker管理的,只是加入到了broker配置中了而已,接下來啟用一下。
Configuration
Name: FSF
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torclb - primary database
torcla - Physical standby database
Current status for "FSF":SUCCESS
這樣就成了,一個成功的broker配置完成,挺簡單的。
最後我們做一個switchover來檢驗下成果吧,具體的switchover的過程在後面再介紹。
Database dismounted.ORACLE instance shut down.Operation requires shutdown of instance "torcla" on database "torcla"Shutting down instance "torcla"...ORA-01109: database not open
Database dismounted.ORACLE instance shut down.Operation requires startup of instance "torclb" on database "torclb"Starting instance "torclb"...ORACLE instance started.Database mounted.Operation requires startup of instance "torcla" on database "torcla"Starting instance "torcla"...ORACLE instance started.Database mounted.Switchover succeeded, new primary is "torcla"DGMGRL> show configuration
Configuration
Name: FSF
Enabled: YES
Protection Mode: MaxPerformance
Fast-Start Failover: DISABLED
Databases:
torclb - Physical standby database
torcla - Primary database
Current status for "FSF":SUCCESS
DGMGRL>
我們已經成功的將primary資料庫卻換成了torcla,用一個簡單的命令,這個就是broker的優勢所在,簡單!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/73920/viewspace-1043818/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle Data Guard Broker元件Oracle元件
- 1 Oracle Data Guard Broker 概念Oracle
- Oracle Data Guard和Broker概述Oracle
- 8 Oracle Data Guard Broker 屬性Oracle
- 官方文件學習:data guard broker
- 轉載《Data Guard Broker基礎》
- Data Guard Broker系列之四:資料庫管理資料庫
- 使用Data Guard Broker進行Data Guard物理備用庫配置(Oracle 19c)Oracle
- 【DATAGUARD】Oracle19c Data Guard BrokerOracle
- Data Guard Broker系列之六:Fast-Start FailoverASTAI
- A Oracle Data Guard Broker 升級和降級Oracle
- Data Guard broker系列之五:資料庫角色轉換資料庫
- Oracle Data Guard Broker and Static Service Registration (文件 ID 1387859.1)Oracle
- 使用Broker管理Data Guard——停用、改保護模式等模式
- Data Guard Broker High Availability (Doc ID 275977.1)AI
- Data Guard配置Broker解決ORA-16664、ORA-16792
- 【DATAGUARD】物理dg配置客戶端無縫切換 (八.1)--Data Guard Broker 的配置客戶端
- Oracle Data Guard配置Oracle
- oracle 10g data guard broker ORA-16607 故障處理案例Oracle 10g
- DATA GUARD部署模式——DATA GUARD概念和管理模式
- 介紹ORACLE DATA GUARD——DATA GUARD概念和管理Oracle
- Data guard搭建
- oracle data guard!!Oracle
- 實戰11g active data guard on rac
- Data Guard - Snapshot Standby Database配置Database
- DATA GUARD 簡介
- Data Guard 建立(ASM)ASM
- Oracle 11g Data Guard Enabling Active Data GuardOracle
- [Data Guard]Oracle10g Data Guard學習筆記(一)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(二)Oracle筆記
- [Data Guard]Oracle10g Data Guard學習筆記(三)Oracle筆記
- 監控Data Guard實時同步
- Oracle Data Guard簡介Oracle
- 單機搭建Data Guard
- Active Data Guard初探(一)
- DATA GUARD架構(一)架構
- Oracle Data Guard 介紹Oracle
- Data Guard Wait EventsAI