A-A+

RAC+DG+OGG灾备中OGG实现部分

2013年05月12日 DG&RAC&OGG 暂无评论 阅读 334,889 次

本文不牵扯具体操作系统及oracle软件的安装,假定在实施完毕的rac环境及安装好oracle软件的单机平台下,讲解如何实施RAC+DG+OGG构建灾备系统中OGG实现部分,其他部分见我之前的相关博文。
RAC+DG+OGG简要架构如下:
rac+dg+ogg

以下为主要的实施过程:
修改存储服务器中共享盘的设置

[root@openfiler rac_ogg]# cat /etc/exports

# PLEASE DO NOT MODIFY THIS CONFIGURATION FILE!
#       This configuration file was autogenerated
#       by Openfiler. Any manual changes will be overwritten
#       Generated at: Thu May 2 15:36:07 CST 2013


# End of Openfiler configuration

/mnt/rac_ogg/rac_ogg  192.168.137.0/24(rw,sync,no_root_squash,no_all_squash,no_subtree_check) 


在rac所有节点挂载

mount -t nfs  192.168.137.141:/mnt/rac_ogg/rac_ogg/rac_ogg /u01/app/ogg/11.1

修改所有节点开机自动修改项目录属组

[root@11grac1 11.1]# cat /etc/rc.local 
#!/bin/sh
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.

touch /var/lock/subsys/local

chown -R oracle:oinstall /u01/app/ogg/11.1

修改rac2个节点的开机自动挂载项

[root@11grac2 11.1]# cat /etc/fstab 
LABEL=/                 /                       ext3    defaults        1 1
LABEL=/boot             /boot                   ext3    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
LABEL=SWAP-sda2         swap                    swap    defaults        0 0


#oralce set for ogg
192.168.137.141:/mnt/rac_ogg/rac_ogg/rac_ogg /u01/app/ogg/11.1 nfs defaults 0 0

在共享的nfs目录下解压并创建ogg相关目录

[oracle@OELx64 app]$ mkdir -p ogg/11.1
[oracle@OELx64 11.1]$ tar -xvf /tmp/ggs_Linux_x64_ora11g_64bit_v11_1_1_0_0_078.tar 

修改ogg用户的环境变量(此处的ogg用户为oracle)
在.bash_profile中添加以下条目

#ogg set
OGG_BASE=/u01/app/ogg; export OGG_BASE
OGG_HOME=$OGG_BASE/11.1; export OGG_HOME
PATH=$OGG_HOME:$PATH; export PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$OGG_HOME:$LD_LIBRARY_PATH

[oracle@ora10gr2 11.1]$ pwd
/u01/app/ogg/11.1
[oracle@ora10gr2 11.1]$ ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
Linux, x86, 32bit (optimized), Oracle 10g on Oct  4 2011 23:54:04

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.



GGSCI (ora10gr2) 1> create subdirs

Creating subdirectories under current directory /u01/app/ogg/11.1

Parameter files                /u01/app/ogg/11.1/dirprm: created
Report files                   /u01/app/ogg/11.1/dirrpt: created
Checkpoint files               /u01/app/ogg/11.1/dirchk: created
Process status files           /u01/app/ogg/11.1/dirpcs: created
SQL script files               /u01/app/ogg/11.1/dirsql: created
Database definitions files     /u01/app/ogg/11.1/dirdef: created
Extract data files             /u01/app/ogg/11.1/dirdat: created
Temporary files                /u01/app/ogg/11.1/dirtmp: created
Veridata files                 /u01/app/ogg/11.1/dirver: created
Veridata Lock files            /u01/app/ogg/11.1/dirver/lock: created
Veridata Out-Of-Sync files     /u01/app/ogg/11.1/dirver/oos: created
Veridata Out-Of-Sync XML files /u01/app/ogg/11.1/dirver/oosxml: created
Veridata Parameter files       /u01/app/ogg/11.1/dirver/params: created
Veridata Report files          /u01/app/ogg/11.1/dirver/report: created
Veridata Status files          /u01/app/ogg/11.1/dirver/status: created
Veridata Trace files           /u01/app/ogg/11.1/dirver/trace: created
Stdout files                   /u01/app/ogg/11.1/dirout: created

创建数据库用户

SQL> select file_name from dba_data_files where rownum<10;

FILE_NAME
--------------------------------------------------------------------------------
+DATA/racdb/users01.dbf
+DATA/racdb/undotbs01.dbf
+DATA/racdb/sysaux01.dbf
+DATA/racdb/system01.dbf
+DATA/racdb/undotbs02.dbf
+DATA/racdb/datafile/yallonking.432.812066619
+DATA/racdb/yallonking_2.dbf

