当前位置:  数据库>oracle

RAC primary+Single standby DG配置实践

    来源: 互联网  发布时间:2017-05-06

    本文导语:  很久之前做的实验,今天存档一下: 说明: RAC primary和Single standby配置 2节点RAC和1个single instance组成的data guard环境。 1.环境介绍 Primary database是一个两节的RAC,存储采用raw和ASM混合的方式,具体如下 RAC Primary Inode1 Inode2 Pub...

很久之前做的实验,今天存档一下:

说明:

RAC primary和Single standby配置

2节点RAC和1个single instance组成的data guard环境。

1.环境介绍

Primary database是一个两节的RAC,存储采用raw和ASM混合的方式,具体如下

RAC Primary

Inode1

Inode2

Public IP

172.28.22.246

172.28.22.247

Private IP

172.28.7.70

172.28.7.244

Virtual IP

172.28.22.248

172.28.22.249

Instance

Orcl1

Orcl2

DB_NAME

orcl

Data,Controle file,Redo file

Raw,ASM

Standby database的数据文件放在本地,不用raw和ams方式,具体如下

Single instance standby

说明(inode2)

IP

172.28.7.244

Oracle

安装的非RAC版本

Instance

orcl

Data,Controle file,Redo file

/home/orastd/oradata/orcl

注:因为条件限制,这个实例里的standby database也装在inode2机器上,只是在不同的系统用户下安装的单实例引擎。

2.配置要点

本例中包括了switchover过程,下面按照switchover前后进行介绍。

switchover之前,这时RAC是primary database.

(1) RAC 每个实例都要配置日志发送,日的地都指向standby

(2) 确认日志发送方法,本例使用了默认同步方式,ARCH进程

(3) standby配置日志接收方法,本例使用standby redo log

(4) 启动MRP

switchover之后,这时RAC是standby database.

如果standby是RAC,则日志的接收和恢复可不是同一个instance,术语上把这个两个实例分别叫做receive instance和recover instance.

本例为简化,把二者都统一为一个instance。

(1) single instance的日志只发送到RAC的一个实例

(2) 确认RAC的日志接收方法,本例使用standby redo log

(3) 在RAC的一个实例上启动MRP

3.配置步骤

(1) 配置两个数据库的tnsnames.ora和listener.ora

RAC(rac1,rac2)和standby(orcl)上的tnsnames.ora相同,如下:

ORCL_SINGLE =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.28.7.244)(PORT = 1522))

    )

    (CONNECT_DATA =

      (SID = orcl)

    )

  )

 

ORCL2 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = inode2-vip)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

      (INSTANCE_NAME = orcl2)

    )

  )

 

ORCL1 =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = inode1-vip)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = orcl)

      (INSTANCE_NAME = orcl1)

    )

  )

 

standby上的listener.ora

inode2:orastd:orcl:/home/orastd/product/10.2.0/db_1/network/admin> more listener.ora

LISTENER =

  (ADDRESS_LIST =

    (ADDRESS = (PROTOCOL = TCP)(Host = 172.28.7.244)(Port = 1522))

  )

 

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = orcl)

      (ORACLE_HOME = /home/orastd/product/10.2.0/db_1)

      (SID_NAME = orcl)

    )

  )

 

(2) 准备参数文件

原始的RAC参数文件如下

orcl2.__db_cache_size=142606336

orcl2.__java_pool_size=4194304

orcl1.__java_pool_size=4194304

orcl2.__large_pool_size=4194304

orcl1.__large_pool_size=4194304

orcl1.__shared_pool_size=117440512

orcl2.__shared_pool_size=138412032

orcl2.__streams_pool_size=0

orcl1.__streams_pool_size=0

*.audit_file_dest='/db/oracle/admin/orcl/adump'

*.background_dump_dest='/db/oracle/admin/orcl/bdump'

*.cluster_database_instances=2

*.cluster_database=TRUE

*.compatible='10.2.0.1.0'

*.control_files='/dev/rcontrol1_raw','/dev/rcontrol2_raw','/dev/rcontrol3_raw'

*.core_dump_dest='/db/oracle/admin/orcl/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.db_recovery_file_dest_size=2147483648

*.db_recovery_file_dest='+DG1'

*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'

orcl2.instance_number=2

orcl1.instance_number=1

*.job_queue_processes=10

*.log_archive_config=''

*.log_archive_dest_1='location=/db/oracle'

orcl1.log_archive_dest_1='location=/db/arch1'

orcl2.log_archive_dest_1='location=/db/arch2'

orcl2.log_archive_dest_2='service=orcl1'

orcl1.log_archive_dest_2='service=orcl2'

*.open_cursors=300

