Oracle GoldenGate学习笔记(简体、繁体)

合集下载

Oracle GoldenGate 官方学习文档

Oracle GoldenGate 官方学习文档

Oracle GoldenGate for Oracle to OracleObjectiveUpon completion of this lesson, you will be able to keep two Oracle databases synchronized.During this lesson, you will:⏹Prepare the database and the Oracle GoldenGate environment.⏹Configure and execute the initial data load process⏹Configure and start the change capture of database operations.⏹Configure and start the change delivery process.Oracle to Oracle configurationThe following diagram illustrates Oracle GoldenGate installed on two systems connected by TCP/IP– one containing the source data and the other the replicated data.Overview of tasksPrepare the EnvironmentIn order to execute this lesson, the GoldenGate application must be installed on both the source and target systems. The installation includes a sample database and scripts to generate initial data as well as subsequent update operations. The source and target tables are createdand loaded with initial data. The GoldenGate Manager processes are also started so that other processes may be configured and started.Configure Initial Data LoadTo initially load data, there are techniques such as Backup/Restore or Export/Import, both of which have pros and cons. Or you may use the GoldenGate application to perform your initial data load while the application remains active. This lesson demonstrates using Extract to pull data from the source tables and sending the data directly to the Replicat on the target system.Configure Change CaptureFor log-based Oracle capture, the capture process is configured to capture change data directly from the Oracle online redo logs or archive logs and store the changes in queues known as GoldenGate remote trails.Configure Change DeliveryOnce the tables have been initially loaded with data, the delivery process is configured to deliver the captured change data into the target database.Exercise 1.Prepare the EnvironmentObjectiveThe goals of this exercise are to:⏹Configure and start the Manager processes⏹Create and load practice data to Oracle tables⏹Add supplemental loggingPrepare your Oracle source environment1. Configure the Manager process on the sourceOn the <source> system, create the Manager parameter file and specify the port it should use.❍Create the Manager parameter file.Shell> cd <install location>Shell> ggsciGGSCI> EDIT PARAMS MGR❍Use the editor to assign a port.❍Start the Manager.GGSCI> START MGR❍Verify that the Manager has started.GGSCI> INFO MGR2. Create the source tables and load the initial data.Using SQL*Plus, create and populate the TCUSTMER and TCUSTORD tables by running the demo_ora_create.sql and demo_ora_insert.sql files found in the install directory.Execute the following commands on the <source> system.Shell> cd <install location>Shell> sqlplus <login>/<password>SQL> @demo_ora_createSQL> @demo_ora_insertVerify the results:SQL> select * from tcustmer;SQL> select * from tcustord;SQL> exit3. Add supplemental loggingUsing GGSCI, log in to the database on the <source> and turn on supplemental logging for the TCUSTMER and TCUSTORD tables.Shell> ggsciGGSCI> DBLOGIN USERID <login>, PASSWORD <password>GGSCI> ADD TRANDATA <owner/schema>.TCUSTMERGGSCI> ADD TRANDATA <owner/schema>.TCUSTORDVerify that supplemental logging has been turned on for these tables.GGSCI> INFO TRANDATA <owner/schema>.TCUST*Prepare your target Oracle environmentConfigure the Manager1. Configure the Manager process on the target systemExecute the following commands on the <target> system.❍Start the command interfaceShell> cd <install location>Shell> ggsci❍Specify the port that the Manager should use.GGSCI> EDIT PARAMS MGR❍Start ManagerGGSCI> START MANAGERVerify the results:GGSCI> INFO MANAGERCreate the tables2. Create target Oracle tablesExecute the following commands on the <target> system to run the script that creates the tables.Shell> cd <install location>Shell> sqlplus <login>/<password>SQL> @demo_ora_createVerify the results:SQL> desc tcustmer;SQL> desc tcustord;SQL> exitExercise 2.Initial Data Load using Direct Load MethodObjectiveThe goals of this exercise are to:⏹Configure a task to load the initial data from a source table⏹Configure the delivery of the data to the target⏹Execute the initial load of data.Initial data capture1. Add the initial load capture batch task groupExecute the following commands on the <source> system to create an Extract named EINI<unique id>1.GGSCI> ADD EXTRACT EINI<unique id>, SOURCEISTABLEVerify the result:GGSCI> INFO EXTRACT *, TASKS2. Configure the initial load capture parameter fileExecute the following commands on the <source> system.GGSCI> EDIT PARAMS EINI<unique id>1 The process names used in lab exercises, for example EINIBD, are made up of 1) one character for the GoldenGate process (E for Extract, R for Replicat); 2) three or four to describe the process type (INI for initial data load, ORA for capture from or delivery to an Oracle database, etc.) and 3) two characters to create a unique identifier (usually your initials)..Initial data delivery3. Add the initial load delivery batch taskExecute the following commands on the <target> system.GGSCI> ADD REPLICAT RINI<unique id>, SPECIALRUN Verify the results:GGSCI> INFO REPLICAT *, TASKS4. Configure the initial load delivery parameter fileExecute the following commands on the <target> system.GGSCI> EDIT PARAMS RINI<unique id>5. Execute the initial load processExecute the following commands on the <source> system.GGSCI> START EXTRACT EINI<unique id>Verify the results on the <source> system:GGSCI> VIEW REPORT EINI<unique id>Verify the results on the <target> system:GGSCI> VIEW REPORT RINI<unique id>Exercise 3.Configure Change CaptureObjectiveThe goals of this exercise are to:⏹Configure and add the Extract process that will capture changes.⏹Add the trail that will store the changes.⏹Start the Extract process.Configure change capture1. Add the Extract groupExecute the following command on the <source> system to add an Extract group named EORA<unique id>.GGSCI> ADD EXTRACT EORA<unique id>, TRANLOG, BEGIN NOW, THREADS <instances>Verify the results:GGSCI> INFO EXTRACT EORA<unique id>2. Create the Extract parameter fileExecute the following commands on the <source> system.GGSCI> EDIT PARAM EORA<unique id>Note: Record the two characters selected for your <trail id>: ______. You will need this in the next step and when you set up the Replicat.Note: When Oracle Automatic Storage Management (ASM) is in use, the TRANLOGOPTIONS ASMUSER and ASMPASSWORD must be set in the Extract parameter file. For more information refer to the GoldenGate for Windows & UNIX Administrator and Reference manuals.3. Define the GoldenGate trailExecute the following command on the <source> to add the trail that will store the changes on the target.GGSCI> ADD RMTTRAIL ./dirdat/<trail id>, EXTRACT EORA<unique id>, MEGABYTES 5Verify the results:GGSCI> INFO RMTTRAIL *4. Start the capture processGGSCI> START EXTRACT EORA<unique id>Verify the results:GGSCI> INFO EXTRACT EORA<unique id>, DETAILGGSCI> VIEW REPORT EORA<unique id>Discussion points1. Identifying a remote systemWhat parameter is used to identify the remote target system?_________________________________________________________________________ 2. Sizing the GoldenGate trailWhere do you set how large a GoldenGate trail file may get before it rolls to the next file?What option do you use?_________________________________________________________________________ _________________________________________________________________________Exercise 4.Configure Change DeliveryObjectiveThe goals of this exercise are to:⏹Set up the checkpoint table on the target system.⏹Create a named group that includes the Replicat process and the checkpoint tables.⏹Configure the Replicat group by adding parameters.⏹Start the Replicat group.Set up the checkpoint table1. Create a GLOBALS file on the target systemExecute the following commands on the <target> system.❍Create and edit the GLOBALS parameter file to add the checkpoint table.Shell> cd <install location>Shell> ggsciGGSCI> EDIT PARAMS ./GLOBALSIn the text editor, type:❍Record the checkpoint table owner and name, then save and close the file.Table owner ____________________ name ___________________Note: You could name the table anything you want, but for training purposes we areusing ggschkpt.❍Verify that the GLOBALS file was created in the root GoldenGate directory, and remove any file extension that was added.2. Activate the GLOBALS parametersFor the GLOBALS configuration to take effect, you must exit the session in which the changes were made. Execute the following command to exit GGSCI.GGSCI> EXIT3. Add a Replicat checkpoint tableOn the <target> system, execute the following commands in GGSCI:Shell> cd <install location>Shell> ggsciGGSCI> DBLOGIN USERID <login>, PASSWORD <password>GGSCI> ADD CHECKPOINTTABLEConfigure Change Delivery4. Add the Replicat groupExecute the following command on the <target> system to add a delivery group namedRORA<unique id>.GGSCI> ADD REPLICAT RORA<unique id>, EXTTRAIL ./dirdat/<trail id> Note: Refer to your Extract set up for the correct two-character <trail id>.5. Create Replicat parameter fileExecute the following commands on the <target> system to bring up the parameter file in the editor.GGSCI> EDIT PARAM RORA<unique id>Type in the following parameters6. Start the Replicat processGGSCI> START REPLICAT RORA<unique id>Verify the results:GGSCI> INFO REPLICAT RORA<unique id>Discussion pointsSearch in the Windows/UNIX Reference Guide for the information on the followingquestions.1. When to use HANDLECOLLISIONSWhen would you use HANDLECOLLISIONS? What does it do?_________________________________________________________________________ _________________________________________________________________________2. When should you use ASSUMETARGETDEFS?_________________________________________________________________________ _________________________________________________________________________3. What is the purpose of the DISCARDFILE?_________________________________________________________________________ ________________________________________________________________________Exercise 5.Generate Activity and Verify ResultsObjectiveThe goals of this exercise are to:⏹Execute miscellaneous update, insert, and delete operations on the source system.⏹Verify the delivery of the changes to the target⏹Turn off the error handling used for initial load.Generate database operations1. Execute miscellaneous update, insert, and delete operationsExecute the following commands on the <source> system.Shell> cd <install location>Shell> sqlplus <login>/<password>SQL> @demo_ora_miscVerify change capture and delivery2. Verify results on the source systemExecute the following commands on the <source> system.SQL> select * from tcustmer;SQL> select * from tcustord;SQL> exitShell> ggsciGGSCI> SEND EXTRACT EORA<unique id>, REPORTGGSCI> VIEW REPORT EORA<unique id>3. Verify your results on the target systemExecute the following commands on the <target> system to verify the target data.Shell> cd <install location>Shell> sqlplus <userid>/<password>SQL> select * from tcustmer;SQL> select * from tcustord;SQL> exitShell> ggsciGGSCI> SEND REPLICAT RORA<unique id>, REPORTGGSCI> VIEW REPORT RORA<unique id>Turn off error handling4. Turn off initial load error handling for the running delivery processGGSCI> SEND REPLICAT RORA<unique id>, NOHANDLECOLLISIONS 5. Remove initial load error handling from the parameter fileGGSCI> EDIT PARAMS RORA<unique id>Remove the HANDLECOLLISIONS parameter.Exercise Name。

