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
• 主数据库为归档模式
• 所有数据库在mount或open状态
• RAC环境下必须使用DG_BROKER_CONFIG_FILEn(1,2)指定所有实例使用同一组configuration files(在共享存储上)
• 在RAC数据库在OCR中设置START_OPTIONS为MOUNT
Data Guard Broker and the SPFILE
数据库必须使用spfile启动,以便Data Guard Broker能够同步spfile和configuration 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 controlfile、pfile
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-使用ARCH或LGWR进程进行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 corruption或user errors
使用log_archive_dest_n中的delay选项(分钟)
可使用flashback database来实现同样的目的
Additional Attributes That Affect Redo Transport Services
ALTERNATE: 设置一个alternate dest,Require 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/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/8558093/viewspace-1015161/