1. 安装深圳站点的OGG软件
1.1. 上传OGG安装软件
创建用户:ogg,使用ogg账号把OGG软件上传到目标环境。
root:
两个节点都执行:
useradd -g oinstall -d /ogg -m ogg chown -R ogg:oinstall /ogg chmod 775 /ogg
设置密码
passwd ogg
使用ogg用户上传安装包
cd /soft
打开xftp工具,将OGG软件包OracleGoldenGate12.2.0.2.2forOracleonLinuxx86-64.zip上传到shdb1服务器,并存放到/soft目录
root设置如下环境变量,执行su - ogg可以直接进入/ogg目录
vi /etc/profile ########## export PS1=`whoami`'@'`hostname`':${PWD}>' set -o vi ########## source /etc/profile
设置ogg环境变量
su - ogg vi .profile
####################
export ORACLE_BASE=/opt/app/oracle
export ORACLE_HOME=/opt/app/oracle/product
export ORACLE_SID=shinfo
export OGG_HOME=/ogg
export PATH=.:$ORACLE_HOME/bin:$PATH:/bin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/X11R6/bin
export PATH=$PATH:$OGG_HOME
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$OGG_HOME:/lib:/usr/lib:$LD_LIBRARY_PATH:$OGG_HOME
export TNS_ADMIN=$ORACLE_HOME/network/admin
####################
使环境变量生效
source .profile
更改文件所有权
root@szdb1:/soft>chown ogg:oinstall /soft/122022_fbo_ggs_Linux_x64_shiphome.zip
使用ogg用户安装OGG软件
ogg解压OGG安装软件
cd /soft unzip 122022_fbo_ggs_Linux_x64_shiphome.zip
使用ogg用户开启vnc服务
ogg@szdb1:/ogg>vncserver You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? n xauth: creating new authority file /ogg/.Xauthority New 'X' desktop is szdb2:1 Creating default startup script /ogg/.vnc/xstartup Starting applications specified in /ogg/.vnc/xstartup Log file is /ogg/.vnc/szdb2:1.log
通过vnc工具打开图形化
cd /soft/fbo_ggs_Linux_x64_shiphome/Disk1
./runInstaller
安装ogg软件报错:[INS-75012]Sofware Location specified is already an existing Oracle
1.安装ogg软件时报错:
验证OGG是否安装成功
cd /ogg ./ggsci 出现以下表示安装成功 Oracle GoldenGate Command Interpreter for Oracle Version 12.2.0.2.2 OGGCORE_12.2.0.2.0_PLATFORMS_170630.0419_FBO Linux, x64, 64bit (optimized), Oracle 11g on Jun 30 2017 14:42:26 Operating system character set identified as UTF-8. Copyright (C) 1995, 2017, Oracle and/or its affiliates. All rights reserved. GGSCI (szdb2) 1>
1.5. 开启DB归档
查看节点1归档状态 sqlplus / as sysdba SQL> archive log list; Database log mode No Archive Mode Automatic archival Disabled Archive destination /opt/app/oracle/product/dbs/arch Oldest online log sequence 12 Current log sequence 14 SQL>
如果信息为No Archive Mode,表示数据库为非归档模式,则继续下一步。
在节点1执行(此处/arch为共享目录) alter system set log_archive_dest_1='location=/arch' scope=spfile sid='*';
3、关闭数据库(在节点1执行即可关闭两节点数据库)
oracle@szdb1:~> srvctl stop database -d szinfo
4、检查数据库关闭后状态
oracle@shdb1:~> crsctl stat res -t
5.将节点1数据库启动到mount状态
oracle@shdb1:~> srvctl start instance -d shinfo -i shinfo1 -o mount
6、修改数据库的归档模式并启动节点1数据库
oracle@shdb1:~> sqlplus / as sysdba
alter database archivelog;
alter database open;
7、检查归档状态
SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination /arch Oldest online log sequence 12 Next log sequence to archive 14 Current log sequence 14 SQL>
8、启动2节点数据库
srvctl start instance -d shinfo -i szinfo2
检查集群状态
crsctl stat res -t
SQL> archive log list Database log mode Archive Mode Automatic archival Enabled Archive destination /arch Oldest online log sequence 3 Next log sequence to archive 5 Current log sequence 5
切换日志,然后在/arch下查看
SQL> alter system switch logfile;
附:
Software Location specified is already an existing Oracle home
and does not contain the selected Oracle Golden Gate install type.
是由于之前安装过OGG,信息记录在oraInventory文件里,再次安装则出现冲突
root@shdb1:/soft>su - oracle
vi /opt/app/oraInventory/ContentsXML/inventory.xml
<HOME NAME="Ora11g_gridinfrahome1" LOC="/opt/app/oracrs/grid" TYPE="O" IDX="1" CRS="true">
<NODE_LIST>
<NODE NAME="shdb1"/>
<NODE NAME="shdb2"/>
</NODE_LIST>
</HOME>
<HOME NAME="OraDb11g_home1" LOC="/opt/app/oracle/product" TYPE="O" IDX="2">
<NODE_LIST>
<NODE NAME="shdb1"/>
<NODE NAME="shdb2"/>
</NODE_LIST>
</HOME>
<HOME NAME="OraHome1" LOC="/ogg" TYPE="O" IDX="3"/>
</HOME_LIST>
<COMPOSITEHOME_LIST>
</COMPOSITEHOME_LIST>
</INVENTORY>
将有冲突的清单删除,如删除这里的<HOME NAME="OraHome1" LOC="/ogg" TYPE="O" IDX="3"/>这行,
然后重新安装OGG即可。