1.oracle RAC11G 对单机ADG搭建详细文档


  
  
  
一个问题:rac对单机ADG搭建完成之后,rac是双节点,假设某一个节点发生故障done机了,或者是将一个节点关机了,然后
这个数据库再启动话是否还能起来???
起不来。因为一旦重启,之前修改的参数就生效了,启动的时候就会出现参数路径不一致的情况,就会导致这个节点无法启动。
有两个解决办法:
1.生成一个pfile文件,使用pfile文件启动,但是有弊端
2、重新编辑参数文件,清空路径不一致的参数,然后再启动。
生产库上如果不能立即重启使参数生效,那就等可以重启的时候在统一重启各个节点的数据库使参数生效就可以了。
备库:
  • standby 操作系统 oracle版本 db_name db_unique hostname oracle_sid
      rhel-server-6.5-x86_64 11.2.0.4 rac11g rac11gdg rac11gdg rac11gdg
主库:
RAC 操作系统 oracle版本 db_name db_unique hostname oracle_sid
节点1 rhel-server-6.5-x86_64 11.2.0.4 rac11g rac11g rac11g1 rac11g1
节点2 rhel-server-6.5-x86_64 11.2.0.4 rac11g rac11g rac11g2 rac11g2
1、创建物理备库的准备工作,首先保证rac数据库的状态都正常
 
1
[grid@rac11g1 ~]$ lsnrctl status 
2
3
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 06-APR-2017 17:00:55
Copyright (c) 1991, 2013, Oracle.  Allrightsreserved.
6
7
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
8
STATUS of the LISTENER
9
------------------------
10
Alias                     LISTENER
11
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
12
Start Date                06-APR-2017 16:05:29
13
Uptime                    0 days 0 hr. 55 min. 25 sec
14
Trace Level               off
15
Security                  ON: Local OS Authentication
16
SNMP                      OFF
17
Listener Parameter File   /u01/11.2.0/grid/network/admin/listener.ora
18
Listener Log File         /u01/app/oracle/diag/tnslsnr/rac11g1/listener/alert/log.xml
19
Listening Endpoints Summary...
20
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
21
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.10)(PORT=1521)))
22
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.26)(PORT=1521)))
23
Services Summary...
24
Service "+ASM" has 1 instance(s).
25
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
26
Service "rac11g" has 1 instance(s).
27
  Instance "rac11g1", status READY, has 1 handler(s) for this service...
28
Service "rac11gXDB" has 1 instance(s).
29
  Instance "rac11g1", status READY, has 1 handler(s) for this service...
30
The command completed successfully
31
[grid@rac11g1 ~]$ crsctl status resource -t
32
--------------------------------------------------------------------------------
33
NAME           TARGET  STATE        SERVER                   STATE_DETAILS       
34
--------------------------------------------------------------------------------
35
Local Resources
36
--------------------------------------------------------------------------------
37
ora.ARCHDG.dg
38
               ONLINE  ONLINE       rac11g1                                      
39
               ONLINE  ONLINE       rac11g2                                      
40
ora.DATADG.dg
41
               ONLINE  ONLINE       rac11g1                                      
42
               ONLINE  ONLINE       rac11g2                                      
43
ora.LISTENER.lsnr
44
               ONLINE  ONLINE       rac11g1                                      
45
               ONLINE  ONLINE       rac11g2                                      
46
ora.OCR_VOTE.dg
47
               ONLINE  ONLINE       rac11g1                                      
48
               ONLINE  ONLINE       rac11g2                                      
49
ora.asm
50
               ONLINE  ONLINE       rac11g1                  Started             
51
               ONLINE  ONLINE       rac11g2                  Started             
52
ora.gsd
53
               OFFLINE OFFLINE      rac11g1                                      
54
               OFFLINE OFFLINE      rac11g2                                      
55
ora.net1.network
56
               ONLINE  ONLINE       rac11g1                                      
57
               ONLINE  ONLINE       rac11g2                                      
58
ora.ons
59
               ONLINE  ONLINE       rac11g1                                      
60
               ONLINE  ONLINE       rac11g2                                      
61
ora.registry.acfs
62
               ONLINE  ONLINE       rac11g1                                      
63
               ONLINE  ONLINE       rac11g2                                      
64
--------------------------------------------------------------------------------
65
Cluster Resources
66
--------------------------------------------------------------------------------
67
ora.LISTENER_SCAN1.lsnr
68
      1        ONLINE  ONLINE       rac11g1                                      
