1、
m1 m2 m3 source端
2、
在m1 m2 m3 上
/etc/hosts
172.16.10.140 source
source上
添加
#public network
172.16.15.101 m1
172.16.15.102 m2
172.16.15.103 m3
#private network
10.11.11.1 m1-pri
10.11.11.2 m2-pri
10.11.11.3 m3-pri
29
#VIP network
172.16.15.104 m1-vip
172.16.15.105 m2-vip
172.16.15.106 m3-vip
#GGVIP
172.16.15.107 qr01-vip
#racscan network
172.16.15.100 rac-scan
3、
[root@m2 ~]# cd /u01/app/11.2.3/grid/bin/
[root@m2 bin]# ./crsctl stat res -p | grep -ie .network -ie subnet | grep -ie name -ie subnet
NAME=ora.net1.network
USR_ORA_SUBNET=172.16.14.0
[root@m2 bin]# ./appvipcfg create -network=1 -ip=172.16.15.104 -vipname=gg_vip_trg -user=root
./crsctl setperm resource gg_vip_trg -u user:oracle:r-x
切换到oracle用户
[root@m2 bin]# su - oracle
[oracle@m2 ~]$ cd /u01/app/11.2.3/grid/bin/
[oracle@m2 bin]$ ./crsctl start resource gg_vip_trg
CRS-2672: Attempting to start 'gg_vip_trg' on 'm2'
CRS-5017: The resource action "gg_vip_trg start" encountered the following error:
CRS-5005: IP Address: 172.16.15.104 is already in use in the network 留意一下 vip 会不会由此信息提示
. For details refer to "(:CLSN00107:)" in "/u01/app/11.2.3/grid/log/m2/agent/crsd/orarootagent_root/orarootagent_root.log".
CRS-2674: Start of 'gg_vip_trg' on 'm2' failed
CRS-2679: Attempting to clean 'gg_vip_trg' on 'm2'
CRS-2681: Clean of 'gg_vip_trg' on 'm2' succeeded
CRS-2563: Attempt to start resource 'gg_vip_trg' on 'm2' has failed. Will re-retry on 'm3' now.
CRS-2672: Attempting to start 'gg_vip_trg' on 'm3'
CRS-2676: Start of 'gg_vip_trg' on 'm3' succeeded
这里定义一个试试
要么就是 VIP是自己设定的一个地址
要么就是 VIP是原来主机名字的虚拟VIP。----这里我安装的是虚拟VIP试试看不行就换
不用VIP自己设置一个IP地址也可以只要是同一个网段的。
单实例到RAC单向
前提条件:
1、源库:单实例安装了11.2.3数据库 有Grid、 Oracle 用户
2、目标库:安装了RAC。scan能连接通。
目标RAC:
oracle用户
vim .bash_profile
export OGG_HOME=$ORACLE_BASE/ogg
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
vim /etc/hosts
添加源库的IP地址
172.16.10.140 sdb
源:
vim /etc/hosts
添加 RAC节点下/etc/hosts下的所有内容。
就是主机名 VIP 等
oracle用户
vim .bash_profile
export OGG_HOME=$ORACLE_BASE/ogg
exportLD_LIBRARY_PATH=$ORACLE_HOME/lib
添加虚拟VIP分别在RAC 源上
172.16.15.105 qr01-vip
RAC节点:
root用户
cd /u01/app/11.2.3/grid/bin/
./crsctl stat res -p | grep -ie .network -ie subnet | grep -ie name -ie subnet
./appvipcfg create -network=1 -ip=172.16.15.107 -vipname=gg_vip_trg -user=root
./crsctl setperm resource gg_vip_trg -u user:oracle:r-x
oracle用户:
cd /u01/app/11.2.3/grid/bin
./crsctl start resource gg_vip_trg
./crsctl status resource gg_vip_trg
源上:
[oracle@host01 ogg]$ ping qr01-vip
rac上:
tnsping mes
为安装GG做准备。
源:
sqlplus / as sysdba
SELECT log_mode, force_logging, supplemental_log_data_min FROM v$database;
CREATE USER oggadm1 IDENTIFIED BY pswd1a;
GRANT dba TO oggadm1;
exec
DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE('OGGADM1','capture',TRUE);
RAC上:
select log_mode,force_logging,supplemental_log_data_min from v$database;
NO NO
接着
crs_stop ora.mes.db 关闭数据库。
节点一 只是需要在一个节点做就可以了
sqlplus / as sysdba
startup mount
alter database archivelog;
alter database open;
alter system set log_archive_dest_state_1='location=/home/oracle/arch' scope=spfile;
alter system set log_archive_dest_1 ='location=+DATA/ARC1' scope=spfile sid='orcl1';
alter system set log_archive_dest_1 ='location=+DATA/ARC2' scope=spfile sid='orcl2';
show parameter db_recovery
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER DATABASE FORCE LOGGING;
ALTER SYSTEM SWITCH LOGFILE;
select log_mode,force_logging,supplemental_log_data_min from v$database;
commit;
shutdown immediate
源上:
对照上面的做,一个一个来包括源数据库也是一样的。
节点一 源上 startup
show parameter name
RAC上:
CREATE USER oggadm2 IDENTIFIED BY pswd2a;
exec
DBMS_GOLDENGATE_AUTH.GRANT_ADMIN_PRIVILEGE ('OGGADM2','capture',TRUE);
-----------------------------从下面开始我准备创建ACFS集群文件系统来代替DBFS步骤
sqlplus / as sysasm
五:创建卷并格式化成acfs集群文件系统并挂载
1 SQL> alter diskgroup data add volume acfsvol size 1G;
2 Diskgroup altered.
3
4 [root@rac1 ~]# mkdir /sharedisk
5 [root@rac2 ~]# mkdir /sharedisk
6 [root@rac1 ~]# /sbin/mkfs -t acfs -n ACFSVOL1 /dev/asm/acfsvol-53
7 mkfs.acfs: version = 11.2.0.3.0
8 mkfs.acfs: on-disk version = 39.0
9 mkfs.acfs: volume = /dev/asm/acfsvol-53
10 mkfs.acfs: volume size = 1073741824
11 mkfs.acfs: Format complete.
12
13 [root@rac1 ~]# /sbin/acfsutil registry -a -f /dev/asm/acfsvol-53 /sharedisk/
14 acfsutil registry: mount point /sharedisk successfully added to Oracle Registry
15
16 [root@rac1 ~]# mount.acfs -o all
17 [root@rac1 ~]# df -h
18 Filesystem Size Used Avail Use% Mounted on
19 /dev/mapper/VolGroup00-LogVol00
20 93G 19G 70G 21% /
21 /dev/sda1 190M 17M 165M 9% /boot
22 tmpfs 2.0G 1.2G 807M 60% /dev/shm
23 /dev/asm/acfsvol-53 1.0G 39M 986M 4% /sharedisk
24
25 [root@rac2 ~]# mount.acfs -o all
26 [root@rac2 ~]# df -h
27 Filesystem Size Used Avail Use% Mounted on
28 /dev/mapper/VolGroup00-LogVol00
29 93G 12G 77G 14% /
30 /dev/sda1 99M 17M 78M 18% /boot
31 tmpfs 2.0G 1.2G 807M 60% /dev/shm
32 /dev/asm/acfsvol-53 1.0G 73M 952M 8% /sharedisk
33
34 [root@rac1 ~]# /sbin/acfsutil info fs
35 /sharedisk
36 ACFS Version: 11.2.0.3.0
37 flags: MountPoint,Available
38 mount time: Wed Feb 20 12:11:52 2013
39 volumes: 1
40 total size: 1073741824
41 total free: 998002688
42 primary volume: /dev/asm/acfsvol-53
43 label: ACFSVOL1
44 flags: Primary,Available,ADVM
45 on-disk version: 39.0
46 allocation unit: 4096
47 major, minor: 252, 27137
48 size: 1073741824
49 free: 998002688
50 ADVM diskgroup DATA
51 ADVM resize increment: 33554432
52 ADVM redundancy: unprotected
53 ADVM stripe columns: 4
54 ADVM stripe width: 131072
55 number of snapshots: 0
56 snapshot space usage: 0
57 replication status: DISABLED
[root@m1 mnt]# chown oracle.oinstall /acfs/ -R
RAC节点:
[oracle@m1 ~]$ echo $OGG_HOME
/u01/oracle/ogg
[oracle@m1 ~]$ cd $ORACLE_HOME
[oracle@m1 db]$ pwd
/u01/oracle/11.2.3/db
[oracle@m1 db]$ cd $ORACLE_BASE
[oracle@m1 oracle]$ pwd
/u01/oracle
[oracle@m1 oracle]$ mkdir ogg
[oracle@m1 oracle]$ cd $OGG_HOME
[oracle@m1 ogg]$ pwd
/u01/oracle/ogg
[oracle@m1 ogg]$ 使用ftp上传数据到这上面 ogg112101_fbo_ggs_Linux_x64_ora11g_64bit
unzip ogg112101_fbo_ggs_Linux_x64_ora11g_64bit
tar -xvf fbo_ggs_Linux_x64_ora11g_64bit.tar
源上同样建立ogg目录。
RAC上:
cd $OGG_HOME
cp ./dirprm/jagent.prm jagent.backup
rm -rf dirprm
mkdir /acfs/acfs_sm/ogg -p
mkdir /acfs/acfs_sm/ogg/dirprm
mkdir /acfs/acfs_sm/ogg/dirpcs
mkdir /acfs/acfs_sm/ogg/dirchk
mkdir /acfs/acfs_big/ogg -p
mkdir /acfs/acfs_big/ogg/dirdat
ln -s /acfs/acfs_sm/ogg/dirprm $OGG_HOME/dirprm
ln -s /acfs/acfs_sm/ogg/dirpcs $OGG_HOME/dirpcs
ln -s /acfs/acfs_sm/ogg/dirchk $OGG_HOME/dirchk
./ggsci
create subdirs
GGSCI (m1) 2> exit
[oracle@m1 ogg]$ mv jagent.prm.bak /acfs/acfs_sm/ogg/dirprm/jagent.prm
[oracle@m1 ogg]$ cd dirprm/
[oracle@m1 dirprm]$ ll
total 4
-rwxr-x--- 1 oracle oinstall 53 Dec 12 14:23 jagent.prm
[oracle@m1 dirprm]$ pwd
/u01/oracle/ogg/dirprm
其他节点上:
cd $OGG_HOME
cp ./dirprm/jagent.prm jagent.backup
rm -rf dirprm
ln -s /acfs/acfs_sm/ogg/dirprm $OGG_HOME/dirprm
ln -s /acfs/acfs_sm/ogg/dirpcs $OGG_HOME/dirpcs
ln -s /acfs/acfs_sm/ogg/dirchk $OGG_HOME/dirchk
./ggsci
create subdirs
GGSCI (m1) 2> exit
[oracle@m1 ogg]$ mv jagent.prm.bak /acfs/acfs_sm/ogg/dirprm/jagent.prm
[oracle@m1 ogg]$ cd dirprm/
[oracle@m1 dirprm]$ ll
total 4
-rwxr-x--- 1 oracle oinstall 53 Dec 12 14:23 jagent.prm
[oracle@m1 dirprm]$ pwd
/u01/oracle/ogg/dirprm
一定要按照上面的步骤来。
源上:
cd $OGG_HOME
vim startup.oby
DBLogin UserID oggadm1@sdb, Password pswd1a
Start Mgr
Info Mgr
Info CheckpointTable
(exit每次退出去之后,就需要dblogin)
vim GLOBALS (大写)不要写成小写
CheckpointTable oggadm1.oggchkpt
./gggsci
create subdirs
edit param mgr
Port 15001
PurgeOldExtracts ./dirdat/*, UseCheckpoints
Obey startup.oby
RAC节点上:
cd $OGG_HOME
vim startup.oby
DBLogin UserID oggadm2@mes, Password pswd2a
Start Mgr
Info Mgr
Info CheckpointTable
vim GLOBALS
CheckpointTable oggadm2.oggchkpt
/ggsci
edit param mgr
Port 15002
Autostart ER *
AutoRestart ER *
PurgeOldExtracts ./dirdat/*, UseCheckpoints
obey startup.oby
exit
其他节点上:
vim startup.oby
DBLogin UserID oggadm2@mes, Password pswd2a
Start Mgr
Info Mgr
Info CheckpointTable
vim GLOBALS
CheckpointTable oggadm2.oggchkpt
添加数据测试:
源上:
GGSCI (sdb) 10> Add TranData hr.regions
Logging of supplemental redo data enabled for table HR.REGIONS.
Info TranData hr.*
源上:
edit param eregab
Extract eregab
ExtTrail ./dirdat/aa
UserID oggadm1@sdb, Password pswd1a
Table hr.regions;
edit param pregab
Extract pregab
RmtHost qr01-vip, MgrPort 15002, Compress
RmtTrail /acfs/acfs_big/ogg/dirdat/ab
Passthru
Table hr.regions;
Add Extract eregab, TranLog, Begin Now
Add ExtTrail ./dirdat/aa, Extract eregab, Megabytes 2
Add Extract pregab, ExtTrailSource ./dirdat/aa
Add RmtTrail /acfs/acfs_big/ogg/dirdat/ab,Extract pregab, Megabytes 2
节点一上:
edit param rregab
Replicat rregab
UserID oggadm2@mes, password pswd2a
AssumeTargetDefs
DiscardFile dirrpt/rsalesab.dsc, Append
Map hr.*, Target hr.*;
Add Replicat rregab,ExtTrail /acfs/acfs_big/ogg/dirdat/ab
Add CheckpointTable
start *
info all
源上:
cd $OGG_HOME
./ggsci
obey startup.oby
Add CheckpointTable
info all
start *
exit
源:
alter user hr identified by hr account unlock;
SQL> insert into regions values(10,'Polar');
SQL> insert into regions values(11,'Oceans');
SQL> commit;
RAC上
hr用户
SELECT * FROM regions;
ll /acfs/acfs_big/ogg/dirdat/
ll /acfs/acfs_sm/ogg/dirchk/
total 8
-rw-rw-r-- 1 oracle oinstall 4096 Dec 12 17:24 RREGAB.cpr
-rw-rw-r-- 1 oracle oinstall 24 Dec 12 17:24 RREGAB.cps
假如源上 ogg坏了 怎么办?
ggsic》stop *
stop mgr
rm -rf $ORACLE_BASE/ogg
上传文件 解压缩
----------------上面所有步骤配置出来的只是 DML操作
下面 DDL操作。。。。。。。。。。。。。
总结一下 : GG—VIP都可以不要。为什么呢,可以填写m1 的IP和VIP地址。除此之外,其他都不行,包括172.16.15.107
源上:
[root@sdb ~]# su - oracle
[oracle@sdb ~]$ cd /u01/oracle/ogg/
[oracle@sdb ogg]$ cat startup.oby
DBLogin UserID oggadm1@sdb, Password pswd1a
Start Mgr
Info Mgr
Info CheckpointTable
[oracle@sdb ogg]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Dec 15 21:15:46 2013
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
SQL> grant execute on utl_file to oggadm1
GGSCI (sdb) 7> view params ./GLOBALS
CheckpointTable oggadm1.oggchkpt
GGSCI (sdb) 8> edit param ./GLOBALS
CheckpointTable oggadm1.oggchkpt
ggschema oggadm1
ogg目录下
SQL> sho user
USER is "SYS"
SQL> @marker_setup.sql
SQL> alter system set recyclebin=off DEFERRED;
System altered.
SQL> shutdown immediate
QL> startup
SQL> show parameter recyclebin;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
recyclebin
string OFF
@ddl_setup.sql
@role_setup.sql
grant ggs_ggsuser_role to oggadm1;
@ddl_enable.sql
@?/rdbms/admin/dbmspool.sql
[root@sdb ~]# find / -name dbmspool.sql
/u01/app/grid/11.2.3/rdbms/admin/dbmspool.sql
/u01/oracle/11.2.3/rdbms/admin/dbmspool.sql
[root@sdb ~]#
SQL> @/u01/oracle/11.2.3/rdbms/admin/dbmspool.sql
@ddl_pin.sql oggadm1
edit param eregab
setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
ddl include all
edit param pregab
setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
RAC上:
edit param rregab
setenv (NLS_LANG=AMERICAN_AMERICA.AL32UTF8)
ddl include all
ddlerror default ignore retryop maxretries 3 retrydelay 5
HANDLECOLLISIONS