GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步(XX公司

原创
2016-06-07 14:49:58 1767浏览

GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步 目的 完成后本 Oracle 按示例 (OBE) 教程中,您将能够保持两个异构数据库同步使用 Oracle GoldenGate (OGG) ; 在这种情况下 Linux Oracle 11gR2 数据库到 11gR2 Exadata 数据库。 在本课中,您将学会

GG搭建 源单实例---到目标RAC环境 11.2.3版本 单向同步

    目的

    完成后本 Oracle 按示例 (OBE) 教程中,您将能够保持两个异构数据库同步使用 Oracle GoldenGate (OGG) ;在这种情况下 Linux Oracle 11gR2 数据库到 11gR2 Exadata 数据库。

    在本课中,您将学会如何:

    • 准备您的环境配置 Oracle GoldenGate 进程。
    • 配置并启动更改捕获的数据库操作。
    • 配置并启动更改交货的数据库操作。

    完成时间

    大约 2 个小时

    简介

    Oracle GoldenGate Exadata 上的: 从 Oracle 11gR2 向 Oracle 11gR2 复制

    Oracle GoldenGate 提供异构数据库的非常快速复制,通过读取事务日志并写入一个或多个目标数据库所做的更改。在典型环境中涉及以下五个过程:

    经理:
    有一位经理在源主机上和一个单独的经理,在目标主机上。管理器启动和停止源和目标实例上的其他进程。不需要为传递通信一旦运行的提取物或建议您使用管理器。
    初始加载:
    是可选的。用于填充在目标表一次。它可以读取或者从源表中直接或从 ASCII 文件。这个 OBE 忽略初始加载。请参阅其他都会发帝国勋章为如何去做。
    提取:
    在要交易数据捕获到轨迹文件的源上运行。有两个版本的提取物: 经典 (此 OBE) 和集成。
    数据泵:
    可选,但强烈建议。数据抽取轨迹文件从源代码实例在将发送到的目标实例的 IP 网络。从技术上讲数据抽取是次要的提取物。
    建议您使用:
    将数据传递到目标数据库。通常建议您使用运行在目标系统上。是的拼写正确,没有最后"e"(长故事)。

    Linux Oracle Exadata 配置 (单向)

    图所示的配置 (使用在目标系统上创建远程跟踪一个主要提取过程。建议您使用进程从远程跟踪的更改将应用为目标 RAC 数据库。它是不必要的源 host01 Linux 也不是 64 位。

    总之,环境是:

    主机名 屏幕颜色 OS 硬件 数据库 SID OGG 源/目标 主控制台
    host01 红色 Linux 64 位 单个 CPU 的 PC Oracle 11gR2 orcl 两个
    qr01db02 (Node02) 黄色 Linux 64 位 Exadata 数据库节点 Oracle 11gR2 RAC dbm2 目标 GGSCI
    qr01db01 (Node01) 绿色 Linux 64 位 Exadata 数据库节点 Oracle 11gR2 RAC dbm1 目标 SQL * 加上

    系统必备组件

    这个实验室的先决条件包括以下内容:

    • 查看基本的 GoldenGate Oracle 到 Oracle OBE 为"正常"的任务,如初始加载,查看统计信息,等等。这个 OBE 只集中的独特 Exadata 方面。底部的更多的链接,请参阅资源。
    • 查看白皮书 》,特别是关于我的 Oracle 支持的一节 (MOS,需要查看的帐户) 注意到1054431.1.
    • 源主机与示例架构已安装并运行了 Oracle 11gR2 数据库。
    • Oracle GoldenGate 的 64 位 Linux zip 分布被上演对源和/home/user/目标/首页/用户/目录。这是可从Oracle 软件交付云.
    • Exadata 群集服务已安装并且正在运行。

    记住有两个主机: host01 和 host02 ;和每个主机有三种环境提示: OS、 GGSCI 和 SQL。这让六个不同的地方,在其中您可以键入 !请尝试一定要额外小心你在哪个位置中输入的命令。错误的上下文中的错误的命令是最常见的错误。

    任务概述

    准备环境

    要执行这一课,GoldenGate 应用程序必须安装在源和目标系统上。安装包括一个示例数据库和脚本来生成初始数据,以及随后的更新操作。源表和目标表创建和加载与初始数据。GoldenGate 管理器进程也会启动以便其他进程可能会配置和启动。源的定义是最后,生成和转移到目标系统。

    配置更改捕获 (摘录)

    对于经审核表,提取过程配置捕获变更数据直接从财资市场发展委员会审核跟踪,并将所做的更改存储在称为 GoldenGate 本地径数据队列。

    配置更改传递 (建议您使用)

    一旦表已最初加载数据,提取过程捕获的所有操作,建议您使用进程配置为捕获的操作传递到目标数据库。

    印刷约定

    文本颜色和字体的方向和在此屏幕中应解释如下:

    Some_Command
    键入作为一个命令或一个值。示例:
    请输入./ ggsci启动的命令行解释器。
    Some_Prompt
    系统响应与此作为提示符或答复。示例:
    在初始欢迎横幅之后, 你可以在输入命令GGSCI (host01) 1 >提示符。
    Some_Button
    屏幕上单击此按钮。示例:
    选择你想要的版本之后, 单击继续以开始下载。
    Some_Variable
    您用来代替实际值的变量。示例:
    请输入您的用户 id/密码的提示符。
    Some_Filename
    文件名、 路径或文件夹/目录。示例:
    编辑/etc目录中的hosts文件。
    Some_Code
    一个关键字或代码的元素。示例:
    在初始加载后将HandleCollisions参数更改为NoHandleCollisions

    文件和过程的命名约定

    文件和过程的命名约定可以不管为你或你的公司工作。这里是这个 OBE 中使用的示例约定:
    pxxxxhh.ext
    地点:

    p= 进程 =
    e (xtract), p(ump)、 r(eplicat),(nitial)、 d(efgen), s(tartup)。
    xxxx项目 = =
    与相关的常见项目xxxx,例如人力资源、 销售、 engr、 测试的所有文件.
    hh= 主机到主机 =
    aa,ab,ba,bb,如由源和目标主机的名称在哪里 = host01 和 b = host02。稍后您将看到不能使用数字作为一部分的一些文件的名称,所以最好不要去那儿在所有。
    ext= 扩展名 =
    prm= 参数 (存储在dirprm /), dsc= 丢弃, rpt= 报告 (存储在dirrpt /), def= 定义 (存储在dirdef /),体外= 服从 (存储在安装目录中), sql= SQL (存储在dirsql /).

1. Preparing the Environment

    目标

    本练习的目标是:

    • 所界定的.profile.bash_profile或相当于准备操作系统 (OS) 的环境变量。
    • 配置应用程序的 VIP 地址。
    • tnsping为未来 sqlplus 连接进行测试。
    • 通过创建 OGG admin 用户和修改数据库参数准备 Oracle 数据库 11gR2。

    您键入的命令将在蓝色的等宽字体系统的反应将会在black monospaced font.

    1.1 编写操作系统的环境变量

      您将配置.profile为环境变量和主机别名的/etc/hosts文件。你会做这三个的所有主机上: 源和两个目标节点。您现有的配置文件可能会对他们有行,这一步更侧重于要向其中添加的行。

      使用您选择的编辑器,并且检查目标主机节点 1 上的配置文件的初始状态。ORACLE_BASE, ORACLE_HOME, OGG_HOME,和LD_LIBRARY_PATH添加变量。正如他们离开其他线条。

      Exadata-节点 1 (目标)
      [oracle@qr01db01 ~]$ vi .bash_profile 
      
      1   # .bash_profile                                              
      2                                                                
      3   # Get the aliases and functions                              
      4   if [ -f ~/.bashrc ]; then                                    
      5           . ~/.bashrc                                          
      6   fi                                                           
      7                                                                
      8   # User specific environment and startup programs             
      9                                                                
      10  PATH=$PATH:$HOME/bin                                         
      11                                                               
      12  export PATH                                                  
      13  export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1   
      14  export ORACLE_SID=dbm1                                       
      15  ORAENV_ASK=NO;. /usr/local/bin/oraenv > /dev/null 2<&1       
      16  alias gogrid='export ORACLE_HOME=/u01/app/11.2.0/grid;export 
          ORACLE_SID=+ASM1;. /usr/local/bin/oraenv > /dev/null 2<&1;env
          |grep ORA|grep -v BASE'                                      
      17  alias godb='export ORACLE_HOME=/u01/app/oracle/product/11.2.0
          /dbhome_1;export ORACLE_SID=dbm1;. /usr/local/bin/oraenv > /d
          ev/null 2<&1;env|grep ORA|grep -v BASE'                      
      
      [oracle@qr01db01 ~]$ vi .bash_profile  
      
      1   # .bash_profile                                              
      2                                                                
      3   # Get the aliases and functions                              
      4   if [ -f ~/.bashrc ]; then                                    
      5           . ~/.bashrc                                          
      6   fi                                                           
      7                                                                
      8   # User specific environment and startup programs             
      9                                                                
      10  PATH=$PATH:$HOME/bin                                         
      11                                                               
      12  export PATH                                                  
      13  export ORACLE_BASE=/u01/app/oracle                           
      14  export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1      
      15  export OGG_HOME=$ORACLE_BASE/ogg                             
      16  export LD_LIBRARY_PATH=$ORACLE_HOME/lib                      
      17  export ORACLE_SID=dbm1                                       
      18  ORAENV_ASK=NO;. /usr/local/bin/oraenv > /dev/null 2<&1       
      19  alias gogrid='export ORACLE_HOME=/u01/app/11.2.0/grid;export 
          ORACLE_SID=+ASM1;. /usr/local/bin/oraenv > /dev/null 2<&1;env
          |grep ORA|grep -v BASE'                                      
      20  alias godb='export ORACLE_HOME=/u01/app/oracle/product/11.2.0
          /dbhome_1;export ORACLE_SID=dbm1;. /usr/local/bin/oraenv > /d
          ev/null 2<&1;env|grep ORA|grep -v BASE'                      
      
      [oracle@qr01db02 ~]$
                                                                                      
      

      The alias gogrid and alias godb have been added for another demo, they are not part of the default profile. They make it easier to switch between the Grid Infrastructure and DB environments. Note that the aliases each span several lines. Be mindful to not introduce extra returns on those lines.

      Switch user to root and edit the /etc/hosts file to append an alias for host01. Use the proper IP address for your environment.

      Exadata - Node 1 (target)
      [oracle@qr01db02 ~]$ su - root 
      Password: 
      [root@qr01db02 ~]# vi /etc/hosts 
      
         127.0.0.1       localhost.localdomain    localhost          
                                                                     
           (...rest of file not shown, too many possibilities...)    
      
      [root@qr01db02 ~]# tail -1 /etc/hosts 
      192.0.2.16      host01.example.com              host01
      [root@qr01db02 ~]# exit 
      [oracle@qr01db02 ~]$
                                                                                      
      

      The tail command assumes you appended the host01 address to the end of the file. Exit out of root when you are done editing.

      Do the exact same thing for the other target node 2. The lines are not shown, they are the same for qr01db01 and qr01db02.

      Exadata - Node 2 (target)
      [oracle@qr01db02 ~]$ vi .bash_profile 
        (REPEAT ON OTHER QR01db02)
      [oracle@qr01db02 ~]$ su - root 
      [root@qr01db02 ~]# vi /etc/hosts 
        (REPEAT ON OTHER QR01db02)
      [root@qr01db02 ~]# exit 
      [oracle@qr01db02 ~]$
                                                                                      
      

      The two nodes should have identical profiles and very similar /etc/hosts.

      Do the same thing for the source host. There may be slight difference in where things are installed, but you are defining the same four environment variables: ORACLE_BASE, ORACLE_HOME, OGG_HOME, and LD_LIBRARY_PATH. The /etc/hosts points to the Exadata address.

      Host01 - Linux (source)
      [oracle@host01 ~]$ vi .bash_profile 
      
         # .bash_profile                                             
                                                                     
         # Get the aliases and functions                             
         if [ -f ~/.bashrc ]; then                                   
                 . ~/.bashrc                                         
         fi                                                          
                                                                     
         # User specific environment and startup programs            
         ORACLE_BASE=/u01/app/oracle                                 
         ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_home1            
         OGG_HOME=$ORACLE_BASE/ogg                                   
         ORACLE_SID=orcl                                             
         PATH=$PATH:$HOME/bin:$ORACLE_HOME:$ORACLE_HOME/bin          
         LD_LIBRARY_PATH=$ORACLE_HOME/lib                            
                                                                     
         export PATH LD_LIBRARY_PATH                                 
         export ORACLE_HOME ORACLE_BASE ORACLE_SID OGG_HOME          
      
      [oracle@host01 ~]$ su - root 
      Password: 
      [root@host01 ~]# vi /etc/hosts 
      
         127.0.0.1       localhost.localdomain    localhost          
                                                                     
           (...rest of file not shown, too many possibilities...)    
      
      [root@host01 ~]# tail -1 /etc/hosts 
      192.0.2.99      qr01-vip.example.com            qr01-vip
      [root@host01 ~]# exit 
      [oracle@host01 ~]$
                                                                                      
      

      This time the /etc/hosts addition is for an application "vip" address on Exadata that gets defined in the next step. For now, just enter that line on faith.

      This completes preparing the OS environment variables.

    1.2 Configure the Application Virtual IP (VIP) Address

      The application Virtual IP (VIP) is part of Cluster Ready Services (CRS). It is used to define a single new address shared by multiple nodes. The purpose is for the source to point to a single target address regardless of which target node is handling it. This is similar to the Single Client Access Name (SCAN) address feature of Real Application Clusters (RAC), except that SCAN is only for use by the database, whereas VIP can be used by any application (in this example, GoldenGate).

      On target node 2, perform the following tasks as root or oracle as indicated. You create the VIP as root, but you run it as oracle. The VIP address must be any unused address in the subnet configured as the public network for the cluster. The example uses 192.0.2.99 because the grep returns the 192.0.2.0 subnet, so .99 is unused in that subnet. It needs to match the /etc/hosts file on the source in the previous step.

      Exadata - Node 2 (target)
      [oracle@qr01db02 ogg]$ su - root 
      Password: 
      [root@qr01db02 ~]# cd /u01/app/11.2.0/grid/bin 
      [root@qr01db02 bin]# ./crsctl stat res -p | grep -ie .network -ie subnet | grep 
                           -ie name -ie subnet 
      NAME=ora.net1.network
      USR_ORA_SUBNET=192.0.2.0
      [root@qr01db02 bin]# ./appvipcfg create -network=1 -ip=192.0.2.99 
                           -vipname=gg_vip_trg -user=root 
      Production Copyright 2007, 2008, Oracle.All rights reserved
      2013-02-27 14:06:52: Creating Resource Type
      2013-02-27 14:06:52: Executing /u01/app/11.2.0/grid/bin/crsctl add type 
        app.appvip_net1.type -basetype ora.cluster_vip_net1.type -file 
        /u01/app/11.2.0/grid/crs/template/appvip.type
      2013-02-27 14:06:52: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add type 
        app.appvip_net1.type -basetype ora.cluster_vip_net1.type -file 
        /u01/app/11.2.0/grid/crs/template/appvip.type
      2013-02-27 14:06:55: Create the Resource
      2013-02-27 14:06:55: Executing /u01/app/11.2.0/grid/bin/crsctl add resource gg_v
        ip_trg -type app.appvip_net1.type -attr "USR_ORA_VIP=192.0.2.99,START_DEPENDEN
        CIES=hard(ora.net1.network) pullup(ora.net1.network),STOP_DEPENDENCIES=hard(or
        a.net1.network),ACL='owner:root:rwx,pgrp:root:r-x,other::r--,user:root:r-x',HO
        STING_MEMBERS=qr01db02.example.com,APPSVIP_FAILBACK="
      2013-02-27 14:06:55: Executing cmd: /u01/app/11.2.0/grid/bin/crsctl add resource
        gg_vip_trg -type app.appvip_net1.type -attr "USR_ORA_VIP=192.0.2.99,START_DEPE
        NDENCIES=hard(ora.net1.network) pullup(ora.net1.network),STOP_DEPENDENCIES=har
        d(ora.net1.network),ACL='owner:root:rwx,pgrp:root:r-x,other::r--,user:root:r-x
        ',HOSTING_MEMBERS=qr01db02.example.com,APPSVIP_FAILBACK="
      [root@qr01db02 bin]# ./crsctl setperm resource gg_vip_trg -u user:oracle:r-x 
      [root@qr01db02 bin]# exit 
      [oracle@qr01db02 ogg]$ cd /u01/app/11.2.0/grid/bin 
      [oracle@qr01db02 bin]$ ./crsctl start resource gg_vip_trg 
      CRS-2672: Attempting to start 'gg_vip_trg' on 'qr01db01'
      CRS-2676: Start of 'gg_vip_trg' on 'qr01db01' succeeded
      [oracle@qr01db02 bin]$ ./crsctl status resource gg_vip_trg 
      NAME=gg_vip_trg
      TYPE=app.appvip_net1.type
      TARGET=ONLINE
      STATE=ONLINE on qr01db01
      
      [oracle@qr01db02 bin]$
                                                                                      
      

      You are looking for a STATE=ONLINE to indicate success. A VIP is tied to one (and only one) IP address. In the case of an application VIP, you define it once (on any cluster node) and by default it can run on any cluster node.

      This completes configuring the application VIP address.

    1.3 测试连接性

      使用pingtnsping ,以确保这两个主机可以到达对方。

      请确保源可以达到的目标通过应用程序的 VIP 地址。

      Host01-Linux (源)
      [oracle@host01 ogg]$ ping qr01-vip 
      PING qr01-vip.example.com (192.0.2.99) 56(84) bytes of data.
      64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=1 ttl=64 time=0.145 ms
      64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=2 ttl=64 time=0.143 ms
      64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=3 ttl=64 time=0.107 ms
      64 bytes from qr01-vip.example.com (192.0.2.99): icmp_seq=4 ttl=64 time=0.109 ms
      ^C
      --- qr01-vip.example.com ping statistics ---
      4 packets transmitted, 4 received, 0% packet loss, time 2999ms
      rtt min/avg/max/mdev = 0.107/0.126/0.145/0.018 ms
      [oracle@host01 ogg]$ 
                                                                                      
      

      后几个成功 ping,取消使用 Ctrl + c。

      请确保目标节点 2 可以访问使用tnsping的数据库。这些别名从tnsnames.ora将稍后使用的sqlplus.

      Exadata-节点 2 (目标)
      [oracle@qr01db02 ~]$ more $ORACLE_HOME/network/admin/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.
      
      DBM =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = TCP)(HOST = qr01-scan)(PORT = 1521))
          (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = dbm.example.com)
          )
        )
      
      [oracle@qr01db02 ~]$ tnsping dbm 
      
      TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45
      Copyright (c) 1997, 2010, Oracle.  All rights reserved.
      Used parameter files:
      Used TNSNAMES adapter to resolve the alias
      Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 
      qr01-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =
      dbm.example.com)))
      OK (0 msec)
      [oracle@qr01db02 ~]$ tnsping dbm1 
      
      TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45
      Copyright (c) 1997, 2010, Oracle.  All rights reserved.
      Used parameter files:
      TNS-03505: Failed to resolve name
      [oracle@qr01db02 ~]$ 
                                                                                      
      

      "不合格"的tnsping显示你不能到dbm1,如单个实例的tnsping ,但你可以到群集数据库sqlplus user/pswd@dbm你能弄明白你在说到通过使用哪个实例sqlplus> 显示参数 instance_name您可以通过设置和导出访问特定实例ORACLE_SID=dbm1或其他一些特定的实例名称。

      请确保目标节点 1 可以访问同一数据库使用相同的tnsname.

      Exadata-节点 1 (目标)
      [oracle@qr01db01 ~]$ tnsping dbm 
      
      TNS Ping Utility for Linux: Version 11.2.0.2.0 - Production on 06-MAR-2013 13:45
      Copyright (c) 1997, 2010, Oracle.  All rights reserved.
      Used parameter files:
      Used TNSNAMES adapter to resolve the alias
      Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 
      qr01-scan)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME =
      dbm.example.com)))
      OK (0 msec)
      [oracle@qr01db01 ~]$
                                                                                      
      

      请注意这两个 RAC qr01-scan指向实例 (这两个节点)。

      这将完成测试数据库和 IP 连通性。

    1.4 为 Goldengate 准备数据库

      下面一节是差不多无论你使用的 Exadata 或 RAC 或只是一个单一的节点。

      在源 host01 上创建 OGG 管理员oggadm1

      Host01-Linux (源)
      [oracle@host01 ~]$ sqlplus / as sysdba 
      
      SQL*Plus: Release 11.2.0.3.0 Production on Wed Feb 27 10:08:24 2013
      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, OLAP, Data Mining and Real Application Testing options
      
      SQL> set sqlprompt 'host01_SQL> ' 
      host01_SQL> SELECT log_mode, force_logging, supplemental_log_data_min
                  FROM v$database; 
      
      LOG_MODE     FOR SUPPLEME
      ------------ --- --------
      ARCHIVELOG   YES YES
      
      host01_SQL> CREATE USER oggadm1 IDENTIFIED BY pswd1a; 
      User created.
      
      host01_SQL> GRANT dba TO oggadm1; 
      Grant succeeded.
      
      host01_SQL> EXEC 
            DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE ('OGGADM1','capture',TRUE); 
      PL/SQL procedure successfully completed.
      
      host01_SQL>
                                                                                      
      

      如果SELECT返回ARCHIVELOG YES YES然后没有进一步修改数据库需要。如果SELECT返回NOARCHIVELOG NO NO,然后请参阅如何更改,并在源数据库上执行的下一步骤。

      默认情况下数据库处于NOARCHIVELOGforce_logging=NOGoldengate 需要ARCHIVELOGforce_logging=YES要改变这种下来需要要被关闭的数据库 (这两个节点) !。第一次关闭目标节点 2。

      Exadata-节点 2 (目标)
      [oracle@qr01db02 ~]$ sqlplus / as sysdba 
      
      SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 09:59:04 2013
      Copyright (c) 1982, 2010, Oracle.  All rights reserved.
      Connected to:
      Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
      With the Partitioning, Real Application Clusters, Automatic Storage Management, 
      OLAP, Data Mining and Real Application Testing options
      
      SQL> set sqlprompt 'qr01db_SQL> ' 
      qr01db_SQL> SELECT log_mode, force_logging, supplemental_log_data_min
                  FROM v$database; 
      
      LOG_MODE     FOR SUPPLEME
      ------------ --- --------
      NOARCHIVELOG NO  NO
      
      qr01db_SQL> shutdown immediate 
      Database closed.
      Database dismounted.
      ORACLE instance shut down.
      qr01db_SQL>
                                                                                      
      

      set sqlprompt的使用是可选的但它可以帮助您保持笔直的屏幕连接到哪个函数。

      关闭目标节点 1。改变数据库和系统所需。

      Exadata-节点 1 (目标)
      [oracle@qr01db01 ~]$ sqlplus / as sysdba 
      
      SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 09:56:12 2013
      Copyright (c) 1982, 2010, Oracle.  All rights reserved.
      Connected to:
      Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
      With the Partitioning, Real Application Clusters, Automatic Storage Management, 
      OLAP, Data Mining and Real Application Testing options
      
      SQL> set sqlprompt 'qr01db_SQL> ' 
      qr01db_SQL> SELECT log_mode, force_logging, supplemental_log_data_min
                  FROM v$database; 
      
      LOG_MODE     FOR SUPPLEME
      ------------ --- --------
      NOARCHIVELOG NO  NO
      
      qr01db_SQL> shutdown immediate 
      Database closed.
      Database dismounted.
      ORACLE instance shut down.
      qr01db_SQL> startup mount 
      ORACLE instance started.
      
      Total System Global Area  939495424 bytes
      Fixed Size                  2232088 bytes
      Variable Size             637534440 bytes
      Database Buffers          293601280 bytes
      Redo Buffers                6127616 bytes
      Database mounted.
      qr01db_SQL> ALTER DATABASE ARCHIVELOG; 
      ALTER DATABASE ARCHIVELOG
      *
      ERROR at line 1:
      ORA-01126: database must be mounted in this instance and not open in any instance
      
      qr01db_SQL> ALTER DATABASE ARCHIVELOG; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE OPEN; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE FORCE LOGGING;  
      Database altered.
      
      qr01db_SQL> ALTER SYSTEM SWITCH LOGFILE; 
      System altered.
      
      qr01db_SQL> SELECT log_mode, force_logging, supplemental_log_data_min
                  FROM v$database; 
      
      LOG_MODE     FOR SUPPLEME
      ------------ --- --------
      ARCHIVELOG   YES YES
      
      qr01db_SQL> COMMIT; 
      Commit complete.
      
      qr01db_SQL> shutdown immediate 
      Database closed.
      Database dismounted.
      ORACLE instance shut down.
      qr01db_SQL>
                                                                                      
      

      请注意ERROR ORA-01126屏幕中间的。这是你看到的如果你忘了第一次关闭其他节点。离开目标节点 1 暂时关闭。

      目标节点 2 上执行类似的步骤。

      Exadata-节点 2 (目标)
      ORACLE instance shut down.
      SQL> set sqlprompt 'qr01db_SQL> '  
      qr01db_SQL> startup mount 
      ORACLE instance started.
      
      Total System Global Area  939495424 bytes
      Fixed Size                  2232088 bytes
      Variable Size             641728744 bytes
      Database Buffers          289406976 bytes
      Redo Buffers                6127616 bytes
      Database mounted.
      qr01db_SQL> ALTER DATABASE ARCHIVELOG; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE OPEN; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA; 
      Database altered.
      
      qr01db_SQL> ALTER DATABASE FORCE LOGGING;  
      ALTER DATABASE FORCE LOGGING
      *
      ERROR at line 1:
      ORA-12920: database is already in force logging mode
      
      qr01db_SQL> ALTER SYSTEM SWITCH LOGFILE; 
      System altered.
      
      qr01db_SQL> SELECT log_mode, force_logging, supplemental_log_data_min
                  FROM v$database; 
      
      LOG_MODE     FOR SUPPLEME
      ------------ --- --------
      ARCHIVELOG   YES YES
      
      qr01db_SQL>
                                                                                      
      

      有意思的是,要注意哪些东西适用于 (有两个实例) 的实例,以及哪些东西应用到数据库 (那里是只有一个数据库)。例如,每个实例必须设置为ALTER DATABASE ADD SUPPLEMENTAL LOG DATA,但单个数据库已经在FORCE LOGGING从先前的实例。
      当你成功时,SELECT将返回ARCHIVELOG YES YES.

      现在,数据库发生更改,请将它启动。节点 2 已在运行,现在在节点 1 上启动的数据库。为 Exadata (此用户是可访问的节点 dbm1 或 dbm2) 创建 OGG 架构管理员用户。

      Exadata-节点 1 (目标)
      ORACLE instance shut down.
      qr01db_SQL> startup 
      ORACLE instance started.
      
      Total System Global Area  939495424 bytes
      Fixed Size                  2232088 bytes
      Variable Size             637534440 bytes
      Database Buffers          293601280 bytes
      Redo Buffers                6127616 bytes
      Database mounted.
      Database opened.
      qr01db_SQL> sho parameter name 
      
      NAME                                 TYPE        VALUE
      ------------------------------------ ----------- ------------------------------
      db_file_name_convert                 string
      db_name                              string      dbm
      db_unique_name                       string      dbm
      global_names                         boolean     FALSE
      instance_name                        string      dbm1
      lock_name_space                      string
      log_file_name_convert                string
      processor_group_name                 string
      service_names                        string      dbm.example.com
      
      qr01db_SQL> CREATE USER oggadm2 IDENTIFIED BY pswd2a;  
      User created.
      
      qr01db_SQL> GRANT dba TO oggadm2; 
      Grant succeeded.
      
      qr01db_SQL> EXEC 
            DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE ('OGGADM2','capture',TRUE); 
      PL/SQL procedure successfully completed.
      
      qr01db_SQL> exit 
      Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 
      64bit Production With the Partitioning, Real Application Clusters, Automatic 
      Storage Management, OLAP, Data Mining and Real Application Testing options
      [oracle@qr01db01 ~]$
                                                                                      
      

      OGG 的管理员授予 DBA 可能是大材小用,但很方便此示例。您可能会授予权限少在生产环境中。

      此时,处理完事情,需要单独配置的两个节点。从现在开始,您可以选择对所有sqlplus操作使用只是节点 1。

      这样就完成了准备 Oracle GoldenGate 的数据库。

    1.5 为 DBFS 准备数据库

      创建两个表空间 (一个大和一个小),持有两个DBFS。两个表空间将稍后有缓存的不同特性。

      不论在目标节点 1 或 2 的目标节点上执行此步骤,它所有去到相同的共享的存储空间。dbfs_ogg_big为选取的大小可能会在生产环境中的大得多。他们需要大得足以容纳所有跟踪文件。dbfs_ogg_small为选取的大小可能会有关的权利。所有在小 DBFS 正在将是非常微小的检查点文件。

      Exadata-节点 2 (目标)
      qr01db_SQL> CREATE bigfile TABLESPACE dbfs_ogg_big datafile '+DBFS_DG' SIZE
        100M autoextend ON NEXT 10M MAXSIZE 200M LOGGING EXTENT MANAGEMENT LOCAL
        AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO; 
      
      Tablespace created.
      
      qr01db_SQL> CREATE bigfile TABLESPACE dbfs_ogg_small datafile '+DBFS_DG' SIZE
        10M autoextend ON NEXT 1M MAXSIZE 20M LOGGING EXTENT MANAGEMENT LOCAL
        AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO;  
      
      Tablespace created.
      
      qr01db_SQL> SELECT tablespace_name, logging, bigfile 
                  FROM dba_tablespaces WHERE tablespace_name like 'DBFS%'; 
      
      TABLESPACE_NAME             LOGGING   BIG
      --------------------------- --------- ---
      DBFS_OGG_BIG                LOGGING   YES
      DBFS_OGG_SMALL              LOGGING   YES
      
      qr01db_SQL> SELECT table_name, segment_name, cache, logging 
                  FROM dba_lobs WHERE tablespace_name like 'DBFS%'; 
      no rows selected
      
      qr01db_SQL> CREATE USER dbfs_user IDENTIFIED BY dbfs_pswd 
                DEFAULT TABLESPACE dbfs_ogg_big
                QUOTA UNLIMITED ON dbfs_ogg_big QUOTA UNLIMITED ON dbfs_ogg_small; 
      User created.
      
      qr01db_SQL> GRANT create session, create table, create view, 
                create procedure, dbfs_role TO dbfs_user; 
      Grant succeeded.
      
      qr01db_SQL> exit 
      Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 
      64bit Production With the Partitioning, Real Application Clusters, Automatic 
      Storage Management, OLAP, Data Mining and Real Application Testing options
      [oracle@qr01db02 ~]$ 
                                                                                      
      

      请注意第二个SELECT显示没有 Lob 尚存在。这将会改变下, 一步。

      这样就完成了准备 DBFS 的数据库。关于 DBFS 的详细信息,请参阅大型对象 (Lob)文档.

    这样就完成了准备环境。