7 rows selected.

SQL> create tablespace ogg datafile '+DATA/racdb/ogg01.dbf' size 50m autoextend on;

Tablespace created.

SQL> create user ogg identified by ogg default tablespace ogg quota unlimited on ogg temporary tablespace temp;

User created.

SQL> grant dba to ogg;

Grant succeeded.

修改2个节点的监听文件配置,需要添加ASM服务
文件位置:/u01/11.2.0/grid/network/admin/listener.ora
节点1:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = +ASM)
      (ORACLE_HOME = /u01/11.2.0/grid)
      (SID_NAME = +ASM1)
    )
  )

节点2:

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = +ASM)
      (ORACLE_HOME = /u01/11.2.0/grid)
      (SID_NAME = +ASM2)
    )
  )

验证如下

[oracle@11grac1 ~]$ sqlplus sys/oracle@192.168.137.165:1521/+ASM as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 22 15:59:53 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> 
[oracle@11grac1 ~]$ sqlplus sys/oracle@192.168.137.166:1521/+ASM as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Mon Apr 22 16:00:51 2013

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Real Application Clusters and Automatic Storage Management options

SQL> 

注意:可能需要早grid下修改sys密码

[grid@11grac1 dbs]$ mv orapw+ASM orapw+ASM_bak
[grid@11grac1 dbs]$ orapwd file=orapw+ASM password=oracle entries=10;

修改2个节点的tnsname.ora

[oracle@11grac1 ~]$ tail -f /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

ASM =
 (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.165)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = +ASM)
      (SID_NAME = +ASM1)
    )
  )

RAC =
(DESCRIPTION=
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 11grac1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 11grac2-vip)(PORT = 1521))
       )
       (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = racdb)
    )
  )


rac_ogg =
(DESCRIPTION=
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.174)(PORT = 1521))
       )
       (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SID = rac_ogg)
    )
  )  

[oracle@11grac2 ~]$ tail -f /u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

ASM =  
 (DESCRIPTION =  
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.166)(PORT = 1521))  
    (CONNECT_DATA =  
      (SERVER = DEDICATED)  
      (SERVICE_NAME = +ASM)  
      (SID_NAME = +ASM2)  
    )  
  ) 
RAC =
(DESCRIPTION=
      (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = TCP)(HOST = 11grac1-vip)(PORT = 1521))
        (ADDRESS = (PROTOCOL = TCP)(HOST = 11grac2-vip)(PORT = 1521))
       )
       (CONNECT_DATA =
       (SERVER = DEDICATED)
       (SERVICE_NAME = racdb)
    )
  )


在任意节点配置DDL

SQL> alter system set recyclebin=off scope=spfile;

System altered.

SQL> alter database  add supplemental log data;  
Database altered.  
 
SQL> alter database  add supplemental log data (primary key) columns;  
Database altered.  
 
SQL> alter database  add supplemental log data (foreign key) columns;  
Database altered.  
 
SQL> alter database  add supplemental log data (unique) columns;  
Database altered.  
 
SQL> alter system archive log current;  
System altered.  
 
SQL> grant execute on utl_file to ogg;  
Grant succeeded.  
     
SQL> @marker_setup.sql  
SQL> @ddl_setup.sql  
SQL> @role_setup.sql  
SQL> grant ggs_ggsuser_role to ogg;  
SQL> @ddl_enable.sql  
SQL> @ddl_pin ogg 
  

节点1构建测试数据

SQL> create tablespace test datafile '+DATA/racdb/test01.dbf' size 50m autoextend on;

Tablespace created.

SQL> create user test identified by test default tablespace test quota unlimited on test temporary tablespace temp;

User created.

SQL> grant resource,connect to test;

Grant succeeded.

SQL> conn test/test
Connected.

SQL> create table yallonking (id number,name varchar2(20),my_date date);

Table created.

SQL> insert into yallonking values(1,'yallonking',sysdate);

1 row created.

SQL> commit;

Commit complete.

SQL> alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';

Session altered.

SQL> select * from yallonking;

        ID NAME                 MY_DATE
---------- -------------------- -------------------
         1 yallonking           2013/05/12 10:43:01

登陆源库

[oracle@11grac1 ~]$ /u01/app/ogg/11.1/ggsci

Oracle GoldenGate Command Interpreter for Oracle
Version 11.1.1.1.2 OGGCORE_11.1.1.1.2_PLATFORMS_111004.2100 
Linux, x86, 32bit (optimized), Oracle 11g on Oct  4 2011 23:53:33

