在安装之前需要配置一个OGG的数据库用户用于OGG从数据库中读取日志

数据库配置

  • 确保数据库开启归档模式
# 未开启归档模式
[oracle]$ sqlplus / as sysdba
SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     19
Current log sequence	       21
# 已开启归档模式
SQL> archive log list;
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     34
Next log sequence to archive   36
Current log sequence	       36

如果未开启归档模式,执行以下命令开启归档模式

[oracle]$ sqlplus / as sysdba
SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE ARCHIVELOG;
SQL> ALTER DATABASE OPEN;
SQL> archive log list;
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     19
Next log sequence to archive   21
Current log sequence	       21
  • 开启附加日志
[oracle]$ sqlplus / as sysdba
SQL> ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> alter database force logging;
SQL> alter system set enable_goldengate_replication=true;
  • 创建ogg用户(非PDB数据库)

Oracle从12c开始支持可插拔数据库,也就是PDB数据库,对于PDB和非PDB创建用户的方法略有不同

[oracle]$ sqlplus / as sysdba
SQL> create user ogg identified by "ogg";
User created.
SQL> exec dbms_goldengate_auth.grant_admin_privilege('ogg');
PL/SQL procedure successfully completed.
SQL> grant create session,dba to oggadmin;
Grant succeeded.
  • 创建ogg用户(PDB数据库)
SQL> create user c##ogg identified by "ogg";
SQL> exec dbms_goldengate_auth.grant_admin_privilege('c##ogg',container=>'ALL');
SQL> grant create session,dba to c##ogg container=all;
PDB需要创建CommonUser,common user用户名必须以c##开头,并且需要指定container=all,用户名和密码可以自行指定
Trackback

no comment untill now

Add your comment now