2. Preparing Database File System (DBFS)

    目标

    本练习的目标是:

    • 创建到房子 DBFS 的 LOB 表。
    • 创建操作系统装入点和目录结构。
    • 启动 OS 客户端使用 DBFS。

    2.1 创建到房子 DBFS LOB 表

      它是重要的是要运行的脚本将在客户端启动时 (步骤 2.3.1 和 2.3.2 步) 中指定的同一用户身份在此案例dbfs_user当运行 SQL @dbfs脚本,确保他们有没有额外的换行符在参数中 (即使它们显示在示例中的换行符)。

      Exadata-节点 2 (目标)
      [oracle@qr01db02 ~]$ cd $ORACLE_HOME/rdbms/admin 
      [oracle@qr01db02 admin]$ sqlplus dbfs_user/dbfs_pswd 
      
      SQL*Plus: Release 11.2.0.2.0 Production on Wed Feb 27 10:37:45 2013
      Copyright (c) 1982, 2010, Oracle.  All rights reserved.
      Connected to:
      Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
      With the Partitioning, Real Application Clusters, Automatic Storage Management, 
      OLAP, Data Mining and Real Application Testing options
      
      qr01db_SQL> @dbfs_create_filesystem_advanced.sql dbfs_ogg_big dbfs_big 
                  nocompress nodeduplicate noencrypt non-partition 
      qr01db_SQL> Rem
      qr01db_SQL> Rem $Header: rdbms/admin/dbfs_create_filesystem_advanced.sql /main/4 
                  2010/04/14 13:21:30 weizhang Exp $
      qr01db_SQL> Rem
      qr01db_SQL> Rem dbfs_create_filesystem.sql
      qr01db_SQL> Rem
      qr01db_SQL> Rem Copyright (c) 2009, 2010, Oracle and/or its affiliates.
      qr01db_SQL> Rem All rights reserved.
      qr01db_SQL> Rem
      qr01db_SQL> Rem NAME
      qr01db_SQL> Rem  dbfs_create_filesystem_advanced.sql - DBFS create filesystem
      qr01db_SQL> Rem
      qr01db_SQL> Rem DESCRIPTION
      qr01db_SQL> Rem  DBFS create filesystem script
      qr01db_SQL> Rem  Usage: sqlplus @dbfs_create_filesystem_advanced.sql
      qr01db_SQL> Rem            
      qr01db_SQL> Rem           
      qr01db_SQL> Rem            
      qr01db_SQL> Rem            Rem            partition-by-guid, partition-by-path>
      qr01db_SQL> Rem
      qr01db_SQL> Rem NOTES
      qr01db_SQL> Rem
      qr01db_SQL> Rem    MODIFIED   (MM/DD/YY)
      qr01db_SQL> Rem    weizhang    03/11/10 - bug 9220947: tidy up
      qr01db_SQL> Rem    weizhang    06/12/09 - Package name change
      qr01db_SQL> Rem    weizhang    04/06/09 - Created
      qr01db_SQL> Rem
      qr01db_SQL> 
      qr01db_SQL> SET ECHO OFF
      No errors.
      --------
      CREATE STORE:
      begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_DBFS_BIG', tbl_name =>
      'T_DBFS_BIG', tbl_tbs => 'dbfs_ogg_big', lob_tbs => 'dbfs_ogg_big', do_partition
      => false, partition_key => 1, do_compress => false, compression => '', do_dedup
      => false, do_encrypt => false); end;
      --------
      REGISTER STORE:
      begin dbms_dbfs_content.registerStore(store_name=> 'FS_DBFS_BIG', provider_name
      => 'sample1', provider_package => 'dbms_dbfs_sfs'); end;
      --------
      MOUNT STORE:
      begin dbms_dbfs_content.mountStore(store_name=>'FS_DBFS_BIG',
      store_mount=>'dbfs_big'); end;
      --------
      CHMOD STORE:
      declare m integer; begin m := dbms_fuse.fs_chmod('/dbfs_big', 16895); end;
      No errors.
      
      qr01db_SQL> @dbfs_create_filesystem_advanced.sql dbfs_ogg_small dbfs_sm 
                  nocompress nodeduplicate noencrypt non-partition 
      No errors.
      --------
      CREATE STORE:
      begin dbms_dbfs_sfs.createFilesystem(store_name => 'FS_DBFS_SM', tbl_name =>
      'T_DBFS_SM', tbl_tbs => 'dbfs_ogg_small', lob_tbs => 'dbfs_ogg_small',
      do_partition => false, partition_key => 1, do_compress => false, compression =>
      '', do_dedup => false, do_encrypt => false); end;
      --------
      REGISTER STORE:
      begin dbms_dbfs_content.registerStore(store_name=> 'FS_DBFS_SM', provider_name
      => 'sample1', provider_package => 'dbms_dbfs_sfs'); end;
      --------
      MOUNT STORE:
      begin dbms_dbfs_content.mountStore(store_name=>'FS_DBFS_SM',
      store_mount=>'dbfs_sm'); end;
      --------
      CHMOD STORE:
      declare m integer; begin m := dbms_fuse.fs_chmod('/dbfs_sm', 16895); end;
      No errors.
      
      qr01db_SQL> conn / as sysdba 
      Connected.
      qr01db_SQL> SELECT tablespace_name, file_name FROM dba_data_files 
                  WHERE tablespace_name LIKE 'DBFS%'; 
      
      TABLESPACE_NAME  FILE_NAME
      ---------------  --------------------------------------------------
      DBFS_OGG_BIG     +DBFS_DG/dbm/datafile/dbfs_ogg_big.256.808464609
      DBFS_OGG_SMALL   +DBFS_DG/dbm/datafile/dbfs_ogg_small.257.808464635
      
      qr01db_SQL> SELECT table_name, segment_name, cache, logging FROM dba_lobs 
                  WHERE tablespace_name like 'DBFS%'; 
      
      TABLE_NAME              SEGMENT_NAME                CACHE     LOGGING
      ----------------------- --------------------------- --------- -------
      T_DBFS_BIG              LOB_SFS$_FST_1              NO        YES
      T_DBFS_SM               LOB_SFS$_FST_11             NO        YES
      qr01db_SQL> ALTER TABLE dbfs_user.T_DBFS_SM 
                  MODIFY LOB (FILEDATA) (CACHE LOGGING); 
      qr01db_SQL> SELECT table_name, segment_name, cache, logging FROM dba_lobs 
                  WHERE tablespace_name like 'DBFS%';  
      
      TABLE_NAME              SEGMENT_NAME                CACHE     LOGGING
      ----------------------- --------------------------- --------- -------
      T_DBFS_BIG              LOB_SFS$_FST_1              NO        YES
      T_DBFS_SM               LOB_SFS$_FST_11             YES       YES
      qr01db_SQL> exit 
      Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 
      64bit Production With the Partitioning, Real Application Clusters, Automatic 
      Storage Management, OLAP, Data Mining and Real Application Testing options
      [oracle@qr01db02 admin]$
                                                                                      
      

      ALTER TABLE变化较小的 DBFS 使用缓存。这是为小小的检查点的表很有用。没有缓存的更大的 DBFS 默认,更好地适合顺序阅读和写作,所使用的轨迹文件。

      这样就完成了创建 DBFS LOB 的表。

    2.2 创建装入点和目录结构

      DBFS 住在共享存储单元格上。

      你可以找到任何地方的 DBFS,公约 》 下/mnt.

      Exadata-节点 2 (目标)
      [oracle@qr01db02 ~]$ su - root 
      Password: 
      [root@qr01db02 ~]# cd /mnt 
      [root@qr01db02 mnt]# mkdir DBFS 
      [root@qr01db02 mnt]# ll  
      total 4
      drwxr-xr-x 2 root root 4096 Feb 27 10:34 DBFS
      [root@qr01db02 mnt]# chown oracle:oinstall DBFS/ 
      [root@qr01db02 mnt]# ll 
      total 4
      drwxr-xr-x 2 oracle oinstall 4096 Feb 27 10:34 DBFS
      [root@qr01db02 mnt]# exit 
      [oracle@qr01db02 ~]$
                                                                                      
      

      您需要将root来创建它,但然后更改回oracle的所有权.

      即使 DBFS 本身是在共享存储上,装入点需要在两个节点上定义。

      Exadata-节点 1 (目标)
      [oracle@qr01db01 ~]$ su - root 
      Password: 
      [root@qr01db01 ~]# cd /mnt 
      [root@qr01db01 mnt]# mkdir DBFS 
      [root@qr01db01 mnt]# ll  
      total 4
      drwxr-xr-x 2 root root 4096 Feb 27 10:34 DBFS
      [root@qr01db01 mnt]# chown oracle:oinstall DBFS/ 
      [root@qr01db01 mnt]# ll 
      total 4
      drwxr-xr-x 2 oracle oinstall 4096 Feb 27 10:34 DBFS
      [root@qr01db01 mnt]# exit 
      [oracle@qr01db01 ~]$
                                                                                      
      

      这应该是所有 Exadata 节点上完全相同。

      这样就完成了创建挂载点和目录结构。

    2.3 启动 OS 客户端使用 DBFS

      虽然这些 DBFS 客户端启动手动作为概念证明的一部分,在生产中将定义这作为一种自动重新启动资源。

      dbfs_user匹配步 2.1.1 中定义脚本的用户。Exadata 目标节点 2 上启动 DBFS 客户端。不要按输入在键入的nohup命令,都应该在一个逻辑行。然而,它的答复后,"appending output to nohup.out",您不必按 Enter,再把控制返回给操作系统提示符。

      Exadata-节点 2 (目标)
      [oracle@qr01db02 ~]$ cd ~ 
      [oracle@qr01db02 ~]$ echo dbfs_pswd > passwd.txt 
      [oracle@qr01db02 ~]$ nohup $ORACLE_HOME/bin/dbfs_client dbfs_user@dbm 
                           -o allow_other,direct_io /mnt/DBFS < ~/passwd.txt & 
      [1] 5670
      [oracle@qr01db02 ~]$ nohup: appending output to `nohup.out'
      
      [oracle@qr01db02 ~]$ ll /mnt/DBFS/ 
      total 0
      drwxrwxrwx 3 root root 0 Feb 27 10:39 dbfs_big
      drwxrwxrwx 3 root root 0 Feb 27 10:40 dbfs_sm
      [oracle@qr01db02 ~]$ df -k 
      Filesystem           1K-blocks      Used Available Use% Mounted on
      /dev/xvda2             8022104   2639960   4968072  35% /
      /dev/xvda1              101086     130
            
            
            
      声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。