Copyright (C) 1995, 2011, Oracle and/or its affiliates. All rights reserved.



GGSCI (11grac1) 1> DBLOGIN USERID ogg,PASSWORD ogg
Successfully logged into database.

主备端配置mgr进程
此处注意创建相关目录

GGSCI (11grac1) 1> view params mgr

port 7840
autostart er *  
autorestart er * 


GGSCI (11grac1) 2> info mgr

Manager is running (IP port 11grac1.7840).

源端配置extract进程

GGSCI (11grac1) 1> dblogin userid ogg,password ogg
Successfully logged into database.

GGSCI (11grac1) 2> add extract ext_test,tranlog,begin now,threads 2
EXTRACT added.


GGSCI (11grac1) 4> view params ext_test

EXTRACT ext_test  
SETENV (ORACLE_HOME = "/u01/app/oracle/product/11.2.0/db_1")  
USERID ogg@rac, PASSWORD ogg  
TRANLOGOPTIONS ASMUSER sys@ASM,ASMPASSWORD oracle  
THREADOPTIONS MAXCOMMITPROPAGATIONDELAY 20000  
EXTTRAIL /u01/app/ogg/11.1/dirdat/et  
DYNAMICRESOLUTION  
DDL INCLUDE ALL  
TABLE test.*; 

GGSCI (11grac1) 53> add exttrail /u01/app/ogg/11.1/dirdat/et, extract ext_test  
EXTTRAIL added. 


GGSCI (11grac1) 2> add extract pu_test,exttrailsource /u01/app/ogg/11.1/dirdat/et,begin now
EXTRACT added.


GGSCI (11grac1) 3> add rmttrail /u01/app/ogg/11.1/dirdat/rt,extract pu_test  
RMTTRAIL added.
 
GGSCI (11grac1) 5> view params pu_test

EXTRACT pu_test  
RMTHOST 192.168.137.174, MGRPORT 7840 
RMTTRAIL /u01/app/ogg/11.1/dirdat/rt  
PASSTHRU  
TABLE test.*

源端配置pump进程

GGSCI (11grac1) 22> view params pu_test

extract pu_test
dynamicresolution
passthru
rmthost 192.168.137.174,mgrport 7840,compress
rmttrail /u01/app/ogg/11.1/dirdat/pt
table test.*;


GGSCI (11grac1) 23> add extract pu_test ,exttrailsource /u01/app/ogg/11.1/dirdat/et
ERROR: EXTRACT PU_TEST already exists.


GGSCI (11grac1) 24> delete pu_test
Deleted EXTRACT PU_TEST.


GGSCI (11grac1) 25> add extract pu_test,exttrailsource /u01/app/ogg/11.1/dirdat/et
EXTRACT added.


GGSCI (11grac1) 26> add rmttrail /u01/app/ogg/11.1/dirdat/pt,extract pu_test
RMTTRAIL added.

源端进程状态:

GGSCI (11grac1) 30> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT_TEST    00:00:01      00:00:00    
EXTRACT     ABENDED     PU_TEST     00:00:00      00:01:33    

目标端进程状态:

GGSCI (x64_ogg) 5> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           


以下为源库到目标库的复制过程
修改目标端的密码文件

[oracle@11grac1 dbs]$ scp orapwracdb1 192.168.137.172:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwrac_ogg
orapwracdb1                                                                                       100% 2048     2.0KB/s   00:00 

修改目标端的监听文件

[oracle@x64_ogg ~]$ cat /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = racdb)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
      (SID_NAME = rac_ogg)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.137.174)(PORT = 1521))
  )

ADR_BASE_LISTENER = /u01/app/oracle

构建对端数据库参数文件

[oracle@x64_ogg ~]$ cat /tmp/pfile_ogg 
*.__db_cache_size=360710144
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
*.__pga_aggregate_target=213909504
*.__sga_target=633339904
*.__shared_io_pool_size=0
*.__shared_pool_size=255852544
*.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/racdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/control01.ctl','/u01/app/oracle/oradata/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='+DATA/racdb/datafile','/u01/app/oracle/oradata','+DATA/racdb/tempfile','/u01/app/oracle/oradata'
*.db_name='rac_ogg'
*.db_recovery_file_dest='/u01/app/oracle'
*.db_recovery_file_dest_size=4039114752
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racdbXDB)'
*.instance_number=1
#*.log_archive_dest_1='/u01/app/oracle/arch'
#*.log_file_name_convert='/u01/app/oracle/oradata','+DATA/racdb','+DATA/racdb/tempfile',
*.open_cursors=300
*.pga_aggregate_target=210763776
*.processes=150
*.remote_login_passwordfile='exclusive'
*.sga_target=632291328
*.thread=1
*.undo_tablespace='UNDOTBS1'

