SQL> alter system set log_archive_dest_1='location=D:\app\arch' scope=both;
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list
注意,由于上面命令涉及停止数据库应用,应结合业务实际情况进行操作。
4.1.2 开启附加日志
在oracle中我们可以通过rowid来定位某条记录,但是目标端的数据库和源端数据库的数据库可能完全不一样,所以无法通过rowid来确定源端数据库的逻辑变化,这时附件日志supplemental log便登上了表演的舞台。数据库在开启附加日志功能后,对于源端的修改操作,oracle会同时追加能够唯一标示记录的列到redo log。这样目标端数据库就可以知道源端发生了哪些具体的变化。
SQL> alter database add supplemental log data;
SQL> alter system switch logfile;
SQL> select supplemental_log_data_min from v$database;
4.1.3 开启强制日志模式
SQL>alter database force logging;
SQL>SELECT FORCE_LOGGING FROM V$DATABASE;
alter system set enable_goldengate_replication=true;
4.1.4 goldengate创建用户并授权
源端oracle数据库创建账号:
create tablespace ggstab datafile 'D:\app\oradata\fdcp\ggstab01.dbf' size 1024M autoextend on ;
create user ggs identified by ggs default tablespace ggstab temporary tablespace temp;
grant dba to ggs;
Oracle GoldenGate Command Interpreter for Oracle
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401
Windows x64 (optimized), Oracle 12c on Dec 18 2015 20:34:51
Operating system character set identified as GBK.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
GGSCI (WIN-5QL0BNKD7N8) 1> create subdirs
Creating subdirectories under current directory D:\app\sgg
Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。
C:\Users\Administrator>D:
D:\>cd D:\app\tgg
D:\app\tgg>ggsci
Oracle GoldenGate Command Interpreter for MySQL
Version 12.2.0.1.1 OGGCORE_12.2.0.1.0_PLATFORMS_151211.1401
Windows x64 (optimized), MySQL Enterprise on Dec 11 2015 15:48:43
Operating system character set identified as GBK.
Copyright (C) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
GGSCI (WIN-5QL0BNKD7N8) 1> create subdirs
Creating subdirectories under current directory D:\app\tgg
Parameter files D:\app\tgg\dirprm: created
Report files D:\app\tgg\dirrpt: created
Checkpoint files D:\app\tgg\dirchk: created
Process status files D:\app\tgg\dirpcs: created
SQL script files D:\app\tgg\dirsql: created
Database definitions files D:\app\tgg\dirdef: created
Extract data files D:\app\tgg\dirdat: created
Temporary files D:\app\tgg\dirtmp: created
Credential store files D:\app\tgg\dircrd: created
Masterkey wallet files D:\app\tgg\dirwlt: created
Dump files D:\app\tgg\dirdmp: created