RAC+DG搭建过程

本文详细介绍了如何配置Oracle RAC+DG环境,包括RMAN全库备份、参数文件修改、standby控制文件恢复、备库日志应用等关键步骤。在搭建过程中,提到了检查监听、开启force logging模式、修正错误参数等环节,以及主备库的数据同步验证。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

环境描述


  节点1 节点2
Public IP 192.168.77.185 192.168.77.186
Private IP 192.168.56.101 192.168.56.102
VIP 192.168.77.187 192.168.77.188
scan IP 192.168.77.189  
     
备库IP  192.168.77.190  
     

配置RAC+DG的过程简述

(1)RMAN备份主库(全库备份,包括归档日志)。将RMAN备份,pfile参数文件,密码文件,standby控制文件拷贝至备库。

(2)在备库修改pfile参数文件,用RMAN在nomount状态下恢复standby控制文件,mount状态恢复数据库。

(3)备库开启日志应用

(4)修改主库参数(为failover或switchover准备)


具体步骤

(0)前期检查,查看数据库监听情况,及tnsnames.ora配置。

[oracle@racnode1 ~]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/
[oracle@racnode1 admin]$ ls
samples  shrept.lst  tnsnames.ora
[oracle@racnode1 admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

RACDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = racnode-cluster-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RACDB)
    )
  )

[oracle@racnode1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 24-AUG-2015 13:22:18

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

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                23-AUG-2015 18:58:20
Uptime                    0 days 18 hr. 23 min. 58 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/11.2.0/grid/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/racnode1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.77.185)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.77.187)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "RACDB" has 1 instance(s).
  Instance "RACDB_1", status READY, has 1 handler(s) for this service...
Service "RACDBXDB" has 1 instance(s).
  Instance "RACDB_1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@racnode1 admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 13:22:33 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> show parameter service

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      RACDB
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
[oracle@racnode1 admin]$ mkdir /rmanbak
mkdir: cannot create directory `/rmanbak': Permission denied
[oracle@racnode1 admin]$ exit
logout



(1)将RAC主库修改为归档模式,并开启force logging模式。

由于事先已经将数据库置为归档模式,故在此只需要修改force logging模式即可。


[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Aug 24 13:13:57 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> alter database force logging;

Database altered.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

(2)主库全备,创建standby control file,生成pfile文件,复制密码文件。然后将准备好的所有文件复制到备库所在目录(最好对应主库的备份目录,方便RMAN恢复。)


[root@racnode1 ~]# mkdir /rmanbak
[root@racnode1 ~]# chown oracle:oinstall /rmanbak/
[root@racnode1 ~]# su - oracle
[oracle@racnode1 ~]$ rman target / 

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Aug 24 13:27:15 2015

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

connected to target database: RACDB (DBID=883515518)
                                                                                         <span style="color:#ff0000;"><strong>----------------------备份数据库和归档</strong></span>
RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> backup database format '/rmanbak/FULL_%U.bak';
7> backup archivelog all format '/rmanbak/ARC_%U.bak';
8> release channel c1;
9> release channel c2;
10> release channel c3;
11> release channel c4;
12> }

released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=155 instance=RACDB_1 device type=DISK

allocated channel: c2
channel c2: SID=24 instance=RACDB_1 device type=DISK

allocated channel: c3
channel c3: SID=29 instance=RACDB_1 device type=DISK

allocated channel: c4
channel c4: SID=158 instance=RACDB_1 device type=DISK

Starting backup at 24-AUG-15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00006 name=+DATADG/racdb/datafile/data01.269.886180153
channel c1: starting piece 1 at 24-AUG-15
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00002 name=+DATADG/racdb/datafile/sysaux.261.885898927
input datafile file number=00005 name=+DATADG/racdb/datafile/users.265.885899091
channel c2: starting piece 1 at 24-AUG-15
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
input datafile file number=00003 name=+DATADG/racdb/datafile/undotbs1.262.885898975
input datafile file number=00007 name=+DATADG/racdb/datafile/index01.270.886180183
channel c3: starting piece 1 at 24-AUG-15
channel c4: starting full datafile backup set
channel c4: specifying datafile(s) in backup set
input datafile file number=00001 name=+DATADG/racdb/datafile/system.260.885898771
input datafile file number=00004 name=+DATADG/racdb/datafile/undotbs2.264.885899061
channel c4: starting piece 1 at 24-AUG-15
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0gqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c2: backup set complete, elapsed time: 00:02:54
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0fqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c1: backup set complete, elapsed time: 00:03:29
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
including current SPFILE in backup set
channel c1: starting piece 1 at 24-AUG-15
channel c3: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0hqfdgi0_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c3: backup set complete, elapsed time: 00:03:30
channel c4: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0iqfdgi6_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c4: backup set complete, elapsed time: 00:02:48
channel c1: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0kqfdgoh_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
including current control file in backup set
channel c2: starting piece 1 at 24-AUG-15
channel c2: finished piece 1 at 24-AUG-15
piece handle=/rmanbak/FULL_0jqfdgni_1_1.bak tag=TAG20150824T134016 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 24-AUG-15

Starting backup at 24-AUG-15
current log archived
channel c1: starting archived log backup set
channel c1: specifying archived log(s) in backup set
input archived log thread=1 sequence=148 RECID=3 STAMP=888506477
input archived log thread=2 sequence=47 RECID=1 STAMP=888506297
input archived log thread=2 sequence=48 RECID=2 STAMP=888506471
input archived log thread=2 sequence=49 RECID=5 STAMP=888507728
input archived log thread=1 sequence=149 RECID=4 STAMP=888507693
input archived log thread=1 sequence=150 RECID=6 STAMP=888507767
channel c1: starting piece 1 at 24-AUG-15
channel c2: starting archived log backup set
channel c2: specifying archived log(s) in backup set
input archived log thread=2 sequence=50 RECID=8 STAMP=888507794
input archived log thread=1 sequence=151 RECID=7 STAMP=888507769
input archived log thread=1 sequence=152 RECID=11 STAMP=888507797
input archived log thread=2 sequence=51 RECID=9 STAMP=888507796
input archived log thread=2 sequence=52 RECID=10 STAMP=888507797
input archived log thread=2 sequence=53 RECID=13 STAMP=888510307
channel c2: starting piece 1 at 24-AUG-15
channel c
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值