注意:在对端创建必要的目录

将参数文件复制到主节点1相同目录

[oracle@x64_ogg tmp]$ scp pfile_ogg 192.168.137.165:/tmp/
The authenticity of host '192.168.137.165 (192.168.137.165)' can't be established.
RSA key fingerprint is 69:c3:cb:7f:5b:dd:59:a9:5c:94:4e:33:fa:5b:0c:70.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.137.165' (RSA) to the list of known hosts.
oracle@192.168.137.165's password: 
pfile_ogg                                                                                         100% 1157     1.1KB/s   00:00  

使用rman初始化ogg目标库

注意主节点和灾备节点ogg进程状态
主节点:

GGSCI (11grac2) 50> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT_TEST    00:00:00      00:00:00    
EXTRACT     RUNNING     PU_TEST     00:00:00      00:00:04 

备节点:(注意不要启动replica进程)

GGSCI (x64_ogg) 4> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    STOPPED     REP1        00:00:00      00:00:01

备份主数据库(注意验证备份可用性,以及备份期间主节点抓取进程不能掉)

查看最新的事物的开始时间,确保备份在该时间之后。

SQL> select min(to_char(START_TIME,'yyyy/mm/dd hh24:mi:ss')) from gv$transaction;

MIN(TO_CHAR(START_TIME,'YYYY/MM/DDHH24:MI:SS'))
--------------------------------------------------------------------------------


run{
allocate channel a1 type disk;
allocate channel a2 type disk;
allocate channel a3 type disk;
backup full database format '/tmp/dbfullbak_%u_%s_%p_%T.bak'; 
sql 'ALTER SYSTEM switch logfile';
sql 'ALTER SYSTEM ARCHIVE LOG CURRENT';
backup archivelog all format '/tmp/arc_%T_%s.bak';
backup current controlfile format '/tmp/ctl_%T_%s.bak';
release channel a1;
release channel a2;
release channel a3;
}


RMAN> restore database validate;

Starting restore at 05-MAY-13
using channel ORA_DISK_1

channel ORA_DISK_1: starting validation of datafile backup set
channel ORA_DISK_1: reading from backup piece +DATA/racdb/backupset/2013_05_05/nnndf0_tag20130505t111935_0.287.814619979
channel ORA_DISK_1: piece handle=+DATA/racdb/backupset/2013_05_05/nnndf0_tag20130505t111935_0.287.814619979 tag=TAG20130505T111935
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: validation complete, elapsed time: 00:00:26
Finished restore at 05-MAY-13

RMAN> exit


Recovery Manager complete.

传输备份文件到对端相同目录下