69
ora.cvu
70
      1        ONLINE  ONLINE       rac11g1                                      
71
ora.oc4j
72
      1        ONLINE  ONLINE       rac11g1                                      
73
ora.rac11g.db
74
      1        ONLINE  ONLINE       rac11g1                  Open                
75
      2        ONLINE  ONLINE       rac11g2                  Open                
76
ora.rac11g1.vip
77
      1        ONLINE  ONLINE       rac11g1                                      
78
ora.rac11g2.vip
79
      1        ONLINE  ONLINE       rac11g2                                      
80
ora.scan1.vip
81
      1        ONLINE  ONLINE       rac11g1
 
            
 
            
10中的命令:
[grid@rac11g1 admin]$ crs_stat -tName           Type           Target    State     Host        ------------------------------------------------------------ora.ARCHDG.dg  ora....up.type ONLINE    ONLINE    rac11g1     ora.DATADG.dg  ora....up.type ONLINE    ONLINE    rac11g1     ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac11g1     ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac11g1     ora....VOTE.dg ora....up.type ONLINE    ONLINE    rac11g1     ora.asm        ora.asm.type   ONLINE    ONLINE    rac11g1     ora.cvu        ora.cvu.type   ONLINE    ONLINE    rac11g1     ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               ora....network ora....rk.type ONLINE    ONLINE    rac11g1     ora.oc4j       ora.oc4j.type  ONLINE    ONLINE    rac11g1     ora.ons        ora.ons.type   ONLINE    ONLINE    rac11g1     ora.rac11g.db  ora....se.type ONLINE    ONLINE    rac11g1     ora....SM1.asm application    ONLINE    ONLINE    rac11g1     ora....G1.lsnr application    ONLINE    ONLINE    rac11g1     ora....1g1.gsd application    OFFLINE   OFFLINE               ora....1g1.ons application    ONLINE    ONLINE    rac11g1     ora....1g1.vip ora....t1.type ONLINE    ONLINE    rac11g1     ora....SM2.asm application    ONLINE    ONLINE    rac11g2     ora....G2.lsnr application    ONLINE    ONLINE    rac11g2     ora....1g2.gsd application    OFFLINE   OFFLINE               ora....1g2.ons application    ONLINE    ONLINE    rac11g2     ora....1g2.vip ora....t1.type ONLINE    ONLINE    rac11g2     ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac11g1     ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac11g1 

1.1、 修改RAC数据库为FORCE LOGGING
 
1
SQL> select force_logging from v$database;
2
3
FOR
4
---
5
NO
6
7
SQL> alter database force logging;
8
9
Database altered.

1.2、查询online 的redo log 
 
1
注:通常我们设置生产库的每个redo大小为512M~2048M之间,并且大于等于三组
2
SQL> set linesize 150;
3
set pagesize 50;
4
column MB format a5;
5
column STATUS format a12;
6
column MEMBER format a50;
7
select l.GROUP#,l.THREAD#,l.BYTES/1024/1024||'MB' MB,l.STATUS, lf.TYPE,lf.MEMBER from v$log l,v$logfile lf where l.GROUP#=lf.GROUP#;
8
SQL> SQL> SQL> SQL> SQL> 
9
    GROUP#    THREAD# MB    STATUS TYPE MEMBER
10
---------- ---------- ----- ------------ ------- --------------------------------------------------
11
 1    1 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_1.263.940529009
12
 2    1 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_2.262.940529023
13
 3    1 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_3.261.940529039
14
 5    2 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_5.268.940259119
15
 6    2 512MB CURRENT ONLINE  +DATADG/rac11g/onlinelog/group_6.269.940259139
16
 7    2 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_7.270.940259155
17
 8    2 512MB INACTIVE ONLINE  +DATADG/rac11g/onlinelog/group_8.271.940259169
18
 4    1 512MB CURRENT ONLINE  +DATADG/rac11g/onlinelog/group_4.273.940529057
19
20
8 rows selected.

1.3、编辑hosts 文件主机名解析配置
 
