热门标签 | HotTags
当前位置:  开发笔记 > 数据库 > 正文

最简单的11gActiveDataGuard(ADG)搭建配置过程(项目步骤)

我在db01和db02两台Linux虚拟机上首先分别安装了一套数据库软件,在db01主机上创建了名为woo的数据库;我们这次的实验是要搭建了

我在db01和db02两台Linux虚拟机上首先分别安装了一套数据库软件,在db01主机上创建了名为woo的数据库;我们这次的实验是要搭建了

一、环境介绍:
我在db01和db02两台Linux虚拟机上首先分别安装了一套数据库软件,,在db01主机上创建了名为woo的数据库;我们这次的实验是要搭建了一套Oracle 11g Active DataGuard;目的是为了实现数据库同步的功能,并且了解Oracle 11g DG的基本功能。

db01:192.168.1.50
db02:192.168.1.51

Oracle 11g Active DataGuard初探

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

二、11g ADG部署:

1、pri端和sty端配置静态监听

[oracle@sty admin]$ cat listener.ora

# listener.ora Network Configuration File: /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /DBSoft/oracle/product/11.2.4/dbhome_1)

(PROGRAM = extproc)

)

(SID_DESC =

(SID_NAME = Woo )

(ORACLE_HOME = /DBSoft/oracle/product/11.2.4/dbhome_1)

)

)

[oracle@sty admin]$cat tnsname.ora

# tnsnames.ora Network Configuration File: /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

STY =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.51)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = woo)

)

)

PRI =

(DESCRIPTION =

(ADDRESS_LIST =

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.50)(PORT = 1521))

)

(CONNECT_DATA =

(SERVICE_NAME = woo)

)

)

2、修改primary端初始化参数文件

startup mount;

alter database archivelog;

alter database force logging;

alter database open;

alter system set log_archive_cOnfig= 'DG_COnFIG=(pri,sty)' scope=spfile;

alter system set log_archive_dest_1 = 'LOCATION=/DBBackup/Archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=pri' scope=spfile;

alter system set log_archive_dest_2 = 'SERVICE=sty LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=sty' scope=spfile;

alter system set log_archive_dest_state_1 = ENABLE;

alter system set log_archive_dest_state_2 = ENABLE;

alter system set fal_server=sty scope=spfile;

alter system set fal_client=pri scope=spfile;

alter system set standby_file_management=AUTO scope=spfile;

3、在primary端pfile参数文件和密码文件,并且拷贝到standby段相应位置

SQL> create pfile from spfile;

File created.

[oracle@db01 dbs]$ scp initwoo.ora orapwwoo db02:/DBSoft/oracle/product/11.2.4/dbhome_1/dbs

oracle@192.168.1.51's password:
initwoo.ora 100% 1260 1.2KB/s 00:00
orapwwoo 100% 1536 1.5KB/s 00:00

[oracle@db01 oracle]$ scp -r admin/ diag/ fast_recovery_area/ oradata/ 192.168.1.51:$ORACLE_BASE
oracle@192.168.1.51's password:
init.ora.512201522543 100% 1778 1.7KB/s 00:01
dp.log 100% 116 0.1KB/s 00:00
........

4、修改standby端的监听文件及初始化参数文件

--修改监听文件

[oracle@db02 ~]$ cd $ORACLE_HOME/network/admin

[oracle@db02 admin]$ vi listener.ora

# listener.ora Network Configuration File: /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

(ADDRESS = (PROTOCOL = TCP)(HOST = db02)(PORT = 1521))

)

)

SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(SID_NAME = PLSExtProc)

(ORACLE_HOME = /DBSoft/oracle/product/11.2.4/dbhome_1)

(PROGRAM = extproc)

)

(SID_DESC =

(GLOBAL_DBNAME = woo)

(ORACLE_HOME = /DBSoft/oracle/product/11.2.4/dbhome_1)

(SID_NAME = woo)

)

)

ADR_BASE_LISTENER = /DBSoft/oracle

