当前位置:  数据库>oracle

Oracle 10g RAC环境下创建物理DATAGUARD

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

    本文导语: 为一个RAC搭建standby和单节点搭建方法基本一致,我们可以把RAC看成是一个单节点的数据库,只需要保证所有节点的日志能传送到备库即可。 一、在备库服务器安装Oracle软件 只安装软件,不要创建数据库。ORACLE软件版本和主库保...

为一个RAC搭建standby和单节点搭建方法基本一致,我们可以把RAC看成是一个单节点的数据库,只需要保证所有节点的日志能传送到备库即可。

一、在备库服务器安装Oracle软件

只安装软件,不要创建数据库。ORACLE软件版本和主库保持一致。

二、修改主库参数

节点1执行:

SQL> show parameter spfile


NAME TYPE VALUE

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

spfile string /dev/raw/raw14


节点2执行:

SQL> show parameter spfile


NAME TYPE VALUE

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

spfile string /dev/raw/raw14


可见,在本例中,RAC各节点共用一个spfile,所以,我们修改参数时,可以只需在一个节点下修改就可以了。


--强制数据库LOGGING

SQL> ALTER DATABASE FORCE LOGGING;


Database altered.

 


--修改DATAGUARD相关参数

SQL> ALTER SYSTEM SET DB_UNIQUE_NAME=primary scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(primary,standby)' scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/soft/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=primary' scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=standby LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby' scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_1=ENABLE scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_2=ENABLE scope=spfile;


System altered.


SQL> ALTER SYSTEM SET REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_FORMAT='%t_%s_%r.arc' scope=spfile;


System altered.


SQL> ALTER SYSTEM SET LOG_ARCHIVE_MAX_PROCESSES=4 scope=spfile;


System altered.

 


SQL> ALTER SYSTEM SET COMPATIBLE = '10.2.0.3' scope=spfile;


System altered.


--以下几个参数是为了SWITCH OVER用的,是可选参数。

--但是为了以后可能发生的SWITCH OVER更方便,应该养成设置这些参数的习惯

SQL> ALTER SYSTEM SET FAL_CLIENT = PRIMARY SCOPE=SPFILE;


System altered.


SQL> ALTER SYSTEM SET FAL_SERVER = STANDBY SCOPE=SPFILE;


System altered.


SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT =AUTO SCOPE=SPFILE;


System altered.


SQL> ALTER SYSTEM SET DB_FILE_NAME_CONVERT='/soft/oradata/rac/','/dev/raw/' SCOPE=SPFILE;


System altered.


SQL> ALTER SYSTEM SET LOG_FILE_NAME_CONVERT='/soft/oradata/rac/','/dev/raw/' SCOPE=SPFILE;


System altered.


--在本文测试环境下,由于主库和备库路径不一致,所以要设置路径转换参数。


三、修改主库为归档模式

1、--关闭所有实例

--注意:修改以上参数后,必须把所有实例都关闭。否则在启动实例的时候可能会导致错误:

--ORA-00600: internal error code, arguments: [kccsbck_first], [2], [2241198041],

[], [], [], [], []


SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

 


2、修改为归档模式

--关闭所有节点

SQL> shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.


--在其中一个节点启用归档

SQL> startup mount

ORACLE instance started.


Total System Global Area 159383552 bytes

Fixed Size 1260672 bytes

Variable Size 79692672 bytes

Database Buffers 75497472 bytes

Redo Buffers 2932736 bytes

Database mounted.

SQL> alter database archivelog;


Database altered.


SQL> alter database open;

 


Database altered.


10GR2以前,在RAC环境下修改归档必须先把设置参数cluster_database=false,把数据库设置为归档后再把该参数设置为true,但这个步骤在10GR2可以省略。

 


四、备份数据库

1、备份数据库

备份操作在节点1(rac1)上执行。

由于归档在不同的节点下,故要连接所有节点进行备份:

[oracle@rac1 ~]$ $ORACLE_HOME/bin/rman target /


Recovery Manager: Release 10.2.0.3.0 - Production on Wed Apr 30 14:48:23 2008


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


connected to target database: RAC (DBID=2232067446)


RMAN> run

2> {

3> allocate channel c1 device type disk format '/soft/backup/%U' connect sys/test@rac1;

4> allocate channel c2 device type disk format '/soft/backup/%U' connect sys/test@rac2;

5> backup database plus archivelog delete all input;

6> }


using target database control file instead of recovery catalog

allocated channel: c1

channel c1: sid=134 instance=rac1 devtype=DISK


allocated channel: c2

channel c2: sid=141 instance=rac2 devtype=DISK

 