1
编辑所有RAC节点的hosts文件:
2
[root@rac11g1 ~]# vim /etc/hosts  (节点1 同节点2 )
3
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
5
6
#rac11g Public IP
7
192.168.56.10         rac11g1
8
192.168.56.11         rac11g2
9
#rac11g Private IP
10
10.10.10.20           rac11g1-priv
11
10.10.10.21           rac11g2-priv
12
#rac11g VIP
13
192.168.56.26         rac11g1-vip
14
192.168.56.27         rac11g2-vip
15
#rac11g SCAN IP
16
192.168.56.29         rac11gscan
17
18
#ADG
19
192.168.56.70   db11g1    //备库的ip 以及主机名
20
21
编辑备库的hosts文件:(与rac中的hosts文件相同)
22
[root@db11g1 ~]# vim /etc/hosts
23
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
24
#public IP
25
192.168.56.10         rac11g1
26
192.168.56.11         rac11g2
27
#rac11g Private IP
28
10.10.10.20           rac11g1-priv
29
10.10.10.21           rac11g2-priv
30
#rac11g VIP
31
192.168.56.26         rac11g1-vip
32
192.168.56.27         rac11g2-vip
33
#rac11g SCAN IP
34
192.168.56.29         rac11gscan
35
36
#ADG
37
192.168.56.70   db11g1
38
39
40
修改完成之后在各个节点上ping 一下检查是否可以ping通
41
在rac的连个节点上ping一下备库:
42
[root@rac11g1 ~]# ping db11g1
43
PING db11g1 (192.168.56.70) 56(84) bytes of data.
44
64 bytes from db11g1 (192.168.56.70): icmp_seq=1 ttl=64 time=0.327 ms
45
64 bytes from db11g1 (192.168.56.70): icmp_seq=2 ttl=64 time=0.350 ms
46
64 bytes from db11g1 (192.168.56.70): icmp_seq=3 ttl=64 time=0.274 ms
47
48
[root@rac11g2 ~]# ping db11g1
49
PING db11g1 (192.168.56.70) 56(84) bytes of data.
50
64 bytes from db11g1 (192.168.56.70): icmp_seq=1 ttl=64 time=0.204 ms
51
64 bytes from db11g1 (192.168.56.70): icmp_seq=2 ttl=64 time=0.195 ms
52
64 bytes from db11g1 (192.168.56.70): icmp_seq=3 ttl=64 time=0.420 ms
53
64 bytes from db11g1 (192.168.56.70): icmp_seq=4 ttl=64 time=0.349 ms
54
55
56
57
在备库上ping一下rac的两个节点:
58
[root@db11g1 ~]# ping rac11g1
59
PING rac11g1 (192.168.56.10) 56(84) bytes of data.
60
64 bytes from rac11g1 (192.168.56.10): icmp_seq=1 ttl=64 time=1.64 ms
61
64 bytes from rac11g1 (192.168.56.10): icmp_seq=2 ttl=64 time=0.556 ms
62
64 bytes from rac11g1 (192.168.56.10): icmp_seq=3 ttl=64 time=0.243 ms
63
64 bytes from rac11g1 (192.168.56.10): icmp_seq=4 ttl=64 time=0.270 ms
64
^C
65
--- rac11g1 ping statistics ---
66
4 packets transmitted, 4 received, 0% packet loss, time 3187ms
67
rtt min/avg/max/mdev = 0.243/0.678/1.645/0.571 ms
68
[root@db11g1 ~]# 
69
[root@db11g1 ~]# ping rac11g2
70
PING rac11g2 (192.168.56.11) 56(84) bytes of data.
71
64 bytes from rac11g2 (192.168.56.11): icmp_seq=1 ttl=64 time=1.02 ms
72
64 bytes from rac11g2 (192.168.56.11): icmp_seq=2 ttl=64 time=0.269 ms
73
64 bytes from rac11g2 (192.168.56.11): icmp_seq=3 ttl=64 time=0.268 ms
 
                   

1.4、配置备库的监听
 
1
[oracle@db11g1 admin]$ vim listener.ora
2
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
3
# Generated by Oracle configuration tools.
4
5
SID_LIST_LISTENER =
6
  (SID_LIST =
7
    (SID_DESC =
8
      (GLOBAL_DBNAME = rac11gdg)
9
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
10
      (SID_NAME = rac11gdg)
11
    )
12
  )
13
14
LISTENER =
15
  (DESCRIPTION_LIST =
16
    (DESCRIPTION =
17
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.70)(PORT = 1521))
18
    )
19
    (DESCRIPTION =
20
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
21
    )
22
  )
