Oracle GoldenGate技术培训(公司内部培训)
- 格式:pptx
- 大小:16.30 MB
- 文档页数:117
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技术详解<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 名指定。
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语句,通过数据库的本地接口执行,提交到数据库成功后更新自己的检查点,记录已经完成复制的位置,数据的复制过程最终完成。
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数据库的使用和管理。
二、培训内容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 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支持灵活的数据过滤和转换功能,可以根据需求选择复制和同步的特定表、特定列或特定行。