[oracle@11grac1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@11grac1 dbs]$ ls -ltr
total 16
-rw-r--r-- 1 oracle oinstall 2851 May 15  2009 init.ora
-rw-r----- 1 oracle oinstall 1536 May  9 23:03 orapwracdb1
-rw-r----- 1 oracle oinstall   37 May  9 23:07 initracdb1.ora
-rw-rw---- 1 oracle asmadmin 1544 May 12 13:14 hc_racdb1.dat
[oracle@11grac1 dbs]$ scp orapwracdb1 192.168.137.174:/u01/app/oracle/product/11.2.0/db_1/dbs/orapwrac_ogg
The authenticity of host '192.168.137.174 (192.168.137.174)' can't be established.
RSA key fingerprint is 69:c3:cb:7f:5b:dd:59:a9:5c:94:4e:33:fa:5b:0c:70.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.137.174' (RSA) to the list of known hosts.
oracle@192.168.137.174's password: 
orapwracdb1                                                                                       100% 1536     1.5KB/s   00:00    
[oracle@11grac1 dbs]$ cd
[oracle@11grac1 ~]$ scp /tmp/*.bak 192.168.137.174:/tmp/
oracle@192.168.137.174's password: 
controlfile.bak                                                                                   100%   18MB  18.0MB/s   00:01    
dbfullbak_0ho9evi8_17_1_20130512.bak                                                              100%  604MB   8.2MB/s   01:14    
dbfullbak_0io9evia_18_1_20130512.bak                                                              100%  421MB   5.7MB/s   01:14    
dbfullbak_0jo9evia_19_1_20130512.bak                                                              100%   14MB   4.6MB/s   00:03    
dbfullbak_0lo9evsj_21_1_20130512.bak                                                              100%   96KB  96.0KB/s   00:00  


使用新的参数文件将对端库启动到nomount状态

[oracle@x64_ogg ~]$ sqlplus "/as sysdba"

SQL*Plus: Release 11.2.0.3.0 Production on Sun May 12 14:29:25 2013

Copyright (c) 1982, 2011, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup nomount pfile='/tmp/pfile_ogg';
ORACLE instance started.

Total System Global Area  630501376 bytes
Fixed Size                  2230992 bytes
Variable Size             264242480 bytes
Database Buffers          360710144 bytes
Redo Buffers                3317760 bytes

主库复制到备库

[oracle@11grac1 ~]$ rman target / auxiliary sys/oracle@rac_ogg

Recovery Manager: Release 11.2.0.3.0 - Production on Sun May 12 15:06:43 2013

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: RACDB (DBID=812624383)
connected to auxiliary database: RAC_OGG (not mounted)

RMAN> duplicate target database to rac_ogg pfile='/tmp/pfile_ogg' logfile
2> '/u01/app/oracle/oradata/redo01.dbf' size 50m,
3> '/u01/app/oracle/oradata/redo02.dbf' size 50m,
4> '/u01/app/oracle/oradata/redo03.dbf' size 50m;

Starting Duplicate Db at 12-MAY-13
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK

contents of Memory Script:
{
   sql clone "create spfile from memory";
}
executing Memory Script

sql statement: create spfile from memory

contents of Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
... ...
Executing: alter database add supplemental log data
Executing: alter database add supplemental log data(PRIMARY KEY, UNIQUE, FOREIGN KEY) columns

contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script

database opened
Finished Duplicate Db at 12-MAY-13

RMAN> exit                   


Recovery Manager complete.


在目标端查验复制后的结果

SQL> alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';

Session altered.

SQL> show parameter db_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      rac_ogg
SQL> select * from test.yallonking;

        ID NAME                 MY_DATE
---------- -------------------- -------------------
         1 yallonking           2013/05/12 10:43:01

查看复制后的scn

SQL> select CHECKPOINT_CHANGE#, FILE# from v$datafile;

CHECKPOINT_CHANGE#      FILE#
------------------ ----------
           1320159          1
           1320159          2
           1320159          3
           1320159          4
           1320159          5
           1320159          6
           1320159          7

7 rows selected.

注意:此处的scn: 1320159需要在ogg中开启replica进程时使用。

在目标端添加checkpoint列表

GGSCI (OELx64) 1> edit params ./GLOBALS


CHECKPOINTTABLE ogg.checkpoint
~
GGSCI (OELx64) 2> dblogin userid ogg
Password: 
Successfully logged into database.

GGSCI (OELx64) 3> add checkpointtable ogg.checkpoint

Successfully created checkpoint table OGG.CHECKPOINT.

目标端配置replicat进程

GGSCI (x64_ogg) 14> view params rep1

replicat rep1
userid ogg,password ogg
assumetargetdefs
reperror default,discard
discardfile /u01/app/ogg/11.1/dirrpt/rep1.dsc,append,megabytes 50
dynamicresolution
map test.test, target test.test;
map test.yallonking, target test.yallonking;

GGSCI (x64_ogg) 12> add replicat rep1,exttrail /u01/app/ogg/11.1/dirdat/pt,checkpointtable ogg.checkpoint
REPLICAT added.

源端信息

GGSCI (11grac1) 8> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
EXTRACT     RUNNING     EXT_TEST    00:00:00      00:00:03    
EXTRACT     RUNNING     PU_TEST     00:00:00      00:00:05

目的端信息

GGSCI (x64_ogg) 18> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    STOPPED     REP1        00:00:00      01:34:41    

GGSCI (x64_ogg) 14> dblogin userid ogg
Password: 
Successfully logged into database.


GGSCI (x64_ogg) 16> add checkpointtable ogg.checkpoint

Successfully created checkpoint table OGG.CHECKPOINT.

GGSCI (x64_ogg) 17> delete replicat rep1
Deleted REPLICAT REP1.


GGSCI (x64_ogg) 18> add replicat rep1,exttrail /u01/app/ogg/11.1/dirdat/pt,checkpointtable ogg.checkpoint
REPLICAT added.


GGSCI (x64_ogg) 19> start REP1,aftercsn 1320159

Sending START request to MANAGER ...
REPLICAT REP1 starting


GGSCI (x64_ogg) 20> info all

Program     Status      Group       Lag           Time Since Chkpt

MANAGER     RUNNING                                           
REPLICAT    RUNNING     REP1        00:00:00      00:00:04    

至此,测试环境全部OK!

标签:

给我留言

Copyright © YallonKing 保留所有权利.   Theme  Ality

用户登录

分享到: