alter system set enable_goldengate_replication=true scope=both;
---源端运行 OGG 支持 DDL 脚本
如果要让 OGG 支持 DDL 操作,还需要额外运行几个脚本,这些脚本是 OGG 带的而不是 ORACLE 带的,源
端与目标端都需要
---SYS@ orcl >@/u01/app/ogg/marker_setup.sql
---SYS@ orcl >@/u01/app/ogg/ddl_setup.sql
---SYS@ orcl >@/u01/app/ogg/role_setup.sql
---SYS@ orcl >@/u01/app/ogg/ddl_enable.sql
4 开始进行搭建
源端
4.1 创建 OGG 的管理目录
GGSCI (DSI) 1> create subdirs
Creating subdirectories under current directory /u01/app/ogg
Parameter files /u01/app/ogg/dirprm: already exists
Report files /u01/app/ogg/dirrpt: created
Checkpoint files /u01/app/ogg/dirchk: created
Process status files /u01/app/ogg/dirpcs: created
SQL script files /u01/app/ogg/dirsql: created
Database definitions files /u01/app/ogg/dirdef: created
Extract data files /u01/app/ogg/dirdat: created
Temporary files /u01/app/ogg/dirtmp: created
Stdout files /u01/app/ogg/dirout: created
4.2 建立测试表
SYS@ ogg >@/u01/app/oracle/product/11.2.0/db_1/rdbms/admin/utlsampl.sql
--源端
SYS@ orcl> conn scott/tiger
Connected.
SCOTT@ orcl >create table emp_ogg as select * from emp;
Table created.
SCOTT@ orcl >create table dept_ogg as select * from dept;
Table created.
SCOTT@ orcl >alter table EMP_OGG add constraint PK_EMPNO_OGG primary key
(EMPNO);
Table altered.
SCOTT@ orcl >alter table DEPT_OGG add constraint PK_DEPTNO_OGG primary key
(DEPTNO);
Table altered.
--目标端
SYS@ ogg >conn scott/tiger
Connected.
SCOTT@ ogg > create table emp_ogg as select * from emp where 1=2;
Table created.
SCOTT@ ogg >create table dept_ogg as select * from dept where 1=2;
Table created.
SCOTT@ ogg >alter table EMP_OGG add constraint PK_EMPNO_OGG primary key (EMPNO);
Table altered.
SCOTT@ ogg >alter table DEPT_OGG add constraint PK_DEPTNO_OGG primary key
(DEPTNO);
Table altered.
4.3 源端添加表级 TRANDATA
GGSCI (DSI) 2> DBLOGIN USERID ogg, PASSWORD ogg
Successfully logged into database.
GGSCI (DSI) 3> add trandata scott.emp_ogg
Logging of supplemental redo log data is already enabled for table
评论