*.pga_aggregate_target=96468992

*.processes=150

*.remote_listener='LISTENERS_ORCL'

*.remote_login_passwordfile='exclusive'

*.sga_target=290455552

orcl2.standby_archive_dest='/db/arch1'

orcl1.standby_archive_dest='/db/arch2'

*.standby_file_management='AUTO'

orcl2.thread=2

orcl1.thread=1

*.undo_management='AUTO'

orcl2.undo_tablespace='UNDOTBS2'

orcl1.undo_tablespace='UNDOTBS1'

 

RAC原参数不变,添加如下参数:

*.log_archive_config='DG_CONFIG=(orcl,orcl_single)'

*.log_archive_dest_3='SERVICE=orcl_single VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl_single'

*.db_file_name_convert='/home/orastd/oradata/orcl/','+DG3/orcl/datafile/','/home/orastd/oradata/orcl/','/dev/'

*.log_file_name_convert='/home/orastd/oradata/orcl/','+DG3/orcl/onlinelog/'

*.standby_file_management=AUTO

*.FAL_SERVER='orcl_single'

orcl1.FAL_CLIENT='orcl1'

orcl2.FAL_CLIENT='orcl2'

 

注意:

db_file_name_convert、log_file_name_convert是做主备切换时用到,如果不做主备切换这两参数可以不配,而且其它参数可以动态修改,不用重启生效。这两参数要重启后才能生效。

为了文件存储格式的,这两参数的值是成对出现的。

在ASM的RAC中不要更改db_unique_name的值,因为ASM的文件存储方式是按些值存放的。

 

single standby上的参数initorcl.ora配置:

*.__db_cache_size=150994944

*.__java_pool_size=4194304

*.__large_pool_size=4194304

*.__shared_pool_size=130023424

*.__streams_pool_size=0

 

*.compatible='10.2.0.1.0'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='orcl'

*.db_recovery_file_dest_size=2147483648

*.dispatchers='(PROTOCOL=TCP)(SERVICE=orclXDB)'

*.job_queue_processes=10

*.open_cursors=300

*.pga_aggregate_target=96468992

*.processes=150

*.remote_login_passwordfile='exclusive'

*.sga_target=290455552

*.undo_management='AUTO'

 

#要修改的参数

*.control_files='/home/orastd/oradata/orcl/stdcrl.ctl'

*.log_archive_config='DG_CONFIG=(orcl,orcl_single)'

*.standby_archive_dest='/home/orastd/arch'

*.log_archive_dest_1='location=/home/orastd/arch'

*.log_archive_dest_2='service=orcl1 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl'

*.db_file_name_convert='/dev/','/home/orastd/oradata/orcl/','+DG3/orcl/datafile/','/home/orastd/oradata/orcl/'

*.log_file_name_convert='/dev/','/home/orastd/oradata/orcl/'

*.standby_file_management='AUTO'

fal_server='orcl1','orcl2'

fal_client='orcl_single'

thread=1

undo_tablespace='UNDOTBS1'

*.core_dump_dest='/home/orastd/admin/orcl/cdump'

*.audit_file_dest='/home/orastd/admin/orcl/adump'

*.background_dump_dest='/home/orastd/admin/orcl/bdump'

*.user_dump_dest='/home/orastd/admin/orcl/udump'

 

##要添加的参数

db_unique_name='orcl_single'

service_name='orcl_single'

 

##要删除的参数,下面这些参数是RAC上特有的,可以删除。

*.cluster_database_instances=2

*.cluster_database=TRUE

orcl2.instance_number=2

orcl1.instance_number=1

*.remote_listener='LISTENERS_ORCL'

*.db_recovery_file_dest='+DG1'

 

(3) 在RAC上进行备份

inode2:oracle:orcl2:/db/oracle> rman target /

inode2:oracle:orcl2:/db/oracle/product/10.2.0/db_1/dbs> rman target /

 

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Feb 23 15:26:01 2011

 

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

 

connected to target database: ORCL (DBID=1268210488)

 

RMAN> backup database format '/db/dbback/%U';

....

 

(4) 创建standby的控制文件

在RAC两实例上进行几次归档

SQL>alter system switch logfile;

 

SQL>alter database create standby controlfile as '/db/dbback/stdcrl.ctl';

 

(5) 把所以备份拷贝到standby服务器的相同目录下

因为standby库和rac2在相同的服务器inode2上,所以这步可以省略。

只需要把stdcrl.ctl拷贝到指定的目录,并赋权限:

 

inode2:root::/db/dbback> ls

4bm5ajul_1_1  4cm5ajul_1_1  stdcrl.ctl

