RAC归档存储方案:交叉互备

本文涉及的产品
日志服务 SLS,月写入数据量 50GB 1个月
简介:

1、测试环境

10.2.0.1.0  on 2.6.18-53.el5
    192.168.1.101        rac1        
    192.168.1.102        rac2

2、RAC归档一般放在所有节点都可以看到的地方,方便RMAN发现所有的归档日志。

RMAN>backup archivelog all delete all input format '.......';

3、RAC归档方案有:
--使用OCFS共享存储
--使用NFS共享存储
--使用交叉互备(即本方案缺点:大量互传归档,慎用)
--任何节点只有它自己的归档日志,使用时再合并
4、本文演示的交叉互备方案需大量互传归档,慎用
5、如发现错误欢迎立即提出,方便及时更正

一、在一个非常大的文件系统上建立目录
1、在RAC1上建目录,rac1-rac2路径一致

$ mkdir /u01/arch
$ ll -d /u01/arch
drwxr-xr-x 2 oracle oinstall 4096 Jul  6 11:01 /u01/arch
2、在RAC2上建目录,rac1-rac2路径一致
[oracle@rac2 ~]$ mkdir /u01/arch
[oracle@rac2 ~]$ ll -d /u01/arch
drwxr-xr-x 2 oracle oinstall 4096 Jul  6 11:01 /u01/arch

1、本地归档设置

alter system set log_archive_dest_1='location=/u01/arch';

2、分别查看tnsnames中针对另一节点的tnsnames.ora

[oracle@rac1 ~]$ head -12 $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
RACDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RACDB)
      (INSTANCE_NAME = RACDB1)
    )
  )

[oracle@rac2 ~]$ head -12 $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora.rac2 Network Configuration File: /u01/db_1/network/admin/tnsnames.ora.rac2
# Generated by Oracle configuration tools.
RACDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = RACDB)
      (INSTANCE_NAME = RACDB1)
    )
  )

2、交叉归档,这样每个节点都可以读到其他节点的归档

alter system set log_archive_dest_2='service=RACDB2' sid='RACDB1';
alter system set log_archive_dest_2='service=RACDB1' sid='RACDB2';
alter system set standby_archive_dest='/u01/arch';
3、确认参数设置生效
col value for a25
col name for a20
select inst_id,name,value from gv$parameter 
where name in ('standby_archive_dest','log_archive_dest_2','log_archive_dest_1');
   INST_ID NAME VALUE
---------- -------------------- -------------------------
1 log_archive_dest_1    location=/u01/arch
1 log_archive_dest_2    service=RACDB2
1 standby_archive_dest /u01/arch
2 log_archive_dest_1    location=/u01/arch
2 log_archive_dest_2    service=RACDB1
2 standby_archive_dest /u01/arch
6 rows selected.

4、典型错误演示:service=*设置错误,传输归档到对方节点时会有以下错误

alter system set log_archive_dest_2='service=rac2' sid='RACDB1';
alter system set log_archive_dest_2='service=rac1' sid='RACDB2';
alter system set standby_archive_dest='/u01/arch';
SYS@RACDB2> alter system archive log current;


$ tail -f  /u01/admin/RACDB/bdump/*.log
Mon Jul  7 17:42:46 2014
Thread 2 advanced to log sequence 32
  Current log# 4 seq# 32 mem# 0: +DG1/racdb/redo04.log
Mon Jul  7 17:42:46 2014
Error 12514 received logging on to the standby
Mon Jul  7 17:42:46 2014
Errors in file /u01/admin/RACDB/bdump/racdb2_arc1_5696.trc:
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
PING[ARC1]: Heartbeat failed to connect to standby 'rac1'. Error is 12514.

三、调整归档日志文件命名方式

SYS@RACDB1>  alter system set log_archive_format ='arch_%S_%R_%T.arc' scope=spfile;
SYS@RACDB1>  select value from v$spparameter where name='log_archive_format';
--arch_%S_%R_%T.arc

%s: 日志序列号
%S:日志序列号(带有前导0)。
%t: 重做线程编号。
%T: 重做线程编号(带有前导0)
%a: %A:数据库ID号
%d: 数据库ID号
%r: RESETLOGS的id值

四、为RAC数据库开启归档
1、关闭所有节点数据库实例

$ srvctl stop database -d RACDB
$ crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora....B1.inst application    OFFLINE   OFFLINE               
ora....B2.inst application    ONLINE    OFFLINE               
ora.RACDB.db   application    OFFLINE   OFFLINE               
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    ONLINE    ONLINE    rac1        
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   application    ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    ONLINE    ONLINE    rac2        
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   application    ONLINE    ONLINE    rac2

2、在其中一个节点上开归档

SYS@RACDB1> startup mount
SYS@RACDB1> alter database archivelog;
SYS@RACDB1> alter database open;
3、开启所有节点数据库实例
$ srvctl stop database -d RACDB
$ srvctl start database -d RACDB;sleep 60
4、验证归档是否开启
SYS@RACDB1> archive log list
Database log mode          Archive Mode
Automatic archival          Enabled
Archive destination          /u01/arch
Oldest online log sequence     26
Next log sequence to archive   27
Current log sequence          27

五、测试、确认以上配置达到目的
1、 当前无任何归档日志

[oracle@rac1 ~]$ ls -1 /u01/arch/*
ls: /u01/arch/*: No such file or directory
[oracle@rac2 ~]$ ls -1 /u01/arch/*
ls: /u01/arch/*: No such file or directory

2、切换REDO生成归档

SYS@RACDB2> alter system archive log current;
3、注意事项、测试、确认以上配置达到目的
[oracle@rac1 ~]$ ls -1 /u01/arch/*
/u01/arch/arch_0000000033_0851859689_0001.arc
/u01/arch/arch_0000000038_0851859689_0002.arc
[oracle@rac2 ~]$ ls -1 /u01/arch/*
/u01/arch/arch_0000000033_0851859689_0001.arc
/u01/arch/arch_0000000038_0851859689_0002.arc


zcs0237 
2014.07.06
More cleaner and more efficient!

本文转自ICT时空dbasdk的博客,原文链接:link,如需转载请自行联系原博主。

相关文章
rac 归档路径设置
rac 归档路径设置
135 0
|
SQL 存储 Oracle
Oracle 11g R2 RAC with ASM存储迁移--Rman copy&ASM REBALANCE
by acdante Oracle 11g R2 RAC with ASM存储迁移                                            -----Rman copy&ASM REBALANCE     环境介绍 VMware版本:VMware12pro 主机操作系统:RHEL6.5_64 共享存储使用VMWARE创建共享磁盘文件 数据库版本:Oracle11gR2 11.2.0.4.0_RAC   Oracle数据库文件部署在ASM磁盘组上,需要在不停机或者尽量短的停机时间完成存储迁移。
3260 0
|
Oracle 关系型数据库 数据库