oracle goldengate使用测试(二)

2014-11-24 14:23:44 · 作者: · 浏览: 1
b1.

3. Destination-side

We must repeat all the above steps on the destination side. Here, it will be host db4 with same database.

4. Source database

The GoldenGate software having been installed successfully, we must prepare the source database for replication.

Switch the database to archivelog mode:

SQL> shutdown immediate

SQL> startup mount

SQL> alter database archivelog;

SQL> alter database open;

Enable minimal supplemental logging:

SQL> alter database add supplemental log data;

Prepare the database to support ddl replication (optional).

a) Turn off recyclebin for the database . . .

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

. . . and bounce it.

b) Create schema for ddl support replication . . .

SQL> create user ggate identified by qwerty default tablespace users temporary tablespace temp;

. . . and grant the necessary privileges to the new user..

[oracle@db1 gg]$ cd $GGATE

SQL> grant connect,resource,unlimited tablespace to ggate;

SQL> grant execute on utl_file to ggate;

c) Run scripts for creating all necessary objects for support ddl replication:

SQL> @$GGATE/marker_setup.sql

SQL> @$GGATE/ddl_setup.sql

SQL> @$GGATE/role_setup.sql

SQL> grant GGS_GGSUSER_ROLE to ggate;

SQL> @$GGATE/ddl_enable.sql

Create test schemas for replication. I will create a replication from schema sender to schema receiver (the receiving schema can be on the same database or on another).

a) Source database:

SQL> create user sender identified by qwerty default tablespace users temporary tablespace temp;

SQL> grant connect,resource,unlimited tablespace to sender;

b) Destination database:

SQL> create user receiver identified by qwerty default tablespace users temporary tablespace temp;

SQL> grant connect,resource,unlimited tablespace to receiver;

5. Replication

We’re going to create the simplest replication without the GG data pump (we can add it later). Our goal is to create ddl and ddl replication from the sender schema on the source database to receiver schema on the destination.

Replication also works if you’re using only one database. This is replication between schemas.

Create and start manager on the source and the destination.

Source:

[oracle@db1 gg]$ cd $GGATE

[oracle@db1 gg]$ ./ggsci

GGSCI (db1) 4> info all

Program Status Group Lag Time Since Chkpt

MANAGER STOPPED

GGSCI (db1) 6> edit params mgr

PORT 7809

GGSCI (db1) 7> start manager

Manager started.

We can check status of our processes:

GGSCI (db1) 8> info all

Program Status Group Lag Time Since Chkpt

MANAGER RUNNING

Create the extract group on the source side:

GGSCI (db1) 1> add extract ext1, tranlog, begin now

EXTRACT added.

GGSCI (db1) 2> add exttrail /u01/app/oracle/product/gg/dirdat/lt, extract ext1

EXTTRAIL added.

GGSCI (db1) 3> edit params ext1

Add the following lines to the new parameter file for our extract:

--extract group--

extract ext1

--connection to database--

userid ggate, password qwerty

--hostname and port for trail--

rmthost db2, mgrport 7809

--path and name for trail--

rmttrail /u01/app/oracle/product/gg/dirdat/lt

--DDL support

ddl include mapped objname sender.*;

--DML

table sender.*

We can check our processes again:

GGSCI (db1) 6> info all

Program Status Group Lag Time Since Chkpt

MANAGER STOPPED

EXTRACT STOPPED EXT1 00:00:00 00:10:55

Create replicat on the destination side:

[oracle@db2 gg]$ cd $GGATE

[oracle@db2