[Data Guard]Oracle10g Data Guard學習筆記(二)

chenyan995發表於2008-12-22

1. Using Data Guard Broker and Enterprise Manager

Data Guard Broker: Components

Client-side:Two interfaces

Oracle Enterprise Manager 10g Grid Control

A command-line interface: DGMGRL

Server-side: Data Guard monitor

DMON process

Configuration files

A broker configuration consists of

A configuration object

Database objects

Instance objects

Data Guard Broker: Requirements

You must use the Enterprise Edition of Oracle Database 10g.

10g企業版

單例項或多例項

主備資料庫Compatible引數設定為9.2.0.1.0以上

Oracle Net network files必須在各資料庫上配置

每個instance上的LOCAL_LISTENER必須被解析為一個所有member都能訪問的地址

為使得DGMGRL能重啟例項,在每個例項的local listener中必須靜態註冊一個服務,其中GLOBAL_DBNAME設定格式為db_unique_name_DGMGRL.db_domain

初始化引數DG_BROKER_START = TRUE

主資料庫為歸檔模式

所有資料庫在mountopen狀態

RAC環境下必須使用DG_BROKER_CONFIG_FILEn(1,2)指定所有例項使用同一組configuration files(在共享儲存上)

RAC資料庫在OCR中設定START_OPTIONSMOUNT

Data Guard Broker and the SPFILE

資料庫必須使用spfile啟動,以便Data Guard Broker能夠同步spfileconfiguration file中的設定。建議使用Data Guard Broker來更新資料庫的引數。

Data Guard Monitor: DMON Process

Server端的後臺程式,在啟動broker時建立,用於完成各項操作,在多個DMON間進行互動,更新configuration file

Data Guard Monitor: Configuration File

Broker啟動時在預設路徑自動建立,可透過DG_BROKER_CONFIG_FILEn引數來修改檔名。由DMON進行自動維護,存在兩份,互為備份。

2. Creating a Configuration and Physical Standby Database by Using Enterprise Manager

3. Creating a Physical Standby Database by Using SQL

Steps to Create a Physical Standby Database

1. Prepare the primary database.

a) Database一級enable force logging

b) 建立密碼檔案

c) 設定初始化引數

LOG_ARCHIVE_CONFIG='DG_CONFIG=(chicago,boston)'

LOG_ARCHIVE_DEST_2='SERVICE=boston

VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)

DB_UNIQUE_NAME=boston'

LOG_ARCHIVE_DEST_STATE_2=ENABLE

DB_FILE_NAME_CONVERT

LOG_FILE_NAME_CONVERT

STANDBY_FILE_MANAGEMENT=auto

ARCHIVE_LAG_TARGET

LOG_ARCHIVE_TRACE

d) 開啟歸檔

2. Back up the primary database.

資料庫全備&standby controlfile

3. Copy files to the standby system.

資料庫全備、standby controlfilepfile

4. Set parameters on the physical standby database.

DB_UNIQUE_NAME=boston

SERVICE_NAMES=boston

CONTROL_FILES='/arch1/boston/control1.ctl','/arch2/boston/control2.ctl'

DB_FILE_NAME_CONVERT= '/arch1/chicago/','/arch1/boston/',

'/arch2/chicago/','/arch2/boston/'

LOG_FILE_NAME_CONVERT='/arch1/chicago/','/arch1/boston/',

'/arch2/chicago/','/arch2/boston/'

LOG_ARCHIVE_DEST_1= 'LOCATION=/arch1/boston/

VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=boston'

LOG_ARCHIVE_DEST_2= 'SERVICE=chicago

VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=chicago'

INSTANCE_NAME=boston

FAL_SERVER=chicago

FAL_CLIENT=boston

STANDBY_ARCHIVE_DEST = '/standby/arc_dest/'override log_archive_dest_n

Windows平臺上建立服務

建立密碼檔案

為主備資料庫配置listener和網路服務名

standby建立spfile

5. Start the standby database.

恢復備份,啟動例項,啟到managed standby方式

6. Additional Configuration Tasks

建立standby redo log

enable real-time apply

enable flashback database

upgrade the data protection mode

使用data gurad broker配置standby configuration(已有standby

1. 設定DG_BROKER_START=TRUE

2. 建立configuration

$ dgmgrl

DGMGRL> CONNECT sys/;

DGMGRL> CREATE CONFIGURATION 'DRSolution' AS

> PRIMARY DATABASE IS 'North_Sales'

> CONNECT IDENTIFIER IS North_Sales.foo.com;

3. configuration中新增standby

DGMGRL> ADD DATABASE 'DR_Sales' AS

> CONNECT IDENTIFIER IS DR_Sales.foo.com

> MAINTAINED AS PHYSICAL;

4. Setting Database Properties

DGMGRL> EDIT DATABASE 'DR_Sales' SET PROPERTY

> 'LogArchiveFormat'='log_%t_%s_%r_%d.arc';

檢視DGMGRL> SHOW DATABASE VERBOSE 'DR_Sales';

5. Enabling the Configuration and Databases

DGMGRL> ENABLE CONFIGURATION;

4. Configuring Data Protection Modes and Redo Transport Services

Defining the Redo Transport Mode

ARCH and LGWR-使用ARCHLGWR程式進行redo的傳輸

SYNC and ASYNC (LGWR only)-網路I/O的同步或非同步

AFFIRM and NOAFFIRM-磁碟I/O的同步或非同步

Data Protection Modes

Maximum Protection: standby redo logs, SYNC, LGWR, AFFIRM

Maximum Availability: standby redo logs, SYNC, LGWR, AFFIRM

Maximum Performance: LGWR&ASYNC or ARCH

Setting the Data Protection Mode

升級保護模式要求重啟primary資料庫,降級則不需要

1. 使用EM

2. 使用CLI(首先建立standby redo

DGMGRL> EDIT DATABASE 'site1_edrsr8p1' SET PROPERTY 'LogXptMode'='SYNC';

DGMGRL> EDIT CONFIGURATION SET PROTECTION MODE AS MAXAVAILABILITY;

3. 使用SQL

首先設定相關引數

ALTER DATABASE SET STANDBY TO MAXIMIZE PROTECTION;

Delaying the Application of Redo

可避免一些Data corruptionuser errors

使用log_archive_dest_n中的delay選項(分鐘)

可使用flashback database來實現同樣的目的

Additional Attributes That Affect Redo Transport Services

ALTERNATE: 設定一個alternate destRequire REOPEN=0 or MAX_FAILURE

DEPENDENCY

MAX_FAILURE: 重試次數,Requires REOPEN

NET_TIMEOUT: 設定一個比預設值更小的超時,在最大保護模式下慎用

REOPEN: 兩次重試之間的時間(秒),設定為0則不重試

Enabling Multiple Connections for Remote Archival of Redo

設定MAX_CONNECTIONS,使得歸檔檔案可以並行傳輸。

必須保證LOG_ARCHIVE_MAX_PROCESSES足夠大。

注:logical standby暫時無視

[@more@]

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/8558093/viewspace-1015161/,如需轉載,請註明出處,否則將追究法律責任。

相關文章