Home >Database >Mysql Tutorial >超详细的Data Guard之physical standby 搭建

超详细的Data Guard之physical standby 搭建

WBOY
WBOYOriginal
2016-06-07 17:32:141015browse

Data Guard 环境中Standby Database 主要有2种角色,physical standby 和logic standby,这里讲述 physical standby的搭建过程。

Data Guard 环境中Standby Database 主要有2种角色,physical standby 和logic standby,这里讲述 physical standby的搭建过程。

Data Guard提供了3种级别的保护模式,无论搭建physical standby还是logic standby,都需要考虑使用什么样的保护模式来保护数据,定义何种保护模式主要就是设置redo的传输方式。

(1)最大保护LGWR SYNC
(2)最高可用性LGWR SYNC
(3)最高性能 LGWR ASYNC 或ARCH

具体理论知识见我的文章:

软件环境:
虚拟机:VMware-Workstation-Full-8.0.0-471780
系统: rhel-server-5.4-i386
Oracle:linux_11gR1_database


ip地址:
primary:192.168.31.2
standby:192.168.31.3
实例名
primary:DGWH
standby:DGBJ


一,Data Guard搭建步骤
1.在vmware上安装2台linux虚拟机,按照上面要求设置好IP,然后在2台linux上分别安装oracle软件(linux_11gR2_database),在192.168.31.2创建好数据库实例名为DGWH,先保证实例DGWH能够正常运行,并且两台linux系统可以互相ping通。


2.在主数据库上激活FORCE LOGGING模式,想必大家知道有一些DDL 语句可以通过指定NOLOGGING 子句的方式避免写redo log(目的是提高速度,某些时候确实有效),指定数据库为FORCE LOGGING 模式后,数据库将会记录除临时表空间或临时回滚段外所有的操作而忽略类似NOLOGGING之类的指定参数。如果在执行force logging 时有nologging 之类的语句在执行,则force logging 会等待直到这类语句全部执行。FORCE LOGGING 是做为固定参数保存在控制文件中,因此其不受重启之类操作的影响(只执行一次即可),如果想取消,可以通过alter database no force logging 语句关闭强制记录。


SQL> alter database force logging;


Database altered.


3.配置主数据库为归档模式(如果已经归档模式这一步不需要)


SQL> archive log list;
Database log mode No Archive Mode //非归档
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Current log sequence 4


SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.


SQL> startup mount;
ORACLE instance started.


Total System Global Area 318046208 bytes
Fixed Size 1299652 bytes
Variable Size 239078204 bytes
Database Buffers 71303168 bytes
Redo Buffers 6365184 bytes
Database mounted.


SQL> alter database archivelog; //激活归档


Database altered.


SQL> alter database open;


Database altered.


4. 为备用数据库创建控制文件,需要重启实例到mount状态执行下列命令
SQL> select status from v$instance;


STATUS
------------
MOUNTED


SQL> alter database create standby controlfile as '/tmp/DGBJ.ctl';


Database altered. //创建standby controlfile


5. 在主数据库生成一个pfile文件,用于配置DG的相关属性(也可以直接通过alter system 语句修改)


SQL> create pfile from spfile;


File created.


6. 关闭数据库


SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.


7. 到$ORACLE_HOME/dbs下修改pifle文件initDGWH.ora,,用vi文本编辑器打开修改后的内容如下
DGWH.__db_cache_size=67108864
DGWH.__java_pool_size=12582912
DGWH.__large_pool_size=4194304
DGWH.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
DGWH.__pga_aggregate_target=130023424
DGWH.__sga_target=188743680
DGWH.__shared_io_pool_size=0
DGWH.__shared_pool_size=100663296
DGWH.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/DGWH/adump'
*.audit_trail='db'
*.compatible='11.1.0.0.0'
*.control_files='/u01/app/oracle/oradata/DGWH/controlfile/o1_mf_9361nfg6_.ctl','/u01/app/oracle/flash_recovery_area/DGWH/controlfile/o1_mf_9361nfpk_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_domain=''
*.db_name='DGWH'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=DGWHXDB)'
*.memory_target=316669952
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'


DB_UNIQUE_NAME=DGWH
LOG_ARCHIVE_CONFIG='DG_CONFIG=(DGWH,DGBJ)'
LOG_ARCHIVE_DEST_1='LOCATION=/u01/arch1/DGWH VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=DGWH'
LOG_ARCHIVE_DEST_2='SERVICE=DGBJ ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=DGBJ'
LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
FAL_SERVER=DGBJ
DB_FILE_NAME_CONVERT='DGWH','DGBJ'
LOG_FILE_NAME_CONVERT='/u01/arch1/DGWH','/u01/arch1/DGBJ'
STANDBY_FILE_MANAGEMENT=AUTO

相关参考:

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 处理方法

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn