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技术详解<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 名指定。
OGG(oracle+GoldenGate)学习笔记

Oracle GoldenGate测试文档1.Oracle GoldenGate介绍 (1)2.Oracle GoldenGate For Oracle(windows 平台) 安装 (5)3.数据库复制实施文档(DML) (7)3.1准备工作 (7)3.2配置GoldenGate (8)3.2.1配置SourceDB的GoldenGate (8)3.2.2 配置TargetDB的GoldenGate (9)3.3 测试DML操作 (11)4.GoldenGate Support DDL安装 (15)5.玩玩GoldenGate (23)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语句,通过数据库的本地接口执行,提交到数据库成功后更新自己的检查点,记录已经完成复制的位置,数据的复制过程最终完成。
oralce 企业数据集成(goldengate)解决方案

Previous Version
New Version
OGG
原有DB版本 新DB版本
收益:
• 标准化部署数据中心,先进的数据部署平台 • 关键业务的零停机 • 安全的从一个系统迁移到另一系统, 迁移时保持业 务运行.
12
持续高可靠
数据分布/ 同步
解决方案:
Oracle 9i Oracle 11g
• 分布式应用的数据复制,实现数据的全局控制以及提升 操作效率 • 异构环境的分布式数据实时访问 • Active-Active配置保持多数据中心数据同步
多级复制 层次化企业数据
异构平台支持
Databases
Oracle GoldenGate Capture:
O/S and Platforms
Linux
新
Oracle DB2 Microsoft SQL Server 2008 Sybase ASE Teradata Enscribe SQL/MP SQL/MX 新 JMS message queues
Oracle 企业集成数据(GoldenGate)解决方案
芦克强 高级技术顾问
持续访问实时数据
降低IT成本和提高运行效率
持续业务
操作
关键应用的持续高可靠
•避免 灾难发生时的业务停止 • 消除计划当机时间 • 负载均衡
实时信息访问 •秒级的数据操作访问 • 及时的信息分析 • 分布式数据访问
降低IT花费 & 提高效能
Sun Solaris Windows 2000, 2003, XP
HP NonStop
HP-UX HP TRU64 HP OpenVMS IBM AIX IBM z/OS IBM iSeries
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. 作用:保存相应进程当前的读取和写入的位置信息, 防止进程因某些原因重启后的重复读取或数据丢失
2024年Oracle数据库培训

Oracle数据库培训Oracle数据库培训:全面提升您的数据库管理技能一、引言Oracle数据库作为全球领先的数据库管理系统,以其卓越的性能、可靠性和安全性,在各个行业中得到了广泛的应用。
为了帮助广大数据库管理员和开发人员更好地掌握Oracle数据库技术,我们特推出Oracle数据库培训课程。
本文将详细介绍本课程的目标、内容、培训方式及预期效果,帮助您全面了解Oracle数据库培训的相关信息。
二、培训目标1.理论与实践相结合:使学员掌握Oracle数据库的基本概念、体系结构、核心功能及高级特性,能够熟练运用Oracle数据库进行数据管理和维护。
2.提升技能水平:通过培训,使学员具备独立进行Oracle数据库安装、配置、优化、备份与恢复的能力。
3.适应企业需求:针对企业实际应用场景,培养学员具备解决实际问题的能力,提高企业数据库管理水平和业务运行效率。
4.考取Oracle认证:帮助学员顺利通过Oracle认证考试,获得Oracle认证数据库管理员(OCP)证书,提升个人职业竞争力。
三、培训内容1.Oracle数据库基础(1)Oracle数据库概述(2)Oracle数据库体系结构(3)SQL语言基础(4)PL/SQL编程2.Oracle数据库管理(1)数据库安装与配置(2)表空间与数据文件管理(3)用户、权限与角色管理(4)备份与恢复策略3.Oracle数据库性能优化(1)SQL优化(2)索引优化(3)分区技术(4)数据库监控与分析4.Oracle数据库高级特性(1)RAC集群技术(2)DataGuard物理备用数据库(3)GoldenGate实时数据复制(4)Oracle数据库安全策略四、培训方式1.面授课程:小班授课,面对面教学,方便学员与讲师互动交流,及时解答疑问。
2.实践操作:课程中安排大量实验环节,确保学员在实际操作中掌握Oracle数据库技术。
3.在线辅导:提供在线学习平台,学员可随时提问,讲师将在第一时间给予解答。
oracle培训大纲

oracle培训大纲一、介绍Oracle是一家全球领先的信息技术公司,专注于开发和销售数据库软件和技术解决方案。
Oracle数据库是目前业界使用最广泛的关系型数据库管理系统之一,被广泛应用于企业级应用和云计算平台。
本次培训旨在向学员介绍Oracle数据库的基本概念、架构和操作技巧,帮助他们掌握Oracle数据库的使用和管理。
二、培训内容1. Oracle数据库基础知识- 数据库概述:什么是数据库、数据库的分类及特点- Oracle数据库介绍:历史发展、特点和优势- 数据库管理系统:数据库管理系统的角色和作用- 数据库架构:Oracle数据库的逻辑结构和物理结构2. 数据库管理- 数据库安装与配置:Oracle数据库的安装和配置步骤- 创建数据库:创建Oracle数据库的步骤和常见参数设置- 用户管理:创建、修改、删除用户,分配权限- 表和约束:创建表、修改表结构,添加和管理约束- 数据库备份与恢复:备份和还原数据库、使用RMAN工具进行全量备份和增量备份- 数据库性能优化:诊断和优化数据库性能、使用AWR报告和SQL Tuning Advisor3. 数据库安全性管理- 用户授权与身份验证:用户身份验证方式、授权和访问权限管理 - 数据库权限管理:角色和权限的管理与分配- 数据库审计:使用审计功能跟踪数据库操作和安全事件4. 高级数据库特性- 数据库高可用性:Oracle数据保护和灾备解决方案,如RAC、Data Guard等- 数据库扩展和分区:利用分区表提高数据库性能和管理效率- 数据库监控与调优:使用AWR、ASH等工具进行数据库监控和调优- 数据库升级与迁移:数据库升级和迁移方法与步骤5. 实践项目在培训的最后阶段,学员将通过实践项目来应用所学知识,开发一个简单的数据库应用程序。
项目包括需求分析、数据库设计、表创建和数据导入、SQL查询和数据管理等环节。
三、培训要求1. 学员要求:- 具备计算机基础知识,了解关系数据库相关概念- 对数据库技术有一定兴趣和需求- 具备使用SQL语言进行数据查询和操作的基础知识2. 培训方式:- 理论讲解:通过课堂教学向学员介绍相关概念和知识点- 实践操作:提供实验环境,让学员亲自操作实践- 项目实战:通过实践项目来巩固所学知识,培养学员的实际能力3. 培训工具:- Oracle数据库软件(最新版本)- SQL开发工具(如SQL Developer)四、培训效果评估为了评估学员的学习效果,将进行以下考核:- 上机实验:学员根据教学要求完成实验任务- 项目评估:评估学员在实践项目中的表现和成果- 理论知识测试:对学员进行笔试,测试所学知识的掌握情况五、结束语本次Oracle培训将为学员提供全面的Oracle数据库知识体系加强的训练,使学员能够全面地掌握数据库管理和操作技能,为今后的职业发展打下坚实的基础。
oracle ogg详解