inode2:root::/db/dbback> chown orastd:dba /db/dbback/*

inode2:root::/db/dbback> ls -l

total 2057968

-rw-r-----   1 orastd   dba       487129088 Feb 22 15:55 4bm5ajul_1_1

-rw-r-----   1 orastd   dba       554999808 Feb 22 15:55 4cm5ajul_1_1

-rw-r-----   1 orastd   dba        11550720 Feb 22 16:02 stdcrl.ctl

inode2:root::/db/dbback>cp stdcrl.ctl /home/orastd/oradata/orcl/

 

 

(6) 启动standby到nomount状态

创建密码文件:

inode2:orastd:orcl:/home/orastd/>orapwd password=oracle file=orapworcl entries=30

 

启动数据库,创建spfile文件:

 

分别用下面两种方式把实例启动到nmount状态:

inode2:orastd:orcl:/home/orastd/product/10.2.0/db_1/network/admin> sqlplus "/as sysdba"

 

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 23 10:03:40 2011

 

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

 

Connected to an idle instance.

 

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area  293601280 bytes

Fixed Size                  2020392 bytes

Variable Size             138415064 bytes

Database Buffers          150994944 bytes

Redo Buffers                2170880 bytes

SQL> exit

 

inode2:orastd:orcl:/home/orastd/product/10.2.0/db_1/network/admin> sqlplus sys/oracle@ORCL_SINGLE as sysdba

 

SQL*Plus: Release 10.2.0.1.0 - Production on Wed Feb 23 10:04:12 2011

 

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

 

Connected to an idle instance.

 

SQL> startup nomount

ORACLE instance started.

 

Total System Global Area  293601280 bytes

Fixed Size                  2020392 bytes

Variable Size             138415064 bytes

Database Buffers          150994944 bytes

Redo Buffers                2170880 bytes

SQL> create spfile from pfile;

file created.

 

 

(7) 用rman创建standby数据库

 

在RAC orcl2实例上做还原恢复操作:

inode2:oracle:orcl2:/db/oracle/product/10.2.0/db_1/network/admin> rman target / auxiliary sys/oracle@ORCL_SINGLE

 

Recovery Manager: Release 10.2.0.1.0 - Production on Wed Feb 23 10:19:52 2011

 

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

 

connected to target database: ORCL (DBID=1268210488)

connected to auxiliary database: ORCL (not mounted)

 

RMAN> duplicate target database for standby;

 

Starting Duplicate Db at 23-FEB-11

using target database control file instead of recovery catalog

allocated channel: ORA_AUX_DISK_1

channel ORA_AUX_DISK_1: sid=156 devtype=DISK

allocated channel: ORA_AUX_DISK_2

channel ORA_AUX_DISK_2: sid=155 devtype=DISK

 

contents of Memory Script:

{

   restore clone standby controlfile;

   sql clone 'alter database mount standby database';

}

executing Memory Script

 

Starting restore at 23-FEB-1

.............

 

datafile 5 switched to datafile copy

input datafile copy recid=29 stamp=743855043 filename=/home/orastd/oradata/orcl/rundotbs2_raw

datafile 6 switched to datafile copy

input datafile copy recid=30 stamp=743855044 filename=/home/orastd/oradata/orcl/lcz.256.743266487

datafile 7 switched to datafile copy

input datafile copy recid=31 stamp=743855044 filename=/home/orastd/oradata/orcl/lcz.257.743186313

datafile 8 switched to datafile copy

input datafile copy recid=32 stamp=743855044 filename=/home/orastd/oradata/orcl/ts.258.743273077

Finished Duplicate Db at 23-FEB-11

 

RMAN> exit

 

Recovery Manager complete


    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • RAC +GPFS添加节点的问题~~~~~~~~~~~~·
  • Linux Oracle RAC内核参数
  • Linux下Oracle RAC一个节点宕机导致共享存储无法挂载的故障排除
  • Oracle RAC 10.2.0.1升级到10.2.0.4
  • Oracle10201 RAC升级到10204后导出数据时报EXP-00056错误
  • [Oracle] RAC 之 - 负载均衡深入解析
  • RAC cache fusion机制实现原理分析
  • 基于Linux平台的Oracle RAC 10g集群教程:删除节点所需要的步骤
  • 如何在RAC环境下修改Oracle字符集
  • Oracle RAC 状态检查
  • redhat 5.5全新安装oracle rac的问题[1000分]
  • oracle 11g RAC 常用命令整理分享
  • Oracle 10201 RAC升级到10204
  • Redflag Linux安装Oracle 10gR2 RAC记事
  • 基于Linux平台的Oracle RAC 10g集群教程:添加节点所需要的步骤


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,