Oracle DataGuard的原理與基本配置
最近集團在做災備方案,用於Oracle的高可用性,在不影響主庫效能的前提下,我們選擇使用DG的"最大效能"模式。 DG是Oracle資料庫內建的資料同步功能,其基本原理是將記錄檔從主庫傳輸到備庫,然後在備庫上應用這些記錄檔,從而使備庫與主庫保持同步。 DataGuard提供了三種日誌傳輸(Redo Transport)方式,分別是ARCH傳輸、LGWR同步傳輸和LGWR非同步傳輸。在上述三種日誌傳輸方式的基礎上,提供了三種資料保護模式,即最大效能(Maximum Performance Mode)、最大保護(Maximum Protection Mode)和最大可用(Maximum Availability Mode),其中最大保護模式和最大可用模式要求日誌傳輸必須用LGWR同步傳輸方式,最大效能模式下可用任何一種日誌傳輸方式。 現將Dataguard配置過程給大家做以分享1.主庫開啟歸檔模式2.alter database force logging;3.添加standby logfilealter database add standby logfile '/data/oracle/oradata/orcl/standby01.log' size 50M;alter database add standby logfile '/data/oracle/oradata/orcl/standby02.log' size 50M;alter database add standby logfile '/data/oracle/oradata/orcl/standby03.log' size 50M; 4.配置log_archive_configalter system set log_archive_config='dg_config=(orcl,dgorcl)'; alter system set log_archive_dest_1='location=/data/arch valid_for=(all_logfiles,all_roles) db_unique_name=orcl';alter system set log_archive_dest_2 ='service=dgorcl async valid_for=(online_logfile,primary_role) db_unique_name=dgorcl'; 5.編輯主庫tnsnames.ora檔案,將standby執行個體加進去DGORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dgorcl) ) ) 6.編輯主庫listener.ora檔案,將standby靜態註冊進去# listener.ora Network Configuration File: /data/oracle/product/11.2.0/db_1/network/admin/listener.ora# Generated by Oracle configuration tools. LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521)) ) ) ADR_BASE_LISTENER = /data/oracle SID_LIST_LISTENER = (SID_LIST = (SID_DESC = (GLOBAL_DBNAME = dgorcl) (ORACLE_HOME = /data/oracle/product/11.2.0/db_1) (SID_NAME = dgorcl) ) ) 7.重啟監聽lsnrctl stoplsnrctl start 8.建立standby庫密碼檔案 cd $ORACLE_HOME/dbscp orapworcl orapwdgorcl 9.建立standby的初始化參數檔案 cd $ORACLE_HOME/dbsecho DB_NAME=dgorcl>initdgorcl.ora 10.建立standby庫相應的目錄mkdir $ORACLE_BASE/admin/dgorclmkdir $ORACLE_BASE/admin/dgorcl/adumpmkdir $ORACLE_BASE/admin/dgorcl/dpdumpmkdir $ORACLE_BASE/admin/dgorcl/pfile 11.建立standby資料檔案存放位置mkdir $ORACLE_BASE/oradata/dgorcl 12.使用standby pfile啟動至nomount狀態 12.使用rman以auxiliary方式串連standby資料庫export ORACLE_SID=orclrman target / auxiliary sys@dgorcl 13.rman 建立standby資料庫run{allocate channel c1 type disk;allocate channel c2 type disk;allocate auxiliary channel stby type disk;duplicate target database for standby from active database spfileparameter_value_convert 'orcl','dgorcl'set db_unique_name='dgorcl'set db_file_name_convert='/orcl/','/dgorcl/'set control_files='/data/oracle/oradata/dgorcl/dgorcl.ctl'set log_archive_max_processes='5'set fal_client='dgorcl'set fal_server='orcl'set standby_file_management='AUTO'set log_archive_config='dg_config=(orcl,dgorcl)'set log_archive_dest_2='service=orcl async valid_for=(online_logfile,primary_role) db_unique_name=orcl' ;} 14.standby庫日誌恢複開啟alter database recover managed standby database disconnect from session; 到此已完成Phyical Dataguard的相關配置,並為之後調整DG到ADG,做logical dataguard,做報表查詢分擔主庫壓力和實現讀寫分離做準備。
Oracle 11gR2 在VMWare虛擬機器中安裝步驟
Debian 下 安裝 Oracle 11g XE R2
Oracle Data Guard 重要配置參數
基於同一主機配置 Oracle 11g Data Guard
探索Oracle之11g DataGuard
Oracle Data Guard (RAC+DG) 歸檔刪除策略及指令碼
Oracle Data Guard 的角色轉換
Oracle Data Guard的日誌FAL gap問題
Oracle 11g Data Guard Error 16143 Heartbeat failed to connect to standby 處理方法