oracle ogg详解Oracle GoldenGate (OGG) 是Oracle公司开发的一款高性能的实时数据复制与数据同步工具。
它能够在不同的数据库之间实现数据的实时复制与同步,确保数据的一致性和可靠性。
本文将详细介绍Oracle GoldenGate的原理、特点、使用场景以及一些常见的问题和解决方案。
一、Oracle GoldenGate的原理Oracle GoldenGate的原理可以简单概括为:先抓取源数据库中的数据变更,将其记录为日志,然后通过网络传输这些日志,最后在目标数据库中重新应用这些变更,实现数据的实时复制与同步。
具体的步骤如下:1. 捕获源数据库中的数据变更:Oracle GoldenGate通过挂载在源数据库上的提供商或通过数据库日志挖掘技术,捕获所有的数据变更操作,例如插入、更新、删除等。
2. 将数据变更记录为日志:GoldenGate将源数据库中的数据变更操作记录为一组序列化的日志记录,以便在接下来的步骤中进行传输与应用。
3. 传输日志:GoldenGate使用高效的网络传输协议,将记录的日志从源数据库传输到目标数据库。
4. 应用数据变更:在目标数据库中,GoldenGate根据日志记录的顺序重新应用这些数据变更,确保目标数据库与源数据库的数据保持一致。
二、Oracle GoldenGate的特点1. 高性能:Oracle GoldenGate具有高度优化的数据捕获、传输和应用机制,能够实现实时数据的传输与同步,保证数据的实时性和准确性。
它采用基于日志的增量复制方式,避免了全量数据复制的高开销。
2. 异构性:Oracle GoldenGate支持在不同的数据库平台之间实现数据的实时复制与同步,如Oracle、DB2、SQL Server等。
这使得企业可以根据实际需求选择最适合自己的数据库平台,而不用担心数据的迁移和同步问题。
3. 灵活性:Oracle GoldenGate支持灵活的数据过滤和转换功能,可以根据需求选择复制和同步的特定表、特定列或特定行。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
(Transactional Data Management-交易数据管理)
Oracle GoldenGate for Mainframe Oracle GoldenGate Veridata Management Pack for Oracle GoldenGate Oracle GoldenGate Application Adapters GoldenGate Studio
基于日志的实时数据复制
• 亚秒级复制 • 不依赖源数据库的触发器和规则,对源数据库影响ห้องสมุดไป่ตู้。
OGG在数据传输方面的优势
• • • • OGG有很好的机制来保证传输的交易一致性和断点续传。 事务完整性-事务级粒度 只复制成功提交的事务 防止源和目标的不一致性
Oracle GoldenGate 架构
• 数据冲突的检测和解决机制: 用于双向数据传输(双活)的系统 • 在目标数据库延迟应用目标端的数据 • 基于事件驱动的基本架构
• e.g., 自动的主备机切换 • 进程的自动定位
• • • •
支持动态回滚和基于时间点的数据恢复 支持并行操作 批量数据抽取和批量数据入库 恢复
GoldenGate的核心竞争点
• Active-Active
• 避免了资源浪费,提高系统利用率 • 即时接管 • 在线迁移
• 可靠的数据传输
• Checkpoint机制,以便于发生错 误时恢复 • 基于TCP/IP网络,对网络连接要求 低
• 基于事务日志的数据抽取
• 处理量大,负载小 • 过滤 • 配置并行
• 强大的异构支持 • 无需停机的数据比较方案 • 图形化的集中管理
高可用性: 双业务中心(Active-Active)
实现: • 负载均衡,提高系统整体性能 • 连续可用,快速的容灾接管 • 冲突检测和处理
数据仓库实时供给(和ODI结合使用)
实现:
• 数据仓库数据实时得到更新 • 对源系统低影响
用途:
• 提升商务智能和信息分析能力 • 实时可用的数据仓库
实时报表
Databases O/S and Platforms
Capture:
• Oracle • DB2 • Microsoft SQL • • •
Delivery:
• All listed above, plus: • HP Neoview, Netezza, Greenplum, and any Windows 2000, 2003, XP Linux Sun Solaris
• 统一的 Trail 文件格式
• 在异构平台之间交换数据
• 可以设定数据转换规则,设置数据和操作过滤条件(table, row, column) • 基于的事务的批量操作
GoldenGate架构中关键的技术-续
• 归档和审计功能
• Trail 文件备份 • 审计 – 保存所有变化 (Insert all records)
GoldenGate架构中关键的技术
• • • • • • 分布式松散耦合的进程架构 初始化装载时不影响数据库使用 可以在异构平台之间进行数据初始化装载 可扩展性: 变化数据捕获API (VAM) 客户化定制: User Exits, SQL callouts, Macros 异步的数据变化传输
• 只传输提交的数据 • DML, Metadata, DDL
• 基于GoldenGate TDM,我们提供高可用/容灾和实时数据集成的解决 方案。 • GoldenGate TDM 采用高内聚低耦合的结构,能够支持多种拓扑结构, 包括一对一,一对多,多对一,多对多,层叠和双向复制。
CDC:Change Data Capture,就是我们通常提到的变化数据捕获
高性能和高可靠性
• 即使在大数据量情况下也能实现亚秒级延迟 • 保持事务完整性 • 确保数据可恢复性
灵活性和易用性
• 提供分离的模块化架构 • 支持异构源和目标,可满足不同的延迟需求 • 与ELT/ETL 和消息处理解决方案共存且集成
GoldenGate的工作特点
• 实时数据复制 • 支持异构环境 • 可靠性:断点续传,不影响系统连续 运行。 • 高性能,对生产系统影响小 • 事务完整性 • 事件标记基础架构(Event marker infrastructure) • 路由和压缩:TCP/IP,LAN,WAN
Oracle GoldenGate技术交流
XX公司技术沙龙第二期 XXX 2017年3月
Oracle GoldenGate介绍
前GoldenGate公司简介
• 创建于1995年,总部在美国旧金山。 • 数据复制领域的专业公司。 • 全球超过4,000个安装许可,分布在政府、银行、制造、传媒、电信、 证券、医疗和零售等各大行业,其中有多个全球财富500强企业。 • Oracle、IBM、HP、Microsoft、Sybase、Teradata等著名企业建立了 紧密合作关系。 • 中科领新信息技术有限公司是GoldenGate公司中国区总代理和技术 支持中心。 • 2009年被Oracle收购。
•Management Pack for Oracle GoldenGate 需要安装Oracle Weblogic标准版,需要购买相关的 License
GoldenGate TDM介绍
• GoldenGate TDM 是基于日志的实时CDC软件平台,提供异构环境下 大量交易数据的实时捕捉、变换和投递,同时保持亚秒一级的数据延 迟。
GoldenGate 工作原理
交易数据管理 Transactional Data Management(TDM)
GoldenGate提供异构环境下交易数据的实时捕捉、变换、投递, 主要是支持异构数据库环境下的变化数据同步。
特性: 实时性
亚秒一级延迟
收益: 高性能
能够以低资源消耗完成每秒数千交易的复制
• 根据需求选择最好的系统 • 现代化老式的主机系统 • 报表业务分担
商业智能和决策支持的实时信息访问
• 报表系统可以即时获得生产数据 • 分析系统可以访问到关键的生产信息 • 异构平台的数据交换
数 据 复 制 的 拓 扑 结 构
降低成本 降低风险 实现卓越的运营
满 足 实 时 数 据 需 求 的 企 业 级 解 决用 方例 案
GoldenGate是什么?
Oracle GoldenGate 提供异构环境间事务数据的实时、低影响的捕获、 路由、转换和交付 • 实时数据整合市场的领导者 • GoldenGate 给Oracle的数据整合方案带来了在异构平台的快速的,可 扩展的,实时数据整合能力
• GoldenGate 为应用或数据库的提供了在线升级,迁移的能力
GoldenGate 10.4支持的主流数据库版本
• Oracle 8i (DML only) • Oracle 9.1 and 9.2 (DML and DDL) • Oracle 10.1 and 10.2 (DML and DDL) • Oracle 11g (DML and DDL) • DB2 UDB 8.x and 9.5 on Windows and UNIX • DB2 UDB for OS/390 and z/OS 7.1 (until IBM end of service date) • DB2 UDB for z/OS Version 8.1 and 9.1 • SQL Server 2000 and 2005 on MSsupported OS as a source or target. • SQL Server 2008 on MS-supported OS as a target only. • Sybase 12.5.4 and 15 ASE • MySQL versions 4.0 and 4.1
Oracle GoldenGate 使用场景
很多客户需要连续的实时数据
降低IT系统的成本赢得业务系统运行的效率
Real-Time
关键的应用和数据的连续可用性
• 在灾难发生时系统的可用性 • 在计划宕机期间的系统仍然可以使 用 • 负载均衡和数据分担
Business Operations
降低IT系统的成本& 提高效率
• •
Server Sybase ASE Teradata Enscribe SQL/MP SQL/MX
• •
• •
ODBC compatible databases ETL products JMS message queues MySQL TimesTen
HP NonStop HP-UX HP TRU64 HP OpenVMS IBM AIX IBM z/OS
Oracle GoldenGate
Oracle Data Integrator
GoldenGate与Streams的比较
Oracle Streams
• Oracle从9i开始推出streams,用于提供灵活的复制和容灾解决方案。 但是9i的streams配置相当的麻烦,少说也有十几个步骤,还容易出 错。10gR2则将整个配置过程封装在几个简单的PL/SQL过程中,使 得配置过程大大的简化。但是实际的配置步骤还是一样的,Oracle只 是利用这些PL/SQL过程先生成对应的脚本,然后再执行脚本进行配 置。这个过程可以全自动完成,也可以先将脚本生成到某个指定的目 录,我们根据需要修改脚本,然后再执行脚本进行配置,这样就灵活 又方便。 • Streams的原理其实很简单,通过logmnr技术从oracle的log中解析出 数据,然后传递到目标库并应用,从而将源库的数据复制到目标库。 当然,复制可以是双向的,也可以是单向的。双向复制还需要考虑数 据冲突的问题。而多源复制其实是双向复制的基础上衍生而来的。
• 加密:128-位,SSL