Starting backup at 30-APR-08

current log archived

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=80 recid=1 stamp=653247673

input archive log thread=1 sequence=81 recid=4 stamp=653268228

input archive log thread=1 sequence=82 recid=5 stamp=653353066

channel c1: starting piece 1 at 30-APR-08

channel c2: starting archive log backupset

channel c2: specifying archive log(s) in backup set

input archive log thread=1 sequence=85 recid=13 stamp=653409646

input archive log thread=2 sequence=42 recid=2 stamp=653248818

input archive log thread=2 sequence=43 recid=3 stamp=653250118

input archive log thread=2 sequence=46 recid=10 stamp=653353763

input archive log thread=2 sequence=47 recid=11 stamp=653354798

input archive log thread=2 sequence=48 recid=12 stamp=653409644

input archive log thread=2 sequence=49 recid=16 stamp=653410122

channel c2: starting piece 1 at 30-APR-08

channel c2: finished piece 1 at 30-APR-08

piece handle=/soft/backup/02jf4fql_1_1 tag=TAG20080430T144854 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:05

channel c2: deleting archive log(s)

archive log filename=/soft/archivelog/1_85_644085430.arc recid=13 stamp=653409646

archive log filename=/soft/archivelog/2_42_644085430.arc recid=2 stamp=653248818

archive log filename=/soft/archivelog/2_43_644085430.arc recid=3 stamp=653250118

archive log filename=/soft/archivelog/2_46_644085430.arc recid=10 stamp=653353763

archive log filename=/soft/archivelog/2_47_644085430.arc recid=11 stamp=653354798

archive log filename=/soft/archivelog/2_48_644085430.arc recid=12 stamp=653409644

archive log filename=/soft/archivelog/2_49_644085430.arc recid=16 stamp=653410122

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/01jf4fqq_1_1 tag=TAG20080430T144854 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:14

channel c1: deleting archive log(s)

archive log filename=/soft/archivelog/1_80_644085430.arc recid=1 stamp=653247673

archive log filename=/soft/archivelog/1_81_644085430.arc recid=4 stamp=653268228

archive log filename=/soft/archivelog/1_82_644085430.arc recid=5 stamp=653353066

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=83 recid=6 stamp=653353068

input archive log thread=1 sequence=84 recid=9 stamp=653353575

input archive log thread=1 sequence=86 recid=14 stamp=653409966

input archive log thread=1 sequence=87 recid=15 stamp=653410123

input archive log thread=2 sequence=44 recid=7 stamp=653353071

input archive log thread=2 sequence=45 recid=8 stamp=653353072

channel c1: starting piece 1 at 30-APR-08

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/03jf4fr9_1_1 tag=TAG20080430T144854 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:02

channel c1: deleting archive log(s)

archive log filename=/soft/archivelog/1_83_644085430.arc recid=6 stamp=653353068

archive log filename=/soft/archivelog/1_84_644085430.arc recid=9 stamp=653353575

archive log filename=/soft/archivelog/1_86_644085430.arc recid=14 stamp=653409966

archive log filename=/soft/archivelog/1_87_644085430.arc recid=15 stamp=653410123

archive log filename=/soft/archivelog/2_44_644085430.arc recid=7 stamp=653353071

archive log filename=/soft/archivelog/2_45_644085430.arc recid=8 stamp=653353072

Finished backup at 30-APR-08


Starting backup at 30-APR-08

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

input datafile fno=00001 name=/dev/raw/raw1

input datafile fno=00005 name=/dev/raw/raw7

input datafile fno=00003 name=/dev/raw/raw2

channel c1: starting piece 1 at 30-APR-08

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

input datafile fno=00002 name=/dev/raw/raw3

input datafile fno=00004 name=/dev/raw/raw5

channel c2: starting piece 1 at 30-APR-08

channel c2: finished piece 1 at 30-APR-08

piece handle=/soft/backup/05jf4frg_1_1 tag=TAG20080430T144919 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:43

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

including current control file in backupset

channel c2: starting piece 1 at 30-APR-08

channel c2: finished piece 1 at 30-APR-08

piece handle=/soft/backup/06jf4ft0_1_1 tag=TAG20080430T144919 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:22

channel c2: starting full datafile backupset

channel c2: specifying datafile(s) in backupset

including current SPFILE in backupset

channel c2: starting piece 1 at 30-APR-08

channel c2: finished piece 1 at 30-APR-08

piece handle=/soft/backup/07jf4ftm_1_1 tag=TAG20080430T144919 comment=NONE

channel c2: backup set complete, elapsed time: 00:00:06

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/04jf4frg_1_1 tag=TAG20080430T144919 comment=NONE