--启动监听

[oracle@db02 dbs]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-JUN-2015 21:29:57

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Starting /DBSoft/oracle/product/11.2.4/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/listener.ora

Log messages written to /DBSoft/oracle/diag/tnslsnr/db02/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db02)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date 17-JUN-2015 21:29:57

Uptime 0 days 0 hr. 0 min. 1 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/listener.ora

Listener Log File /DBSoft/oracle/diag/tnslsnr/db02/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db02)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "woo" has 1 instance(s).

Instance "woo", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

--查看监听状态

[oracle@db02 dbs]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-JUN-2015 21:30:02

Copyright (c) 1991, 2013, Oracle. All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date 17-JUN-2015 21:29:57

Uptime 0 days 0 hr. 0 min. 4 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /DBSoft/oracle/product/11.2.4/dbhome_1/network/admin/listener.ora

Listener Log File /DBSoft/oracle/diag/tnslsnr/db02/listener/alert/log.xml

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db02)(PORT=1521)))

Services Summary...

Service "PLSExtProc" has 1 instance(s).

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

Service "woo" has 1 instance(s).

Instance "woo", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

[oracle@db02 dbs]$

--修改参数文件

[oracle@db02 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Wed Jun 17 21:35:54 2015

Copyright (c) 1982, 2013, Oracle. All rights reserved.

Connected to an idle instance.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 1188511744 bytes

Fixed Size 1364228 bytes

Variable Size 754978556 bytes

Database Buffers 419430400 bytes

Redo Buffers 12738560 bytes

SQL> create spfile from pfile='/DBSoft/oracle/product/11.2.4/dbhome_1/dbs/initwoo.ora';

File created.

SQL>

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup nomount;

ORACLE instance started.

Total System Global Area 1188511744 bytes

Fixed Size 1364228 bytes

Variable Size 754978556 bytes

Database Buffers 419430400 bytes

Redo Buffers 12738560 bytes

SQL>

alter system set db_unique_name=sty scope=spfile;

alter system set log_archive_cOnfig='DG_COnFIG=(pri,dg)' scope=spfile;

alter system set log_archive_dest_1 ='LOCATION=/DBBackup/Archive VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=sty' scope=spfile;

alter system set log_archive_dest_2 ='SERVICE=pri LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=pri' scope=spfile;

alter system set fal_server=pri scope=spfile;

alter system set fal_client=sty scope=spfile;

SQL> shutdown abort;

ORACLE instance shut down.

SQL> startup nomount

ORACLE instance started.

Total System Global Area 1188511744 bytes

Fixed Size 1364228 bytes

Variable Size 754978556 bytes

Database Buffers 419430400 bytes

Redo Buffers 12738560 bytes

SQL>

SQL>

5、在primary端通过Rman Duplicate创建备库,在db01上执行如下命令

rman target sys/oracle@pri auxiliary sys/oracle@sty nocatalog
duplicate target database for standby from active database nofilenamecheck;

[oracle@db01 ~]$ rman target sys/oracle@pri auxiliary sys/oracle@sty nocatalog

Recovery Manager: Release 11.2.0.4.0 - Production on Wed Jun 17 22:33:54 2015

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: WOO (DBID=4221729487)
using target database control file instead of recovery catalog
connected to auxiliary database: WOO (not mounted)

RMAN>

RMAN> duplicate target database for standby from active database nofilenamecheck;

Starting Duplicate Db at 17-JUN-15
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK

推荐阅读
  • 如何在Oracle ASM_Diskgroup中重命名现有磁盘
    如何在Oracle ASM_Diskgroup中重命名现有磁盘 ... [详细]
  • 字节跳动深圳研发中心安全业务团队正在火热招募人才! ... [详细]
  • 在Ubuntu 20.04 Linux系统中部署Git的详细步骤与最佳实践
    在Ubuntu 20.04 Linux系统中部署Git时,首先确保您的操作系统版本正确,并已以具备sudo权限的用户身份登录。推荐使用APT软件包管理器进行安装,这是最简便且可靠的方法。此外,遵循最佳实践,如定期更新Git版本和配置全局设置,可以进一步提升使用体验和安全性。 ... [详细]
  • 如何在Android项目中正确导入和配置MySQL数据库驱动 ... [详细]
  • 如何在PHP中有效实现和管理互斥锁机制(PHP锁) ... [详细]
  • 在多模块项目中,项目A作为一个独立的工具包,不依赖于任何第三方库。其目录结构如下:`--src--main--java--resources`。当将项目A打包成JAR文件后,发现无法正确访问`resources`目录下的文件资源。这一问题可能源于JAR文件的构建配置或类路径设置不当,需要仔细检查Maven或Gradle的构建脚本,确保资源文件被正确包含并加载。 ... [详细]
  • Python与R语言在功能和应用场景上各有优势。尽管R语言在统计分析和数据可视化方面具有更强的专业性,但Python作为一种通用编程语言,适用于更广泛的领域,包括Web开发、自动化脚本和机器学习等。对于初学者而言,Python的学习曲线更为平缓,上手更加容易。此外,Python拥有庞大的社区支持和丰富的第三方库,使其在实际应用中更具灵活性和扩展性。 ... [详细]
  • SQL Server开发技巧:修改表结构后的视图批量更新方法与实践 ... [详细]
  • Spring Boot 实战(一):基础的CRUD操作详解
    在《Spring Boot 实战(一)》中,详细介绍了基础的CRUD操作,涵盖创建、读取、更新和删除等核心功能,适合初学者快速掌握Spring Boot框架的应用开发技巧。 ... [详细]
  • 本文详细介绍了使用响应文件在静默模式下安装和配置Oracle 11g的方法。硬件要求包括:内存至少1GB,具体可通过命令`grep -i memtotal /proc/meminfo`进行检查。此外,还提供了详细的步骤和注意事项,确保安装过程顺利进行。 ... [详细]
  • 作为140字符的开创者,Twitter看似简单却异常复杂。其简洁之处在于仅用140个字符就能实现信息的高效传播,甚至在多次全球性事件中超越传统媒体的速度。然而,为了支持2亿用户的高效使用,其背后的技术架构和系统设计则极为复杂,涉及高并发处理、数据存储和实时传输等多个技术挑战。 ... [详细]
  • 在Hive中合理配置Map和Reduce任务的数量对于优化不同场景下的性能至关重要。本文探讨了如何控制Hive任务中的Map数量,分析了当输入数据超过128MB时是否会自动拆分,以及Map数量是否越多越好的问题。通过实际案例和实验数据,本文提供了具体的配置建议,帮助用户在不同场景下实现最佳性能。 ... [详细]
  • 在Linux环境下编译安装Heartbeat时,常遇到依赖库缺失的问题。为确保顺利安装,建议预先通过yum安装必要的开发库,如glib2-devel、libtool-ltdl-devel、net-snmp-devel、bzip2-devel和ncurses-devel等。这些库是编译过程中不可或缺的组件,能够有效避免编译错误,确保Heartbeat的稳定运行。 ... [详细]
  • 当前,众多初创企业对全栈工程师的需求日益增长,但市场中却存在大量所谓的“伪全栈工程师”,尤其是那些仅掌握了Node.js技能的前端开发人员。本文旨在深入探讨全栈工程师在现代技术生态中的真实角色与价值,澄清对这一角色的误解,并强调真正的全栈工程师应具备全面的技术栈和综合解决问题的能力。 ... [详细]
  • 在处理历史交易表时,发现存在部分重复交易记录,需进行数据清理。为解决此问题,考虑构建一个临时表,并采用SQL Server ODBC工具进行数据的导入与导出操作,以实现高效去重。此外,建议结合索引优化和批处理技术,进一步提升数据处理效率和系统性能。 ... [详细]
author-avatar
Missluckyyy_879
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有