日期:2014-05-16  浏览次数:20551 次

搭建实时同步data guard的最高可用-切换主备

搭建实时同步data guard的最高可用-切换主备
首先保证主库在归档模式下:错过N次了
准备二台机器(hostname gw hosts ech0)host-only
[root@node1 ~]# ifconfig
eth0      Link encap:Ethernet  HWaddr 08:00:27:9C:CC:51 
          inet addr:192.168.56.147  Bcast:192.168.56.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe9c:cc51/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:750606 errors:0 dropped:0 overruns:0 frame:0
          TX packets:132742 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:179921301 (171.5 MiB)  TX bytes:2845074889 (2.6 GiB)

eth0:1    Link encap:Ethernet  HWaddr 08:00:27:9C:CC:51 
          inet addr:192.168.1.147  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1


 主库
 ip 192.168.1.147 node1.dg.com   安装好ORACLE,正常运行的数据库
 ipadd:  192.168.1.147  gw:192.168.1.1
     oracle sid: orcl 
     database name :orcl
     service  name :orcl  
备库
ip 192.168.1.157 node1.dg.com   只安装软件就可以了
     ipadd:  192.168.1.157
     gw:192.168.1.1
     oracle sid: orcl02 
     database name :orcl        -->??
     service  name :orcl        -->??
     步骤
1  --在二台机器上都建立oracleNET 即生成listner.ora及tnsnames.ora
--主库已有listner.ora and tnsnames.ora,需要增加tnsnames.ora到备库network service names
netmgr
--只需要在备库上建立(监听为静态监听)和tnsnames
--以上建立完毕,需要主备都启监听(注意VBOX可以调界面)
  1.1 ssh 192.168.1.147---> on primary
      netmgr
/*1.1       cp  -v  $ORACLE_HOME/network/admin/listner.ora $ORACLE_HOME/network/admin/listner.ora.std
       cp  -v  $ORACLE_HOME/network/admin/tnsnames.ora $ORACLE_HOME/network/admin/tnsnames.ora.std
      vi  listner.ora.std
      vi  tnsnames.ora.std
      scp listner.ora.std  oracle@192.168.1.57:$ORACLE_HOME/network/admin/listner.ora
      scp tnsnames.ora.std oracle@192.168.1.57:$ORACLE_HOME/network/admin/tnsnames.ora
      [oracle@node1 ~]$ cat /u01/app/oracle/product/11.2.0.1/db_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.1/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = orcl)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.1/db_1)
      (SID_NAME = orcl)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.147)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u01/app/oracle

*/
  &nb