当前位置:操作系统 > Unix/Linux >>

GoldenGate单向DDL同步

GoldenGate单向DDL同步
 
1. 源库和目标库ogguser用户都赋予dba角色和执行utl_file的权限:
 
   [oracle@dd1 ~]$ sqlplus / as sysdba
  
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 16:15:18 2013
  
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
  
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  
  SQL> grant dba to ogguser;
  
  Grant succeeded.
  
  SQL> grant execute on utl_file to ogguser;
  
  Grant succeeded.
 
2. 编辑源库全局参数文件
  
  [oracle@dd1 ogg11]$ cd $ORACLE_BASE/ogg11
  [oracle@dd1 ogg11]$ ggsci 
  
  Oracle GoldenGate Command Interpreter for Oracle
  Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
  Linux, x64, 64bit (optimized), Oracle 11g on Oct  4 2011 23:49:46
  
  Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
  
  
  GGSCI (dd1) 1> edit param ./GLOBALS
  
  ggschema ogguser
  
3. 启用DDL支持设置(只需在源库设置)
  
  [oracle@dd1 ogg11]$ sqlplus / as sysdba
  
  SQL*Plus: Release 11.2.0.3.0 Production on Tue Apr 16 16:21:35 2013
  
  Copyright (c) 1982, 2011, Oracle.  All rights reserved.
  
  
  Connected to:
  Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
  With the Partitioning, OLAP, Data Mining and Real Application Testing options
  
  执行脚本marker_setup.sql:
  SQL> @marker_setup.sql
  
  Marker setup script
  
  You will be prompted for the name of a schema for the GoldenGate database objects.
  NOTE: The schema must be created prior to running this script.
  NOTE: Stop all DDL replication before starting this installation.
  
  Enter GoldenGate schema name:ogguser  ##输入ogguser
  
  
  Marker setup table script complete, running verification script...
  Please enter the name of a schema for the GoldenGate database objects:
  Setting schema name to OGGUSER
  
  MARKER TABLE
  -------------------------------
  OK
  
  MARKER SEQUENCE
  -------------------------------
  OK
  
  Script complete.
  
  关闭回收站:
  SQL> show parameter recyclebin;
  
  NAME                                 TYPE        VALUE
  ------------------------------------ ----------- ------------------------------
  recyclebin                           string      on
  
  SQL> alter system set recyclebin=off;
  alter system set recyclebin=off
                                *
  ERROR at line 1:
  ORA-02096: specified initialization parameter is not modifiable with this
  option
  
  
  SQL> alter system set recyclebin=off scope=spfile; ##如果是10g,需要重启数据库,这里是11g,无需重启
  
  System altered.
  
  数据库开始强制日志:
  SQL> alter database force logging;
  
  Database altered.
  
  确认源库已经处于归档模式,并启用附加日志和强制日志:
  SQL> select log_mode,supplemental_log_data_min,force_logging from v$database;
  
  LOG_MODE     SUPPLEME FOR
  ------------ -------- ---
  ARCHIVELOG   YES      YES
  
  执行脚本ddl_setup.sql:
  SQL> @ddl_setup.sql
  
  GoldenGate DDL Replication setup script
  
  Verifying that current user has privileges to install DDL Replication...
  
  You will be prompted for the name of a schema for the GoldenGate database objects.
  NOTE: For an Oracle 10g source, the system recycle bin must be disabled. For Oracle 11g and later, it can be enabled.
  NOTE: The schema must be created prior to running this script.
  NOTE: Stop all DDL replication before starting this installation.
  
  Enter GoldenGate schema name:ogguser ##输入ogguser
  
  You will be prompted for the mode of installation.
  To install or reinstall DDL replication, enter INITIALSETUP
  To upgrade DDL replication, enter NORMAL
  Enter mode of installation:INITIALSETUP
  
  Working, please wait ...
  Spooling to file ddl_setup_spool.txt
  
  Checking for sessions that are holding locks on Oracle Golden Gate metadata tables ...
  
  Check complete.
  
  
  
  
  
  
  
  Using OGGUSER as a GoldenGate schema name, INITIALSETUP as a mode of installation.
  
  Working, please wait ...
  
  DDL replication setup script complete, running verification script...
  Please enter the name of a schema for the GoldenGate database objects:
  Setting schema name to OGGUSER
  
  DDLORA_GETTABLESPACESIZE STATUS:
  
  Line/pos                                 Error
  ---------------------------------------- -----------------------------------------------------------------
  No errors                                No errors
  
  CLEAR_TRACE STATUS:
  
  Line/pos                                 Error
  --------------------
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,