溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

如何部署goldengate

發(fā)布時(shí)間:2022-01-14 17:56:36 來源:億速云 閱讀:211 作者:小新 欄目:關(guān)系型數(shù)據(jù)庫

這篇文章將為大家詳細(xì)講解有關(guān)如何部署goldengate,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。

一、安裝redhat4,安裝步驟略

二、安裝oracle10g 安裝步驟略

三、安裝goldengate,注意要選對(duì)版本

    1、源端安裝配置

       1.1安裝goldengate
        
         linux: mkdir /u01/oracle/ggate
                cd /u01/oracle/ggate

         通過ftp,將goldengate的zip軟件上傳到/u01/oracle/ggate

                unzip 解壓,將生成一個(gè)tar文件

                tar -xvf *.tar

       1.2配置.bash_profile
         
               vi .bash_profile
               添加:
               export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/oracle/ggate
               export GGATE_HOME=/u01/oracle/ggate

               注意LD_LIBRARY_PATH,那一行,可以在原來安裝oracle的基礎(chǔ)上添加在后面便可

               配置完,運(yùn)行 source ~./bash_profile

       1.3創(chuàng)建goldengate目錄

               cd /u01/oracle/ggate

               ./ggsci  (進(jìn)入goldengate命令行界面)

              Oracle GoldenGate Command Interpreter for Oracle
              Version 11.1.1.0.0 Build 078
              Linux, x86, 32bit (optimized), Oracle 10 on Jul 28 2010 13:24:18
              Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved


               現(xiàn)在在goldengate命令行工作
              
               create subdirs

       1.4配置數(shù)據(jù)庫歸檔模式,進(jìn)入sql命令行(如果關(guān)閉,建議開啟)

               sqlplus "/as sysdba"

               alter system set log_archive_format='%s_%t_%r.log' scope=spfile;
      
               alter system set log_archive_dest_1='location=/u02/oracle/arc';

               shutdown immediate;

               startup mount;

               alter database archivelog;

               alter database open;

               alter database force logging;

               ----取消用  alter database no force logging;

               這下可以看一下歸檔是否已經(jīng)起來,archive log list

        1.5開啟minimal supplemental logging

               alter database add supplemental log data(primary key,unique) columns;

              
        1.6關(guān)閉回收站

               alter system set recyclebin=off scope=spfile;
           

        1.7配置復(fù)制的DDL支持

                創(chuàng)建用戶授權(quán):

                create user ggate identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;

                grant connect,resource,dba to ggate;

                grant execute on utl_file to ggate;

                grant restricted session to ggate;
              
                               
               @$GGATE_HOME/marker_setup.sql;

               SCHEMA:GGATE

               @$GGATE_HOME/ddl_setup.sql;

               這里要看清楚,選擇輸入,否則會(huì)有問題!

               @$GGATE_HOME/role_setup.sql;

               授予角色權(quán)力:
               grant GGS_GGSUSER_ROLE to ggate;

               @$GGATE_HOME/ddl_enable.sql;

         1.8創(chuàng)建源端用戶(用于同步的用戶)

                create user sender identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;

                grant dba,connect,resource to ggate;

                grant select on v_$session to ggate;

    2、源端復(fù)制隊(duì)列配置

         2.1配置manager

            cd /u01/oracle/ggate           

            ./ggsci   (進(jìn)入goldengate命令行)


            edit params mgr

            輸入:PORT 7809

            與vi操作基本相同

          2.2配置源端復(fù)制隊(duì)列
            
             同樣是在goldengate命令行里做

             add extract ext1, tranlog, begin now

             add exttrail /u01/oracle/ggate/dirdat/lt, extract ext1

             edit params ext1
             輸入如下內(nèi)容:
             extract ext1
             userid ggate, password ggate     
             rmthost 目標(biāo)機(jī), mgrport 7809
             rmttrail /u01/oracle/ggate/dirdat/lt
             ddl include mapped objname sender.*;
             table sender.*;

             到這里,可以用info all查看一下,

             關(guān)閉進(jìn)程:
             stop mgr
             stop ext1

    到這里源端基本上配置完畢


    3、目標(biāo)端安裝配置

       3.1安裝goldengate
        
         linux: mkdir /u01/oracle/ggate
                cd /u01/oracle/ggate

         通過ftp,將goldengate的zip軟件上傳到/u01/oracle/ggate

                unzip 解壓,將生成一個(gè)tar文件

                tar -xvf *.tar

       3.2配置.bash_profile
         
               vi .bash_profile
               添加:
               export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/oracle/ggate
               export GGATE_HOME=/u01/oracle/ggate

               注意LD_LIBRARY_PATH,那一行,可以在原來安裝oracle的基礎(chǔ)上添加在后面便可

               配置完,運(yùn)行 source ~./bash_profile

       3.3創(chuàng)建goldengate目錄

               cd /u01/oracle/ggate

               ./ggsci  (進(jìn)入goldengate命令行界面)

              Oracle GoldenGate Command Interpreter for Oracle
              Version 11.1.1.0.0 Build 078
              Linux, x86, 32bit (optimized), Oracle 10 on Jul 28 2010 13:24:18
              Copyright (C) 1995, 2010, Oracle and/or its affiliates. All rights reserved


               現(xiàn)在在goldengate命令行工作
              
               create subdirs

        3.4創(chuàng)建目標(biāo)端用戶

               create user ggate identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;

               create user receiver identified by ggate default tablespace users temporary tablespace temp quota unlimited on users;(接收同步的用戶)

                grant connect,resource,dba to ggate;

                grant execute on utl_file to ggate;

                grant restricted session to ggate;

                grant connect,resource,dba to receiver;

                grant select on v_$session to receiver;

        3.5配置replicat

               ./ggsci

               edit params ./GLOBALS

               輸入:
               GGSCHEMA ggate
               CHECKPOINTTABLE ggate.checkpoint
              
               edit params mgr

               輸入:PORT 7809
              
               在goldengate命令行登錄數(shù)據(jù)庫

                dblogin userid ggate,password ggate

                add checkpointtable ggate.checkpoint (增加檢測(cè)點(diǎn))

                add replicat rep1, exttrail /u01/oracle/ggate/dirdat/lt, checkpointtable ggate.checkpoint(增加同不隊(duì)列)

                edit params rep1

                添加如下內(nèi)容:
                replicat rep1
                ASSUMETARGETDEFS
                userid ggate, password ggate
                discardfile /u01/oracle/ggate/dirdat/rep1_discard.txt, append, megabytes 10
                DDL include all
                map sender.*, target receiver.*;


     到這里上標(biāo)端配置基本結(jié)束


四、額外增加的一個(gè)步驟,我是這樣做

      分別在源端、目標(biāo)端增加
     
      mkdir -p /u01/oracle/ggate/dirdat/lt

五、在goldengate命令行開啟

        源端:start manager
              start ext1


        目標(biāo):start manager
              start rep1

六、測(cè)試:

    源端:create table sender.test(empid number(4),names varchar2(10),oldage number(3));
   
    目標(biāo):select * from receiver.test;

關(guān)于“如何部署goldengate”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI