安装oracle数据库以及解压安装glodengate软件的步骤
本篇内容介绍了"安装oracle数据库以及解压安装glodengate软件的步骤"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
一、安装oracle数据库,配置远程桌面 (略)
源 和 目标 环境都如下:
(1) 数据库
(2)监听
(3) TNSNAME 文件配置
tnsname.ora 文件内容,后面很多配置基于这个配置:
##CDBYUNGG = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.180)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = yun) ))##PDBYUNGGXC = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.180)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = xiaochong) ))
二、 解压安装glodengate软件
以下步骤,通过oracle用户执行
(1) 创建安装目录:
(创建源端安装目录)
mkdir -p /u01/app/oracle/product/ogg_src
(创建目标端安装目录)
mkdir -p /u01/app/oracle/product/ogg_trg
(2) 修改oracle用户环境变量
vim ~/.bash_profile
#添加如下内容 (源和目标端的路径不同,这里以源端为例):export OGG_HOME=/u01/app/oracle/product/ogg_srcexport PATH=$OGG_HOME:$PATHexport LD_LIBRARY_PATH=$OGG_HOME:$LD_LIBRARY_PATH
使之生效:
source ~/.bash_profile
(3)解压安装包(root)
(4) 图形界面安装 (源端安装,目标直接拷贝安装好的文件目录即可)
将安装文件目录拷贝到目标端,这样目标端就可以免安装了
[oracle@yun@oggp:ogg_src]scp -r * oracle@192.168.56.180:/u01/app/oracle/product/ogg_trg/
(5)测试
登录GGSCI
三、准备
1. 流程图:
2. 创建数据库用户
此用户为glodengate管理用户,在12C的容器数据库环境下,需要在CDB库下创建。
create tablespace goldengate datafile size 8M autoextend on;create user c##goldengate identified by goldengate default tablespace goldengate;grant dba to c##goldengate;exec dbms_goldengate_auth.grant_admin_privilege('c##goldengate');
测试连接:
这里容易错误的地方:
(1)在CDB环境中创建公共用户,需要以C##或c##开头,且PDB中不能用有剔除C##后相同的用户名。
(2)赋权需要在CDB和PDB都要执行
(3)如果需要指定表空间,必须在CDB和所有PDB中创建相同的表空间。不然会报如下错误。
ORA-65096,ORA-65048,ORA-00959
Warning: PDB altered with errors.
有一点不明白:删除了pdb里重复的用户,重启创建公共用户,重启系统后,pdb中公共用户失效。
如下: C##OGG 用户,而重新定义的用户C##OGGP是没有问题的
SQL> show pdbs CON_ID CON_NAME OPEN MODE RESTRICTED---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 XIAOCHONG READ WRITE NOSQL> select username,common,con_id from cdb_users where username like '%OGG%';USERNAME COMMON CON_IDC##OGG YES 1C##OGGP YES 1C##OGGP YES 3SQL> alter session set container=xiaochong;Session altered.SQL> select username,common,con_id from cdb_users where username like '%OGG%';USERNAME COMMON CON_IDC##OGGP YES 3
3. 修改源库日志模式 并 开启附加日志
(1)修改:
修改归档(略)
SQL> alter database force logging;
Database altered.
SQL> alter system set enable_goldengate_replication=true;
System altered.
---开启附加日志
SQL> alter database add supplemental log data;
Database altered.
(2)查询
--确认开启数据库级附加日志
SQL> select supplemental_log_data_min from v$database;SUPPLEMENTAL_LOG_DATA_MI------------------------YES
--确认已经开启归档
SQL> archive log listDatabase log mode Archive ModeAutomatic archival EnabledArchive destination USE_DB_RECOVERY_FILE_DESTOldest online log sequence 52Next log sequence to archive 54Current log sequence 54
四、配置
1. 配置全局参数 (源端,目标端都配置)
GGSCI (oggp) 1> edit param ./GLOBALS##添加如下内容:GGSCHEMA C##GOLDENGATE
2. 配置Manager
(1)源端:
(2)目标端(因为是指向拷贝文件的,默认没有运行,需要开启)
2. 配置local extract
(1)配置参数
连接CDB,注意test为用户,t1为表名,后面以分好结尾。
(2)开启表级附加日志
(3) 添加进程
容器数据库必须是集成模式(integrated)
(3)注册PDB
(4)添加tail文件
(5)开启进程
(6)测试
将T表插入一条记录后,
GGSCI (oggp as C##goldengate@yun/CDB$ROOT) 18> stats ext exttestSending STATS request to EXTRACT EXTTEST ...Start of Statistics at 2019-06-13 15:42:07.Output to ./dirdat/ex:Extracting from XIAOCHONG.TEST.T to XIAOCHONG.TEST.T:*** Total statistics since 2019-06-13 15:41:21 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Daily statistics since 2019-06-13 15:41:21 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Hourly statistics since 2019-06-13 15:41:21 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Latest statistics since 2019-06-13 15:41:21 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00
End of Statistics.
3. 配置data Pump
(1) 配置参数
(2) 添加进程
(3) 添加trail文件
(4) 开启进程
(5) 测试
GGSCI (oggp) 6> stats ext dptestSending STATS request to EXTRACT DPTEST ...Start of Statistics at 2019-06-13 16:01:46.Output to ./dirdat/dp:Extracting from XIAOCHONG.TEST.T to XIAOCHONG.TEST.T:*** Total statistics since 2019-06-13 15:57:31 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Daily statistics since 2019-06-13 15:57:31 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Hourly statistics since 2019-06-13 15:57:31 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00*** Latest statistics since 2019-06-13 15:57:31 ***Total inserts 1.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 1.00End of Statistics.
4. 目标端配置checkpoint table
5. 配置replicat
(1)配置参数
(2)添加进程
(3)开启进程
(4)测试
GGSCI (oggs as c##goldengate@yun/XIAOCHONG) 51> stats rep reptestSending STATS request to REPLICAT REPTEST ...Start of Statistics at 2019-06-13 17:03:39.Replicating from XIAOCHONG.TEST.T to XIAOCHONG.TEST.T:*** Total statistics since 2019-06-13 17:03:35 ***Total inserts 2.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 2.00*** Daily statistics since 2019-06-13 17:03:35 ***Total inserts 2.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 2.00*** Hourly statistics since 2019-06-13 17:03:35 ***Total inserts 2.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 2.00*** Latest statistics since 2019-06-13 17:03:35 ***Total inserts 2.00Total updates 0.00Total deletes 0.00Total discards 0.00Total operations 2.00End of Statistics.
最终测试: 自行测试即可。
"安装oracle数据库以及解压安装glodengate软件的步骤"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!