首页 > 数据库 > Oracle > LINUX ORACLE OGG12C安装(一)
如下为OGG12C 支持的数据库版本(以OGG12.3 版本以及Linux 环境为例)
|
OS Version |
OS Update Type |
OS Update Level |
Run Mode 32/64 Bit |
Database Version |
|
Oracle Linux 6 |
Update Level |
1+ |
64 |
12.1.0.1+; 11.2.0.3+ |
|
Oracle Linux 6 |
Update Level |
4+ |
64 |
12.2.0.1+ |
|
Oracle Linux 7 |
Update Level |
0+ |
64 |
12.2.0.1+; 12.1.0.2+, 11.2.0.4+ |
|
Red Hat Enterprise Linux 6 |
Update Level |
1+ |
64 |
12.1.0.1+; 11.2.0.3+ |
|
Red Hat Enterprise Linux 6 |
Update Level |
4+ |
64 |
12.2.0.1+ |
|
Red Hat Enterprise Linux 7 |
Update Level |
0+ |
64 |
12.2.0.1+; 12.1.0.2+, 11.2.0.4+ |
|
SLES 11 |
Service Pack |
0+ |
64 |
12.2.0.1+; 12.1.0.1+; 11.2.0.1+ |
|
SLES 12 |
Service Pack |
0+ |
64 |
12.2.0.1+; 12.1.0.2+; 11.2.0.4+ |
具体其他环境支持的数据库可以查看: https://www.oracle.com/middleware/technologies/fusion-certification.html
SQL> archive log list
若没开启,则需要开启
将数据库打开至mount 状态
SQL> alter database archivelog;
SQL> select supplemental_log_data_min from v$database;
SUPPLEME
--------
YES ------------- 若不是YES ,需要打开
打开语句:
SQL> alter database add supplemental log data; --------- 在mount 状态下创建速度快
SQL> ALTER SYSTEM SWITCH LOGFILE;
SQL> select force_logging from v$database;
FOR
---
YES
打开语句:
SQL> ALTER DATABASE FORCE LOGGING;
SQL> select owner,table_name,column_name,data_type from dba_tab_columns where owner in ('SCHEMA1',’ SCHEMA2’,’ SCHEMA3’) and data_type in ('ANYDATA','ANYDATASET','ANYTYPE','BFILE','BINARY_INTEGER','MLSLABEL','PLS_INTEGER','TIMEZONE_ABBR','TIMEZONE_REGION','URITYPE,UROWID');
查看要复制的表的日志信息是完整的,确保是logging 。把nologing 变成logging 。
SQL> select owner,table_name from dba_tables where owner in ('SCHEMA1',’ SCHEMA2’,’ SCHEMA3’) and logging='NO' and temporary='N';
SQL> alter table xxx.xxxx logging;
SQL> select object_name,owner from dba_objects where object_type='MATERIALIZED VIEW' and owner in ('SCHEMA1',’ SCHEMA2’,’ SCHEMA3’);
-- 创建管理用户表空间(可选)
SQL> create tablespace odc_tps datafile '/ora12c/app/oradata/ORA12C/odc01.dbf' size 100M autoextend on;
-- 创建管理用户表空间和赋权
-- 非 CDB/PDB 环境
SQL> create user odc identified by odc default tablespace odc_tps;
SQL> GRANT CREATE SESSION,CONNECT,RESOURCE,ALTER ANY TABLE,ALTER SYSTEM, DBA,SELECT ANY DICTIONARY,SELECT ANY TRANSACTION,FLASHBACK ANY TABLE, SELECT ANY TABLE TO ODC;
--11204 后
exec dbms_goldengate_auth.grant_admin_privilege('odc')
--11203 前
Exec dbms_goldengate_auth.grant_admin_privilege('ggadm',grant_select_privileges=>true)
-- 安装成功后可以收回dba 权限,但是要授予UNLIMITED TABLESPACE 权限。
GRANT UNLIMITED TABLESPACE TO odc;
或者alter user odc quota unlimited on users;
-- 在ddl_setup 时报错,通过授予以下权限解决。
grant create any table to odc;
grant create any view to odc;
grant create any procedure to odc;
grant create any sequence to odc;
grant create any index to odc;
grant create any trigger to odc;
grant create any view to odc;
--CDB/PDB 环境
SQL> create user C##odc12c identified by C##odc12 default tablespace odc_tps;
-- 授权,在CDB 和PDB 中都需要授权,所以使用container=all
Exec dbms_goldengate_auth.grant_admin_privilege (grantee => 'C##ODC', privilege_type => 'CAPTURE', grant_select_privileges => TRUE, do_grants => TRUE, container => 'ALL' )
grant connect, create session, resource, ALTER ANY TABLE, ALTER SYSTEM, SELECT ANY DICTIONARY, SELECT ANY TRANSACTION, FLASHBACK ANY TABLE to c##odc12 container=all;
grant dba to c##odc12 container=all;
alter system set enable_goldengate_replication=true;
ggsci>dblogin userid odc password odc
ggsci>add trandata SCHEMA1.*
ggsci>info trandata SCHEMA1.*
可以设置如下参数
UNDO_MANAGEMENT=AUTO
UNDO_RETENTION=86400
在大容量环境中,可以向上调整UNDO_RETENTION 。
类似于钱包的概念,提高安全性。
-- 生成credentialstore 文件
GGSCI (XQZT-PC) 1> add credentialstore
Credential store created in .\dircrd\.
GGSCI (XQZT-PC) 2> alter credentialstore add user c##ggadmin alias ggroot
Password:
Credential store in .\dircrd\ altered.
-- 使用别名登录
GGSCI (XQZT-PC) 3> dblogin useridalias ggroot
Successfully logged into database CDB$ROOT.
-- 也可以创建PDB 的存储别名
GGSCI (XQZT-PC) 1> alter credentialstore add user c##ggadmin@pdborcl alias ggpd
borcl
Password:
Credential store in .\dircrd\ altered.
GGSCI (XQZT-PC) 2> dblogin useridalias ggpdborcl
Successfully logged into database PDBORCL.
-- 查看别名
GGSCI (XQZT-PC) 1> info credentialstore
Reading from .\dircrd\:
Default domain: OracleGoldenGate
Alias: ggroot
Userid: c##ggadmin
Alias: ggpdborcl
Userid: c##ggadmin@pdborcl
1 、SYSDBA 连接数据库
2 、若已经组装DDL 组件则不需要这个步骤
CREATE USER DDLuser IDENTIFIED BY password;
GRANT CONNECT, RESOURCE, DBA TO DDLuser;
3 、编辑./GLOBALS
EDIT PARAMS ./GLOBALS
GGSCHEMA schema
4 、进入到安装ogg 目录,并连接数据库执行
@sequence.sql
5 、源端
GRANT EXECUTE on DDLuser.updateSequence TO DBLOGINuser;
6 、目标端
GRANT EXECUTE on DDLuser.replicateSequence TO Replicatuser;
7 、源端
ALTER TABLE sys.seq$ ADD SUPPLEMENTAL LOG DATA (PRIMARY KEY) COLUMNS;
# mkdir /odc/
#chown oracle:oinstall /odc
HP-UX : SHLIB_PATH
AIX : LIBPATH
LINUX : LD_LIBRARY_PATH
例如:
export LD_LIBRARY_PATH=/odc:$LD_LIBRARY_PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
source .bash_profile
在12 版本后很少有直接解压就可以用的版本,都是需要图形化安装或者静默安装。
1 、上传压缩包并解压至 odc 目录
$unzip xxx.zip
静默安装
进入到Disk1/response 目录下,编辑文件oggcore.rsp
vi oggcore.rsp
#------------------------------------------------------------------------
# Specify the installation option.
# Specify ORA18c for installing Oracle GoldenGate for Oracle Database 18c or
# ORA12c for installing Oracle GoldenGate for Oracle Database 12c or
# ORA11g for installing Oracle GoldenGate for Oracle Database 11g
#------------------------------------------------------------------------
INSTALL_OPTION=ORA11g
#------------------------------------------------------------------------
# Specify a location to install Oracle GoldenGate
#------------------------------------------------------------------------
SOFTWARE_LOCATION=/odc/
#------------------------------------------------------------------------
# Specify true to start the manager after installation.
#------------------------------------------------------------------------
START_MANAGER=true
#------------------------------------------------------------------------
# Specify a free port within the valid range for the manager process.
# Required only if START_MANAGER is true.
#------------------------------------------------------------------------
MANAGER_PORT=7809
#------------------------------------------------------------------------
# Specify the location of the Oracle Database.
# Required only if START_MANAGER is true.
#------------------------------------------------------------------------
DATABASE_LOCATION=/oracle/app/product/11.2.0/db_1
安装
[oracle@rac11gn1 Disk1]$ ./runInstaller -silent -responseFile /odc/fbo_ggs_Linux_x64_shiphome/Disk1/response/oggcore.rsp
2 、创建子工作目录
$ ./ggsci
ggsci>create subdirs
以上所创建的目录的作用:
|
Name |
purpose |
|
|
dirchk |
Checkpoint files |
用来存放检查点(checkpoint) 文件, 次检查点是ogg 自己的检查点与实例不同 |
|
dirdat |
GoldenGate trails |
用来存放TRAIL 文件 |
|
dirdef |
Data definition files |
用来存放通过DEFGEN 工具生成的源或目标端数据定义文件 |
|
dirprm |
Parameter files |
用来存放配置参数文件 |
|
dirpcs |
Process status files |
用来存放进程状态文件 |
|
dirrpt |
Report files |
用来存放进程报告文件 |
|
dirsql |
SQL script files |
用来存放SQL 脚本文件 |
|
dirtmp |
Temporary files |
当事物所需要的内存超过已分配内存时, 默认存储在这个目录 |
3 、创建管理进程
创建管理进程所需参数:
|
参数 |
阀值 |
定义 |
|
port |
7809 |
mgr 进程使用的TCP/IP 端口侦听请求,默认端口为7809 |
|
DYNAMICPORTLIST |
7800-7810 |
指定可用动态 TCP/IP 端口列表,用于源端与目标端进程通信的绑定,最大支持256 个端口 |
|
PURGEOLDEXTRACTS |
./dirdat/cr* |
定期清理抽取出的过期文件,可以被设置在Manager, Extract, and Replicat 参数文件中,oracle 建议设置在Manager 中 |
|
USECHECKPOINTS |
|
根据任何MINKEEP 规则,允许清除那些已经被Extract 和Replicat 进程检测过的,保证数据不丢失。 |
|
MINKEEPHOURS |
24 |
trail 文件的保留时间,超过这个时间则删除 |
|
autorestart |
extract * |
指定进程失败时自动重启 |
|
retries |
10 |
指定尝试重新启动进程的次数(默认尝试2 次) |
|
waitminutes |
10 |
指定重新启动进程的时间,直到必要资源变得可用或一些其他的事件发生。默认的延迟时间为2 分钟。 |
具体设置如下:
ggsci>edit param mgr
输入:
port 7809
DYNAMICPORTLIST 7800-7810
PURGEOLDEXTRACTS ./dirdat/cr*, USECHECKPOINTS, MINKEEPHOURS 24
autorestart extract * retries 10 waitminutes 10
ggsci>edit param ./GLOBALS
输入:
GGSCHEMA odc
CHECKPOINTTABLE odc.ggs_checkpoint --- 保存退出
ggsci>start mgr
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29956245/viewspace-2932701/ ,如需转载,请注明出处,否则将追究法律责任。