Oracle GoldenGate技术详解

Oracle GoldenGate技术详解

Oracle GoldenGate技术详解<Insert Picture Here>Agenda •Oracle GoldenGate 整体架构•各模块的作用和结构•Filter/Map &转换•初始装载•高可用性结构•使用方法(Oracle Database to Oracle Database )•注意事项Manager源端Trail 文件: 保存变更信息的中间文件Extract (Capture ): 从REDO 日志文件获取变更信息,以最小10ms 间隔读取Redo 日志,将变更信息输出到Trail 文件Extract (Data Pump ): 变更信息的传输读取Trail 文件,将变更信息传输到远端REDO (Archive )日志文件Trail TrailExtract (Data Pump )Replicat端DB源DBNetwork(TCP/IP)Collector ManagerManager:管理GoldenGate 整体各进程的起动/停止、监视/管理Capture (Capture )Collector:接收Extract 传输过来的数据存为Trail 文件远程Trail 文件:保存变更信息的中间文件Replicat: 从Trail 文件获得变更信息,转换成目标DB 的SQL 语句在目标DB 上运行(以行为单位)TrailTrailExtractExtractReplicat端DB源DB Network (TCP/IP)Collector双向可同等配置,实现双向复制TrailTrailExtractExtractReplicat源DBNetwork (TCP/IP)CollectorTrailTrailCollectorExtractNetwork (TCP/IP)Oracle GoldenGate 的部署通过Capture/Data Pump、Replicat的各种组合灵活配置多主复制单向双向(Active-Active)分发集中多层分发<Insert Picture Here>Agenda •Oracle GoldenGate 整体架构•各模块的作用和结构•Filter/Map &转换•初始装载•高可用性结构•使用方法(Oracle Database to Oracle Database )•注意事项各模块结构TrailTrailExtract (主)Extract (Data Pump )Replicat端DB源DBNetwork(TCP/IP)Collector ManagerManagerExtract (Capture )-获取DB 的变更信息的变更信息--Extract (Capture )Extract (Capture )‐Extract 的两个功能的两个功能‐‐Extract(Capture)源DBREDO归档日志Trail 文件(本地本地))Extract (data Pump )Trail 文件(远程远程))Trail 文件(远程远程))Network (TCP/IP)Network (TCP/IP)•Extract 的功能•Capture从REDO/归档日志取得DB 的变更信息输出到Trail 文件•Data Pump将Trail 文件传输到远端机器Extract (Capture )‐DB 变更信息的获取变更信息的获取((1)-Extract源DBREDO归档日志•变更信息的来源在线REDO 日志(缺省)归档日志(Windows 环境的缺省)•取得的信息主键(或唯一键)的值 变更前后的值•注意:数据库并不要求必须是归档模式附加日志模式下主键和变更值输出到REDO 日志将DB 设为附加日志模式(将主键的值输出到REDO 日志日志))変更変更值值+主键值Extract (Capture )‐DB 变更信息的获取变更信息的获取((2)-Extract (Capture )源DBREDO归档日志•获取方法•以一定间隔读取REDO 日志,获取变更信息•间隔:用参数(EOFDELAY or EOFDELAYCSECS )设置•缺省:1秒、最小:10 毫秒•变更信息的输出•输出位置:本地或者远程的Trail 文件•输出时机:满足以下任一条件•Extract 的缓冲区(内存)写满的话•设置参数(FLUSHSECS or FLUSHCSECS )来指定间隔•缺省:1秒、最小:10毫秒最小最小以以10毫秒间隔定期获取变更信息缓冲缓冲((内存内存))写满or最小最小以以10毫秒间隔输出Trail 文件Extract(Capture)‐双向复制双向复制•双向复制场合的注意事项•为避免重复应用、应设置不捕获GoldenGate(Replicat)的SQL语句通过Extract(Capture)的参数可指定GETAPPLOPS /IGNOREAPPLOPS指定捕获/忽略Replicat以外的更新数据库进程的动作GETREPLICATES /IGNOREREPLICATES指定捕获/忽略Replicat对数据库的更新动作各组件的结构Trail Trail Replicat端DB源DBNetwork (TCP/IP)Collector (Server)Manager ManagerExtract (Data Pump )→ Collector-数据库变更信息的收发-Data Pump &CollectorExtract (Capture )Extract (Data Pump )Collector‐变更信息的收发变更信息的收发‐‐Extract(Data Pump )Trail 文件Network (TCP/IP)从Extract 向Collector 发送、输出Trail 文件•发送间隔:满足以下任一条件•缓存写满的时候Extract 的RMHOST 参数(TCPBUFSIZE 选项)可指定缓存尺寸缺省:30,000Byte•参数(FLUSHSECS or FLUSHCSECS )的指定间隔缺省:1秒、最小:10毫秒数据•发送时数据可压缩CollectorManager①请求②起动(动态分配端口动态分配端口,,起动进程起动进程))Data Pump‐变更信息的发送变更信息的发送((两种方式两种方式))‐Extract(Capture )Trail 文件(本地本地))Extract (data Pump )Trail 文件(远程远程))Trail 文件(远程远程))Network(TCP/IP)Network (TCP/IP)方式1:另外起动发送专用的Extract (即Data Pump )•先保存到本地的Trail 文件然后发送方式2:一个Extract 兼Capture 和Data Pump 之职•从REDO 日志取得信息然后直接向远端发送REDO方式2方式1CollectorCollectorData Pump‐多个目标发送(两种方式两种方式))‐ExtractTrail文件(本地本地))Extract(data Pump)Trail文件(远程远程))Trail文件(远程远程))Network(TCP/IP)方式2:采用一个Data Pump向多个目标发送的方式有一个进程停止的话就整体停止Extract Trail文件(本地本地))Extract(data Pump)Trail文件(远程远程))Trail文件(远程远程))Network(TCP/IP)推荐方式1:每个目标起动一个Data Pump的方式一个进程停止的话也不会影响整体CollectorCollectorCollectorCollector各部件的结构Trail TrailReplicat端DB源DBNetwork(TCP/IP)Collector Manager ManagerReplicat-应用到数据库-ReplicatExtract (Capture )Extract (Data Pump )Replicat ‐Replicat 的功能‐•Replicat 的功能•从Trail 文件生成SQL 语句在目标DB 执行•以变更的行为单位生成SQL 语句、执行•基于主键(或唯一键)和变更前的值(可选)更新(主键或唯一键的值是在源端通过附加日志方式从日志中获得)TrailReplicat端DB各部件结构Trail TrailReplicat端DB源DBNetwork(TCP/IP)CollectorManagerManagerManager-GoldenGate 整体的监控/管理-ManagerExtract (Capture )Extract (Data Pump )ManagerManager ‐GoldenGate 整体的监控/管理‐•Manager 的作用Trail 文件的管理•Trail 文件的生成/删除 进程的监控/管理•定期监控进程•进程的启动/停止、再启动 GoldenGate 整体的监控/报表执行用户的命令TrailTrailReplicat端DBNetwork (TCP/IP)CollectorExtract (Capture )Extract (Data Pump )源DBManagerManagerManager整体的监控/管理 ‐ GoldenGate整体的监控 管理 ‐ 整体的监控• Manager与各部件之间通信 • UI ⇔ Manager : TCP/IP • Extract/Replicat ⇔ Manager(本地) :共享内存• 各进程状况(如处理完的检查点等等)都保存在共享内存, Manager查询后产生相关报表• Extract(Data Pump)⇔ Manager(远端):TCP/IPGGSCI(命令行) or GUI (命令行)TCP/IP参考处理状況生成报表 参考处理状況生成报表 状況 共享内存 ・进程状况状况随时更新ManagerExtract/Replicat21Agenda • • • • • • • Oracle GoldenGate 整体架构 各模块的作用和结构 <Insert Picture Here> Filter/Map & 转换 初始装载 高可用性结构 使用方法(Oracle Database to Oracle Database) 注意事项22Filter/Map&变换 &• 可以配置Filter/Map以及变换的部件 Capture(推荐) Data Pump ReplicatFilter/Map & Transform Filter/Map & Transform Filter/Map & TransformNetwork (TCP/IP) DB Extract Trail Extract (Capture) ) (Data Pump) ) Collector Trail Replicat 端DB23Filter/Map&变换 & • 可配置的Filter/Map&变换(1)表:以表为单位指定例:MAP scott.emp TARGET james.emp MAP scott.* TARGET james.* (支持通配符)列:仅指定特定的列例:MAP scott.emp TARGET james.emp COLS (empno, ename) MAP scott.emp TARGET james.emp COLEXCEPT (salgrade)24Filter/Map&变换 &• 可配置的Filter/Map&变换(2) 行:指定满足特定条件的行 可以在特定操作(UPDATE或者INSERT等等)时来应用Filter 条件中可指定GoldenGate的函数和宏例:MAP scott.emp TARGET james.emp WHERE (sal > 100000); MAP scott.emp TARGET james.emp FILTER(ON UPDATE, @COMPUTE (sal * 100) > 100000);数据变换:可以对列进行映射和列值的变换 数据变换可以利用GoldenGate的函数和宏例:MAP hr.contact, TARGET hr.phone, COLMAP (USEDEFAULTS, name = cust_name, phone_number= @STRCAT( “(”, area_code, “)”, ph_prefix, “-”, ph_number) );注意: 注意:不支持多字节的列名或文字串作为条件25函数 • 主要函数 • 条件判断函数IF, CASE, EVAL, VALONEOF 等 例:FILTER (@IF (sal > 100, sal, 0) >100);• 文字列/数値操作函数COMPUTE, STRCAT, STRCMP, STRLEN, STRFIND等 注意: 注意:不支持对多字节文字列进行操作 例:FILTER (@STRLEN(ename ) > 40);• 日期函数DATE, DATENOW等 例:FILTER (hiredate > @DATENOW);26Agenda • • • • • • • Oracle GoldenGate 整体架构 各模块的作用和结构 <Insert Picture Here> Filter/Map & 转换 初始装载 高可用性结构 使用方法(Oracle Database to Oracle Database) 注意事项27初始装载( 初始装载(Init Load) ) • 初始装载的方法 • 利用数据库的功能• 传输表空间、备份/恢复、exp/imp等• 利用GoldenGate的功能GoldenGate的功能 的功能 File to Replicat File to Database Utility Direct load Direct bulk load Extract 的输出 Trail (GoldenGate格式) 文本文件 向Replicat直接传输 向Replicat直接传输 装载的方法 Replicat (SQL) Database utility Replicat(SQL) Replicat (SQL*Loader API)28在线初始化装载举例 • GoldenGate内部是按CSN(Change Sequence Number) 来管理事务的顺序的 • 指定CSN将特定时间的变更应用到目标端,以使源和目 标实现同步 • Step1. 在源端开始Capture时的CSN是222当前的CSN= 222CSN=222源DBCaptureTrailPumpTrail端DB29在线初始化装载举例 • Step2. 取得所有的事务的静止点 • Step3. 取得源DB的备份(RMAN Backup/传输表空间等等...) •当前的CSN= 245此时的CSN是245CSN=222开始源DBCaptureTrailPumpTrail 源DBCSN=245时的备份恢复CSN=245时的备份30在线初始化装载举例 • Step4. 通过Replicat从CSN=245开始应用Trail文件 • 与源DB同步到相同的状态,初始化装载结束当前的CSN= 300 CSN=222开始 应用CSN=245~300 部分源DBCaptureTrailPumpTrail 端DBTake Backup as of CSN 245Apply Backup as of CSN 24531Agenda • • • • • • • Oracle GoldenGate 整体架构 各模块的作用和结构 <Insert Picture Here> Filter/Map & 转换 初始装载 高可用性结构 使用方法(Oracle Database to Oracle Database) 注意事项32可用性‐故障解决‐ 故障解决‐• 各种故障的解决方法• GoldeGate的故障 • 进程故障 -> 进程自动重启 • Trail文件故障 -> Checkpoint • GoldenGate以外的故障 • 服务器/DB/网络的故障 -> Checkpoint自動重启 自動重启 自動重启 自動重启源DBExtract Trail Extract (Capture) (Data Pump) ) ) CheckpointNetwork (TCP/IP)Collector TrailReplicat端DBCheckpointCheckpoint33可用性‐进程故障的解决‐ 进程故障的解决‐• 由Manager重启GoldenGate的进程 • 対象进程Extract(Capture/Data Pump) Replicat 注意:Manager进程本身不会重启• 相关配置参数重试次数(缺省=2次) 等待时间(缺省= 20分) 等待重试次数清零的时间(缺省=20分)Manager 重启 重启Network (TCP/IP)Manager 重启源DBExtract Trail Extract (Capture) (Data Pump) ) )Collector TrailReplicat端DB34可用性文件/其他故障的解决 ‐Trail文件 其他故障的解决‐ 文件 其他故障的解决‐ 为解决Trail文件/服务器/网络故障、 GoldenGate使用Checkpoint机制• Checkpoint记录各进程处理到哪个位置的信息• Extract(Capture)最早未提交的事务的位置(SCN) 当前读取的更新位置(SCN) 已写到Trail文件的更新位置(SCN)• Extract(Data Pump)从Trail文件已读到的事务位置(SCN) 记录已写到远程Trail文件的位置• Replicat从Trail文件已读到的事务位置(SCN) 已反映到目标DB的位置• 故障恢复时,会参考Checkpoint从最后的处理位置重新开始35可用性‐Checkpoint‐ ‐最早Open的事务 的事务 最早 (未Commit)的开始点 )Begin, TX 1 Insert, TX 1 Begin, TX 2 Update, TX 1 Insert, TX 2 Commit, TX 2 Begin, TX 3 Insert, TX 3 Begin, TX 4 Commit, TX 3 Delete, TX 4Begin, TX 2 Insert, TX 2 Commit, TX 2Capture CheckpointBegin, TX 3 Insert, TX 3 Commit, TX 3当前Trail File的写 当前 的写 入点 当前的日志读 取点源DBCaptureTrail File36可用性Begin, TX 1 Insert, TX 1 Begin, TX 2 Update, TX 1 Insert, TX 2 Commit, TX 2 Begin, TX 3 Insert, TX 3 Begin, TX 4 Commit, TX 3 Delete, TX 4‐Checkpoint‐ ‐最早Open的事务 的事务 最早 (未Commit)的开始点 ) Pump CheckpointBegin, TX 2 Insert, TX 2 Commit, TX 2Begin, TX 2 Insert, TX 2 Commit, TX 2Capture CheckpointBegin, TX 3 Insert, TX 3 Commit, TX 3当前的Trail 当前的 File的读取点 的读取点当前的Trail 当前的 File的Write 点 的当前Trail File 当前 的写入点 当前的日志读 取点源DBCaptureTrail FilePumpTrail File37可用性‐Checkpoint‐ ‐Begin, TX 1 Insert, TX 1 Begin, TX 2 Update, TX 1 Insert, TX 2 Commit, TX 2 Begin, TX 3 Insert, TX 3 Begin, TX 4 Commit, TX 3 Delete, TX 4最早Open的事务 的事务 最早 (未Commit)的开始点 )Begin, TX 2 Insert, TX 2Pump CheckpointBegin, TX 2 Insert, TX 2 Commit, TX 2Delivery CheckpointCapture CheckpointCommit, TX 2 Begin, TX 3 Insert, TX 3 Commit, TX 3当前的Trail 当前的 File的读取点 的读取点当前的Trail File的 当前的 的 写入点当前的Trail File 当前的 的读取点当前Trail File 当前 的写入点 当前的日志读 取点Capture 源DBTrail FilePumpTrail FileReplicat 端DB38Agenda • • • • • • • Oracle GoldenGate 整体架构 各模块的作用和结构 <Insert Picture Here> Filter/Map & 转换 初始装载 高可用性结构 使用方法(Oracle Database to Oracle Database) 注意事项39安装步骤 • 安装 ① 介质下载包含在Fusion Middleware的Pack中 根据不同平台以及DB安装媒质也不同 源/端的服务器各自都要安装GoldenGate软件② 在安装的机器上解压• 解压到GoldenGate的安装目录 gzip -dc V18159-01.zip | tar -xvo③ 相关目录的生成• 在GoldenGate的安装目录下执行以下脚本 (利用GoldenGate的GGSCI)$ ./ggsci GGSCI () 1> CREATE SUBDIRS EXIT40备注页用GoldenGate 配置复制的例子以下环境下配置GoldenGate 复制•OS :Oracle Enterprise Linux 5、DB :11g R2•源/端主机名:ggdemo01a/ •源/端DB 名:db1 / db2•复制Schema :SCOTT (仅复制DML 操作)•GoldenGate 的DB 用户:用户名=“gg”、密码=”gg”•Capture 名:capdb1、Data Pump 名:pumpdb12、Replicat 名:repdb2•GoldenGate 安装目录:“/oracle/ggs/”Trail Trail Replicat Capture Pump SCOTT 用户源DB (db1)SCOTT 用户端DB(db2)配置步骤Step1.Manager的配置(源/端都要配置)•编辑参数文件•在GGSCI中执行以下命令编辑参数文件GGSCI> EDIT PARAM mgr参数文件例子:PORT 7809 <-Manager使用的端口号(必须)AUTORESTART ER*, WAITMINUTES 1, RETRIES 3<-指定Extract/Replicat进程的自动重启源端配置步骤Step2.源DB 的配置①指定需要复制的对象(在源端)(需要打开表级的附加日志方式)•在GGSCI 中对SCOTT 用户执行以下命令(预先配置ORACLE_HOME 和SID 等环境变量)②附加日志模式的设置(在源端)•用Sqlplus 登录到源DB 执行以下命令(需要用有ALTER SYSTEM 权限的用户登录)GGSCI> DBLOGIN USERID gg, PASSWORD ggGGSCI> ADD TRANDATA scott.*SQL>ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;SQL>ALTER SYSTEM SWITCH LOGFILE;Capture配置步骤Step3.Capture的配置(GGSCI中执行)①启动ManagerGGSCI> START MGR②增加Capture任务(capdb1)GGSCI> ADD EXTRACT capdb1, TRANLOG, BEGIN NOW③本地Trail文件的位置指定GGSCI> ADD EXTTRAIL /oracle/ggs/dirdat/lt, EXTRACT capdb1Capture 配置步骤配置步骤((续)④配置参数文件参数文件例-EXTRACT :Extract (Capture )名-SETENV :环境参数的配置(指定ORACLE_HOME 和SID )-USERID gg, PASSWORD gg :GoldenGate 使用的DB 用户名密码-EXTTRAIL /oracle/ggs/dirdat/lt :本地Trail 文件目录以及Prefix-TABLE :复制对象(用Schema.Table 名指定。

gg11g快速入门

gg11g快速入门

GoldenGate 11g快速入门一版本信息版本infoOS Version:Oracle Linux Release 6 Update 4 for x86_64 (64 Bit)Oracle Version:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production linux.x64_11gR2_database_1of2.zip + linux.x64_11gR2_database_2of2.zipGolden Gate Version:Oracle GoldenGate V11.2.1.0.1 for Oracle 11g on Linux x86-64ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zipVirtualbox Version:4.2.16总体架构图Oracle ---------> Oracle 单向复制Oracle <-------> Oracle 双向复制目录一版本信息 (1)二OGG简介 (3)三下载OGG软件包 (7)四Oracle to Oracle 单向复制(不使用数据泵) (9)五Oracle to Oracle 双向复制(数据泵模式) (19)二OGG简介引言:Oracle Golden Gate是Oracle旗下一款支持异构平台之间高级复制技术,是Oracle力推一种HA高可用产品,简称“OGG”,可以实现Active-Active 双业务中心架构Golden Gate 特点1.实时数据复制2.异构平台数据同步3.支持断点续传,不影响系统连续运行4.高性能,属于轻量级软件5.保证数据引用完整性和事物一致性6.整合ETL Tools Message Service7.灵活拓扑结构 1:1 1:N N:1 N:N 双向复制8.复制冲突检测和解决9.支持数据压缩和加密10.TCP/IP WAN LAN11.根据事务大小和数量自动管理内存12.支持多活业务中心13.以交易数据为单位复制,保证交易一致性14.支持数据过滤和转换,可自定义基于表和行的过滤规则,实时在异构环境下转换数据Golden Gate用途1.跨多版本数据库升级Oracle 8i ————————> Oracle 11G2.均衡负载Load Balance3.容灾Switchover4.支持异构平台数据交换,如下图所示Oracle Golden Gate拓扑结构Oracle Golden Gate 体系结构上图是最简单Golden Gate结构图,Golden Gate有源端和目标端,源端捕获日志发送到目标端应用,这个过程分为六步骤。

GoldenGate oracle

GoldenGate oracle

GoldenGate原理及体系结构
Parameters, Process Groups and GGSCI
• extract 和replicat是以进程组出线的,server collector默 认情况下是自动生成的 • 一个进程组由如下几部分组成,并由GoldenGate系统中 唯一的group name所标识,由用户指定: 1. An extract or Replicat process 2. 相应的参数文件(ASCII file,由用户生成,编辑,维 护,控制相应的进程的行为,功能) 3. 相应的checkpoint文件 4. 其他相应的文件(如trail) • Process的添加,启动等,都是由GoldenGate Software Command Interface(GGSCI)完成,GGSCI还可以添加trail, 察看process状态等。
GoldenGate原理及体系结构
• 了解capture和delivery模块概念后,可以进一步了解GG的 使用平台:
GoldenGate原理及体系结构
• GoldenGate两种主要用法: 1. 主要用于change data capture and delivery from database transaction logs (online) 2. Initial load directly from database tables.(special run, batch)只执行一次
GoldenGate原理及体系结构
Checkpoint
GoldenGate原理及体系结构
Checkpoint(续)
Capture, Pump and Delivery save positions to a checkpoint file so they can recover in case of failure. 作用:保存相应进程当前的读取和写入的位置信息, 防止进程因某些原因重启后的重复读取或数据丢失

韩顺平oracle学习笔记

韩顺平oracle学习笔记

韩顺平oracle学习笔记第0讲:如何学习oracle一、如何学习oracleOracle目前最流行的数据库之一,功能强大,性能卓越。

学习oracle需要具备一定基础:1.学习过一门编程语言(如:java ,c)2.最好学习过一门别的数据库(sql server,mysql , access)教程推荐:oracle使用教程,深入浅出oracle记住:欲速则不达,做任何事情要遵循他的规律,循序渐进,信心很重要成为一个oracle高手过程:理解小知识点->做小练习->把小的只是点连成线->做oracle项目->形成只是面->深刻理解Oracle基础部分:oracle基础使用; oracle用户管理; oracle表管理Oracle高级部分:oracle表的查询; oracle的函数; oracle数据库管理;oracle 的权角色; pl/sql 编程;索引,约束和事物。

期望目标:1 学会安装、启动、卸载oracle2 使用sql *plus工具3 掌握oracle用户管理4 学会在oracle中编写简单的select语句第1讲:基础语法内容介绍:1.为什么学习oracle2.介绍oracle及其公司的背景3.学会安装、启动、卸载oracle4.oracle开发工具5.Sql*plus的常用命令6.oracle用户管理一、主流数据库包括:●微软:sql server 和 access●瑞典:mysql AB公司●IBM公司:DB2●美国sybase公司:sybase●IBM公司:infromix●美国oracle公司:oracle(目前最流行的之一)二、oracle安装,启动及卸载1.系统要求:操作系统最好为windows2000内存最好在256M以上硬盘空间需要2G以上2.oracle安装会自动的生成sys和system两个用户说明:○1Sys用户是超级用户,具有最高权限,具有sysdba角色,create database 的权限,默认密码是manager○2System 用户是管理操作员,权限也很大,具有sysoper角色,没有create database权限,默认密码是 change_on_install○3一般讲,对数据库维护,使用system用户登录就可以了3.启动oracle右键单击我的电脑->服务和应用程序:服务->启动OracleServiceMYORA1(MYORA1是安装oracle时起的名字各有不同)和OracleOracleHome90TNSLlistener4.卸载oracle1、先关掉oralce,net stop OracleServiceORCL(ORCL是我的实例名字,换成你的),或者去我的电脑服务中关闭2、开始->程序->Oracle - oracle的版本号,我的是10ghome->Oracle Installation Products->Universal Installer 卸载oracle3、进注册表,regedit,删除选择HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE下所有的key。

ORACLE数据库学习心得1

ORACLE数据库学习心得1

ORACLE数据库结课论文一个好的程序, 必然联系着一个庞大的数据库网路...今年我们学习了oracle数据库这门课程, 起初的我, 对这个字眼是要多陌生有多陌生, 后来上课的时候听一会老师讲课, 偶尔再跟上上机课, 渐渐的学会了不少东西, 但我感觉, 我学到的仍是一些皮毛而已, 怀着疑惑和求知的心态, 我在网上搜索了关于oracle数据库的一些知识。

1.ORACLE的特点:可移植性ORACLE采用C语言开发而成, 故产品与硬件和操作系统具有很强的独立性。

从大型机到微机上都可运行ORACLE的产品。

可在UNIX、DOS、Windows等操作系统上运行。

可兼容性由于采用了国际标准的数据查询语言SQL, 与IBM的SQL/DS、DB2等均兼容。

并提供读取其它数据库文件的间接方法。

可联结性对于不同通信协议, 不同机型与不同操作系统组成的网络也可以运行ORAˉCLE数据库产品。

2.ORACLE的总体结构(1)ORACLE的文件结构一个ORACLE数据库系统包括以下5类文件:ORACLE RDBMS的代码文件。

数据文件一个数据库可有一个或多个数据文件, 每个数据文件可以存有一个或多个表、视图、索引等信息。

日志文件须有两个或两个以上, 用来记录所有数据库的变化, 用于数据库的恢复。

控制文件可以有备份, 采用多个备份控制文件是为了防止控制文件的损坏。

参数文件含有数据库例程起时所需的配置参数。

(2)ORACLE的内存结构一个ORACLE例程拥有一个系统全程区(SGA)和一组程序全程区(PGA)。

SGA(System Global Area)包括数据库缓冲区、日志缓冲区与共享区域。

PGA(Program Global Area)是每一个Server进程有一个。

一个Server进程起动时, 就为其分配一个PGA区, 以存放数据与控制信息。

(3)ORACLE的进程结构ORACLE包括三类进程:①用户进程用来执行用户应用程序的。

Goldengate从入门到精通


DATAGURU专业数据分析社区 Goldengate从入门到精通 讲师 顾铁军
安装步骤描述 – 源库的准备
建立OGG数据库用户 – OGG需要从数据字典读取表结构 – 如Oracle日志中没有足够信息,则需通过flash back或者直接读取数据库记录(例如, CLOB/BLOG/BINARY等) OGG数据库用户权限 – CREATE USER goldengate IDENTIFIED BY goldengate DEFAULT TABLESPACE USERS ; – GRANT CONNECT TO goldengate; – GRANT CREATE SESSION TO goldengate; – GRANT ALTER SESSION TO goldengate; – GRANT RESOURCE TO goldengate; – GRANT SELECT ANY DICTIONARY TO goldengate; – GRANT SELECT ANY TABLE TO goldengate; – GRANT FLASHBACK ANY TABLE TO goldengate; – GRANT ALTER ANY TABLE TO goldengate;
Goldengate从入门到精通 第1课
Goldengate概述
DATAGURU专业数据分析社区 Goldengate从入门到精通 讲师 顾铁军
Agenda
Goldengate是什么? Goldengate适用的场景 Goldengate基本原理
Goldengate复制拓扑和异构
Goldengate产品线介绍 Goldengate产品的下载
非侵入
低影响
直接部署和运行在源端数据服务 器时,CPU使用率<3%,内存 和网络带宽要求极低

第二部分 GoldenGate常用命令


Current Checkpoint (position of last record read in the data source):
Sequence #: 10 RBA: 20535808 Timestamp: 2008-06-01 19:05:28.000000 Redo File: /ora/oracle/oradata/ggs/redo03.log
Extract命令(五)
Info 命令举例
(接上页)
Write Checkpoint #1 GGS Log Trail Current Checkpoint (current write position): Sequence #: 2 RBA: 0 Timestamp: 2008-06-01 19:05:30.604907 Extract Trail: /home/oracle/ggs95/dirdat/r2 ... File Information: Block Size = 2048 Max Blocks = 100 Record Length = 2048 Current Offset = 0 ... Status: Start Time = 2008-06-01 19:04:14 Last Update Time = 2008-06-01 19:05:30 Stop Status = A Last Result = 400
Extract命令(一)
添加抽取日志进程 ADD EXTRACT/EXT extsz, TRANLOG, BEGIN NOW, thread 2 添加一个日志抽取进程,该进程从当前时间点开始 复制(如果需要从特定时间点开始则为BEGIN 200709-27 11:00),数据库为2个进程的RAC 11:00 2 RAC 添加传输进程( 添加传输进程(Data Pump) ) add extract dpeXX,exttrailsource /ggs/dirdat/XX 配置传输进程,从指定队列读取数据

Oracle GoldenGate 12c 用户指南说明书

Oracle Streams to Oracle GoldenGate Migration UtilityOracle GoldenGate is Oracle’s strategic technology for data replication. Our latest release, Oracle GoldenGate 12c, reinforces Oracle’s leadership in the real-time transactional data replication space. This release improves business’ ability to manage transactional processing in complex, heterogeneous environments by providing simplified configuration, extreme processing for increased data volumes and improved high availability solutions. We are dedicated to helping our Oracle Streams customer’s transition to our market leading replication technology. To assist with this initiative, Oracle has developed a tool to help customers easily convert their existing Oracle Streams configuration into an Oracle GoldenGate configuration. Streams2OGG tool is available for download from the Oracle Support Portal via Document ID 1912338.1 Please note: The following information assumes that the reader is familiar with both Oracle Streams and Oracle GoldenGate concepts . The Streams2OGG Tool Oracle Streams and Oracle GoldenGate (OGG) replication solutions follow similar concepts: capture from source database, route changes to the target database and apply changes to the target database. Advantages: The Streams2OGG tool auto generates Oracle GoldenGate configuration files, which greatly simplifies the effort required to migrate off Oracle Streams to Oracle GoldenGate 12c . This tool will help our customers: ∙ Eliminate manual conversion errors ∙ Minimize the GoldenGate learning curve for Streams customers ∙Implement GoldenGate best practicesHow it Works:The Streams2OGG migration tool is performed at the database level byconnecting to the Streams Administrator schema, loading the Streams2OGGpackage, and then executing the package procedure to generate the OracleGoldenGate parameter files based on the Streams configuration in that database.∙Capture information is written to an Oracle GoldenGate extractparameter file∙Propagation information is written to an Oracle GoldenGate pumpparameter file∙Apply information is written to an Oracle GoldenGate replicat parameterfileThis tool supports generating Oracle GoldenGate configuration files for use on adifferent database or machine, allowing for testing and platform migrations. Thetool provides a customization option for specifying process names and OracleGoldenGate version.It is important to note:∙This tool does not provide the environment or process forswitching from Oracle Streams over to your Oracle GoldenGateimplementation.∙This tool does not support the Change Data Capture (CDC) featureof Oracle Database.Assumptions:∙Streams configuration exists in the database prior to using theStreams2OGG migration tool.∙By default, configures for Oracle GoldenGate release is 12.1.2.1.0supporting Integrated Capture and Integrated Delivery features forOracle Database 11.2.0.4 release or higher.Requirements and Pre-requisites:∙The Streams migration tool uses the existing Streams AdministratorSchema to load the tool and to generate the Oracle GoldenGateconfiguration files. Therefore, the Streams Administrator should have theappropriate privileges for Streams including DBA role.2 |3 |Oracle GoldenGate Integrated Capture and Integrated Delivery are configured for Streams customers. While Integrated Capture is available beginning with Oracle Database 11g Release 2 (11.2.0.3) and the Oracle GoldenGate 11.2.1 release, the Streams2OGG generated files may need to be modified for this earlier release of Integrated Capture. Integrated Delivery is introduced inOracle GoldenGate 12c and is available with Oracle Database 11g Release 2(11.2.0.4) and Oracle Database 12c. It is not available for earlier releases ofthe database.C O N T A CFor more information about Oracle Management Pack for Oracle GoldenGate, visit or call+1.800.ORACLE1 to speak to an Oracle representative.C O N N E C T W I T H U S/dataintegration /oracledataintegration /ORCLGoldenGate /goto/goldengate Copyright © 2015, Oracle and/or its affiliates. All rights reserved. This document is provided for information purposes only, and the contents hereof are subject to change without notice. This document is not warranted to be error-free, nor subject to any other warranties or conditions, whether expressed orally or implied in law, including implied warranties and conditions of merchantability or fitness for a particular purpose. We specifically disclaim any liability with respect to this document, and no contractual obligations are formed either directly or indirectly by this document. This document may not be reproduced or transmitted in any form or by any means, electronic or mechanical, for any purpose, without our prior written permission.Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. Intel and Intel Xeon are trademarks or registered trademarks of Intel Corporation. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. AMD, Opteron, the AMD logo, and the AMD Opteron logo are trademarks or registered trademarks of Advanced Micro Devices. UNIX is a registered trademark of The Open Group. 0515。

GoldenGate基本原理、安装过程和基本维护知识讲解

G o l d e n G a t e基本原理、安装过程和基本维护目录一、GoldenGate介绍 (4)二、GoldenGate安装实施 (6)2.1创建GoldenGate软件安装目录 (6)2.2 GoldenGate的管理用户 (6)2.3安装GoldenGate软件 (7)2.4设置数据库归档模式 (7)2.5打开数据库的附加日志 (8)2.6开启数据库强制日志模式 (8)2.7创建GoldenGate管理用户 (8)2.8编辑GLOBALS参数文件 (9)2.9管理进程MGR参数配置 (9)2.10抽取进程EXTN参数配置 (10)2.11 传输进程DPEN参数配置 (10)2.12建立OGG的DDL对象 (12)2.13 数据初始化 (14)2.14 容灾端管理进程MGR参数配置 (16)2.15编辑GLOBALS参数文件 (17)2.16 容灾端复制进程REPN参数配置 (17)2.17创建复制进程repn (18)2.18启动生产端传输进程和容灾端复制进程 (18)2.19测试场景 (19)三.GoldenGate基本运维命令 (19)四、常见故障排除 (20)一、GoldenGate介绍GoldenGate软件是一种基于日志的结构化数据复制软件。

GoldenGate 能够实现大量交易数据的实时捕捉、变换和投递,实现源数据库与目标数据库的数据同步,保持亚秒级的数据延迟。

GoldenGate能够支持多种拓扑结构,包括一对一,一对多,多对一,层叠和双向复制等等。

GoldenGate基本架构Oracle GoldenGate主要由如下组件组成● Extract● Data pump● Trails● Collector● Replicat● ManagerOracle GoldenGate 数据复制过程如下:利用抽取进程(Extract Process)在源端数据库中读取Online Redo Log或者Archive Log,然后进行解析,只提取其中数据的变化信息,比如DML操作——增、删、改操作,将抽取的信息转换为GoldenGate自定义的中间格式存放在队列文件(trail file)中。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

Oracle GoldenGate测试文档1.Oracle GoldenGate介绍GoldenGate TDM(交易资料管理)软体是一种基于日志的结构化资料複製软体,它通过解析源资料库在线日志或归档日志获得资料的增删改变化,再将这些变化应用到目标资料库,实现源资料库与目标资料库同步、双活。

GoldenGate TDM 软体可以在异构的IT基础结构(包括几乎所有常用作业系统平台和资料库平台)之间实现大量资料亚秒一级的即时複製,其複製过程简图如下:如上图所示,GoldenGate TDM的资料複製过程如下:利用捕捉进程(Capture Process)在源系统端读取Online Redo Log或Archive Log,然后进行解析,只提取其中资料的变化如增、删、改操作,并将相关资讯转换爲GoldenGate TDM 自定义的中间格式存放在伫列文件中。

再利用传送进程将伫列文件通过TCP/IP传送到目标系统。

捕捉进程在每次读完log中的资料变化并在资料传送到目标系统后,会写检查点,记录当前完成捕捉的log位置,检查点的存在可以使捕捉进程在中止并恢复后可从检查点位置继续複製;目标系统接受资料变化并缓存到GoldenGate TDM伫列当中,伫列爲一系列临时存储资料变化的文件,等待投递进程读取资料;GoldenGate TDM投递进程从伫列中读取资料变化并创建对应的SQL语句,通过资料库的本地介面执行,提交到资料库成功后更新自己的检查点,记录已经完成複製的位置,资料的複製过程最终完成。

由此可见,GoldenGate TDM是一种基于软体的资料複製方式,它从资料库的日志解析资料的变化(资料量只有日志的四分之一左右)。

GoldenGate TDM将资料变化转化爲自己的格式,直接通过TCP/IP网路传输,无需依赖于资料库自身的传递方式,而且可以通过高达9:1的压缩率对资料进行压缩,可以大大降低带宽需求。

在目标端,GoldenGate TDM可以通过交易重组,分批载入等技术手段大大加快资料投递的速度和效率,降低目标系统的资源佔用,可以在亚秒级实现大量资料的複製,并且目标端资料库是活动的GoldenGate TDM提供了灵活的应用方桉,基于其先进、灵活的技术架构可以根据用户需求组成各种拓扑结构,如图所示:GoldenGate TDM 可以提供可靠的资料複製,主要体现在下面三点:保证事务一致性GoldenGate TDM 在灾备资料库应用複製资料库交易的顺序与在生産中心资料库上的顺序相同,并且按照相同的事务环境提交,确保在目标系统上资料的完整性和读一致性,爲即时查询和事务处理创造了条件。

检查点机制保障资料无丢失GoldenGate TDM的抽取和複製进程使用检查点机制记录完成複製的位置。

对于抽取进程,其检查点记录当前已经抽取日志的位置和写伫列文件的位置;对于投递进程,其检查点记录当前读取伫列文件的位置。

检查点机制可以保证在系统、网路或GoldenGate TDM进程故障重啓后资料无丢失。

可靠的资料传输机制GoldenGate TDM 用应答机制传输交易资料,只有在得到确认消息后才认爲资料传输完成,否则将自动重新传输资料,从而保证了抽取出的所有资料都能发送到备份端。

资料传输过程中支援128位加密和资料压缩功能。

Oracle 公司的GoldenGate産品,可以在异构的IT基础结构之间实现大量资料的秒一级的资料捕捉、转换和投递。

GoldenGate可以支援几乎所有常用作业系统如和资料库平台,如下表所示:作业系统资料库MS NT, 2000, XP, Linux, Sun Solaris, HP-UX, IBM AIX, HP NonStop, TRU64, IBM z/OS,OS/390 Oracle, DB2, MS SQL Server, MySQL, Enscribe, SQL/MP, SQL/MX, Sybase, Teradata, 其他ODBC 相容资料库2.Oracle GoldenGate For Oracle(windows 平台) 安装GoldenGate 的安装非常简单,将解压缩安装文件到指定目录。

比如安装文件解压缩后的路径爲 d:\ggs安装步骤如下:1. 进入命令行2. 切换到ggs目录下3. 输入命令 install addservice addevents4. 输入ggsci进入GoldenGate的命令行5. 输入 create subdirsOK,GoldenGate安装就已经完成了。

实际操作如下C:\Documents and Settings\PONY>d:D:\>cd ggsD:\ggs>install addservice addeventsOracle GoldenGate messages installed successfully.Service 'GGSMGR' created.Install program terminated normally.D:\ggs>ggsciOracle GoldenGate Command Interpreter for OracleVersion 10.4.0.19 Build 002Windows (optimized), Oracle 10 on Sep 18 2009 15:54:55Copyright (C) 1995, 2009, Oracle and/or its affiliates. All rights reserved.GGSCI (PONY) 1> create subdirsCreating subdirectories under current directory D:\ggsParameter files D:\ggs\dirprm: createdReport files D:\ggs\dirrpt: createdCheckpoint files D:\ggs\dirchk: createdProcess status files D:\ggs\dirpcs: createdSQL script files D:\ggs\dirsql: created Database definitions files D:\ggs\dirdef: created Extract data files D:\ggs\dirdat: created Temporary files D:\ggs\dirtmp: created Veridata files D:\ggs\dirver: created Veridata Lock files D:\ggs\dirver\lock: created Veridata Out-Of-Sync files D:\ggs\dirver\oos: created Veridata Out-Of-Sync XML files D:\ggs\dirver\oosxml: created Veridata Parameter files D:\ggs\dirver\params: created Veridata Report files D:\ggs\dirver\report: created Veridata Status files D:\ggs\dirver\status: created Veridata Trace files D:\ggs\dirver\trace: created Stdout files D:\ggs\dirout: created3.资料库複製实施文档(DML)3.1准备工作◆准备两台机器,分别爲SourceDB, TargetDB,通过TCP/IP网路进行互连SourceDB :WIN XP环境,Oracle 10g 10.2.0.1.0TargetDB :WIN 2003 环境 Oracle 10g 10.2.0.1.0◆必须保证SourceDB是运行在归档模式下。

◆目的:将SourceDB中相关Schema中的资料同步複製到TargetDB相对应的Sechema中本文中要同步的是SouceDB中的SAJET,SJ,SMT,LANG到Target中的SAJET,SJ,SMT,LANG用户下◆首先要保持SourceD, TargetDB相关Schema中的初始资料一致,可以通过Exp/Imp,Rman,冷备等方式实现.◆双方DB建立GoldenGate用户,赋予DBA许可权,用于GoldenGate连接DB.◆双方DB安装GoldenGate,安装方式如第二章节所示◆SourceDB必须开始最小附加日志模式通过以下语句查看DB是否开啓了最小附加日志模式SQL> select SUPPLEMENTAL_LOG_DATA_MIN from v$database;SUPPLEME--------YES如果没有开啓资料库的最小附加日志,则通过以下语句开啓SQL>alter database add supplemental log data;◆开啓表的最小附加日志,通过GoldenGate命令行来添加GGSCI (PONY) 1> dblogin userid sajet password techSuccessfully logged into database.GGSCI (PONY) 2> add trandata sajet.*第一条命令表示登录到Database第二条命令表示添加Sajet用户下所有表的最小附加日志同样的命令开啓SJ,LANG,SMT用户下的表的最小附加日志。

3.2配置GoldenGate3.2.1配置SourceDB的GoldenGateSourceDB端需要配置mgr进程,添加一个extract进程,和一个远端伫列。

1.配置mgr参数GGSCI (PONY) 2> edit param mgr此时系统自动会新建一个名爲mgr的参数文件,填入以下内容后保存PORT 7809--mgr进程使用的TCP/IP埠侦听请求2.新增一个抽取进程,在GGSCI命令行中输入如下命令:GGSCI (PONY) 1> add extract ext1,tranlog,begin nowEXTRACT added.---新增一个抽取进程,负责抓取SourceDB中变化的资料,基于日志方式,立即生效3.配置抽取进程GGSCI (PONY) 2> edit param ext1此时系统会自动新建一个名爲ext1的参数文件,填入以下内容后保存extract ext1userid goldengate,password goldengatermthost 172.17.17.61, mgrport 7809rmttrail d:\ggs\dirdat\r1dynamicresolutiongettruncatestable sajet.*;table sj.*;table smt.*;table lang.*;--抽取进程名爲 ext2连接本机DB的账号和密码远端主机地址以及服务埠号(TargetDB)远端伫列的位置(TargetDB)优化参数,动态分析表结构是否抓取Truncate的资料需要抽取哪些table。

相关文档
最新文档