23
24
ADR_BASE_LISTENER = /u01/app/oracle
25
26
27
然后重启监听
28
[oracle@db11g1 admin]$ lsnrctl stop
29
[oracle@db11g1 admin]$ lsnrctl start
30
[oracle@db11g1 admin]$ lsnrctl status
31

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-SEP-2017 14:06:30Copyright (c) 1991, 2013, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.56.70)(PORT=1521)))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Linux: Version 11.2.0.4.0 - ProductionStart Date                17-SEP-2017 14:06:26Uptime                    0 days 0 hr. 0 min. 3 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.oraListener Log File         /u01/app/oracle/diag/tnslsnr/rac11gdg/listener/alert/log.xmlListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.56.70)(PORT=1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Services Summary...Service "rac11g" has 1 instance(s).  Instance "rac11gdg", status UNKNOWN, has 1 handler(s) for this service...The command completed successfully


1.5 配置所有的tnsname.ora 文件
 
1
节点1:
2
[root@rac11g1 ~]# su - oracle
3
[oracle@rac11g1 ~]$ cd /u01/app/oracle/product/11.2.0/db_1/network/admin/
4
[oracle@rac11g1 admin]$ ls
5
samples  shrept.lst  tnsnames.ora
6
[oracle@rac11g1 admin]$ vim tnsnames.ora 
7
# tnsnames.ora.rac11g1 Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora.rac11g1
8
# Generated by Oracle configuration tools.
9
10
RAC11G =
11
  (DESCRIPTION =
12
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac11gscan)(PORT = 1521))
13
    (CONNECT_DATA =
14
      (SERVER = DEDICATED)
15
      (SERVICE_NAME = rac11g)
16
    )
17
  )
18
// 注:这里主机名写成rac11gscan ,可以解析两个节点
19
20
// 添加一个解析备库的解析地址
21
RACDG =
22
  (DESCRIPTION =
23
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.70)(PORT = 1521))
24
    (CONNECT_DATA =
25
      (SERVER = DEDICATED)
26
      (SERVICE_NAME = racdg)
27
    )
28
  )  
29
30
配置完成之后tnsping 一下
31
[oracle@rac11g1 admin]$ tnsping RACDG
32
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 06-APR-2017 18:22:19
33
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
34
Used parameter files:
35
Used TNSNAMES adapter to resolve the alias
36
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.70)(PORT = 1521)) 
37
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = racdg)))
38
OK (10 msec)
39
40
[oracle@rac11g1 admin]$ tnsping RAC11G
41
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 06-APR-2017 18:22:27
42
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
43
Used parameter files:
44
Used TNSNAMES adapter to resolve the alias
45
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac11gscan)(PORT = 1521)) (CONNECT_DATA =
46
 (SERVER = DEDICATED) (SERVICE_NAME = rac11g)))
47
OK (20 msec)
48
两个解析都可以ping通
49
50
节点2:
51
[oracle@rac11g2 admin]$ vim tnsnames.ora 
52
# tnsnames.ora.rac11g2 Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora.rac11g2
53
# Generated by Oracle configuration tools.
54
55
RAC11G =
56
  (DESCRIPTION =
57
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac11gscan)(PORT = 1521))
58
    (CONNECT_DATA =
59
      (SERVER = DEDICATED)
60
      (SERVICE_NAME = rac11g)
61
    )
62
  )
63
64
RACDG =
65
  (DESCRIPTION =
66
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.70)(PORT = 1521))
67
    (CONNECT_DATA =
68
      (SERVER = DEDICATED)
69
      (SERVICE_NAME = racdg)
70
    )
71
  )
72
73
ping一下:
74
[oracle@rac11g2 admin]$ tnsping rac11g
75
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 06-APR-2017 18:26:21
76
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
77
Used parameter files:
78
79
Used TNSNAMES adapter to resolve the alias
80
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = rac11gscan)(PORT = 1521)) (CONNECT_DATA = 
81
(SERVER = DEDICATED) (SERVICE_NAME = rac11g)))
82
OK (0 msec)
83
84
[oracle@rac11g2 admin]$ tnsping racdg
85
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 06-APR-2017 18:26:24
86
Copyright (c) 1997, 2013, Oracle.  All rights reserved.
87
Used parameter files:
88
89
Used TNSNAMES adapter to resolve the alias
90
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.70)(PORT = 1521)) 
91
(CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = racdg)))
92
OK (10 msec)
93
94
也没有问题,都可以ping通
95
  • 0
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值