channel c1: backup set complete, elapsed time: 00:01:13

Finished backup at 30-APR-08


Starting backup at 30-APR-08

current log archived

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=1 sequence=88 recid=17 stamp=653410237

channel c1: starting piece 1 at 30-APR-08

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/08jf4fv9_1_1 tag=TAG20080430T145120 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:04

channel c1: deleting archive log(s)

archive log filename=/soft/archivelog/1_88_644085430.arc recid=17 stamp=653410237

channel c1: starting archive log backupset

channel c1: specifying archive log(s) in backup set

input archive log thread=2 sequence=50 recid=18 stamp=653410279

channel c1: starting piece 1 at 30-APR-08

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/09jf4fvf_1_1 tag=TAG20080430T145120 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:04

channel c1: deleting archive log(s)

archive log filename=/soft/archivelog/2_50_644085430.arc recid=18 stamp=653410279

Finished backup at 30-APR-08

released channel: c1

released channel: c2

 


2、生成备库控制文件

RMAN> run

2> {

3> allocate channel c1 device type disk format '/soft/backup/CON_%U';

4> backup current controlfile for standby;

5> }


allocated channel: c1

channel c1: sid=131 instance=rac1 devtype=DISK


Starting backup at 30-APR-08

channel c1: starting full datafile backupset

channel c1: specifying datafile(s) in backupset

including standby control file in backupset

channel c1: starting piece 1 at 30-APR-08

channel c1: finished piece 1 at 30-APR-08

piece handle=/soft/backup/CON_0ajf4gqi_1_1 tag=TAG20080430T150554 comment=NONE

channel c1: backup set complete, elapsed time: 00:00:12

Finished backup at 30-APR-08

released channel: c1

为一个RAC搭建standby和单节点搭建方法基本一致,我们可以把RAC看成是一个单节点的数据库,只需要保证所有节点的日志能传送到备库即可。

 

 

 

五、备库环境准备


1、在备库添加指向主库的tnsnames

在备库的tnsnames.ora添加如下内容:

primary =

(DESCRIPTION =

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

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

(LOAD_BALANCE = yes)

(CONNECT_DATA =

(SERVER = DEDICATED)

(SERVICE_NAME = primary)

(FAILOVER_MODE =

(TYPE = SELECT)

(METHOD = BASIC)

(RETRIES = 180)

(DELAY = 5)

)

)

)2、在备库创建相关目录

包括adump,bdump,cdump,udump及数据文件目录等。

3、拷贝主库的密码文件到备库上

--拷贝rac1的密码文件到备库的$ORACLE_HOME/dbs下,并把该密码文件修改为orapwd。这里我的sid就用rac1,所以,不用改名。

[oracle@rac1 dbs]$ scp orapwrac1 172.25.0.35:`pwd`

orapwrac1 100% 1536 1.5KB/s 00:00


4、配置备库的监听

[oracle@standby admin]$ more listener.ora


SID_LIST_LISTENER =

(SID_LIST =

(SID_DESC =

(GLOBAL_DBNAME = standby)

(ORACLE_HOME = /opt/oracle/product/10.2/database)

(SID_NAME = rac1)

)

)


LISTENER =

(DESCRIPTION_LIST =

(DESCRIPTION =

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

)

(DESCRIPTION =

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

)

)


启动备库监听:lsnrctl start


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












  • 相关文章推荐
  • oracle 视图权限 oracle 创建视图权限不足
  • oracle 创建表空间步骤代码
  • Linux系统下创建第二个oracle数据库
  • oracle 创建数据库小知识
  • Oracle新手教程 手工创建数据库的全部脚本及说明
  • Oracle创建用户权限的过程
  • Oracle WebLogic Server 安装并创建域
  • Oracle 10g创建表空间和用户并指定权限
  • linux redhat5.6安装oracle11g在自动创建实例时停住不动,有图
  • oracle 创建表空间详细介绍
  • 在RedHat Advance Server下安装Oracle9i R2不能创建数据库问题
  • 在oracle数据库里创建自增ID字段的步骤
  • oracle创建删除用户示例分享(oracle删除用户命令及授权)
  • Oracle使用配置文件创建口令管理策略
  • oracle命令行删除与创建用户的代码
  • oracle删除主键查看主键约束及创建联合主键
  • Oracle 10g表空间创建的完整步骤
  • Oracle创建主键自增表(sql语句实现)及触发器应用
  • Oracle 创建监控账户 提高工作效率
  • Oracle11.2 命令行手工最简创建数据库的过程
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • oracle 11g最新版官方下载地址
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍


  • 站内导航:


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

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3