Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Oracle 11g goldengate and oracle 11g data synchronization

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Download and install the goldengate software (both sections need to be installed)

Glodengate download address: http://pan.baidu.com/s/1pLtVTJt password: exob

[oracle@oracleogg ~] $unzip ogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip

[oracle@oracleogg] $tar xvf fbo_ggs_Linux_x64_ora11g_64bit.tar-C / u01/glodengate/

[oracle@oracleogg ~] $cd / u01/glodengate/

[oracle@oracleogg glodengate] $vim ~ / .bash_profile

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0.1/db_1

Export ORACLE_SID=oracle11g

Export PATH=$ORACLE_HOME/bin:$PATH

Export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/u01/glodengate/lib-- must be set, or an error occurs

[oracle@oracleogg glodengate] $. / ggsci

Oracle GoldenGate Command Interpreter for Oracle

Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:32:14

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

GGSCI (oracleogg) 1 > create subdirs-install glodengate

Creating subdirectories under current directory / u01/glodengate

Parameter files / u01/glodengate/dirprm: already exists

Report files / u01/glodengate/dirrpt: created

Checkpoint files / u01/glodengate/dirchk: created

Process status files / u01/glodengate/dirpcs: created

SQL script files / u01/glodengate/dirsql: created

Database definitions files / u01/glodengate/dirdef: created

Extract data files / u01/glodengate/dirdat: created

Temporary files / u01/glodengate/dirtmp: created

Stdout files / u01/glodengate/dirout: created

GGSCI (oracleogg) 2 >

[oracle@oracleogg glodengate] $ls-lF | grep'/ $'--View the directory created by glodengate

Drwxr-x--- 2 oracle oinstall 4096 Apr 23 2012 cfg/

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirchk/-checkpoint file

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirdat/-extract file

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirdef/

Drwxr-x--- 2 oracle oinstall 4096 Apr 23 2012 dirjar/

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirout/

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirpcs/

Drwxr-x--- 2 oracle oinstall 4096 Apr 23 2012 dirprm/-- Parameter file directory

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirrpt/-log file

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirsql/-- sql script file

Drwxrwxr-x 2 oracle oinstall 4096 Nov 19 19:36 dirtmp/-temporary files

Drwxr-x--- 7 oracle oinstall 4096 Apr 23 2012 UserExitExamples/

[oracle@oracleogg glodengate] $

two。 Get syntax help information

(1)。 You must enter the ggsci root directory into the ggsci terminal, otherwise you will not get help.

(2)。 Help syntax: help for example: help add rmttrail

GGSCI (oracleogg) 3 > help add rmttrail

ADD RMTTRAIL

Use ADD RMTTRAIL to create a trail for online processing on a remote

System and:

* assign a maximum file size.

* associate the trail with an Extract group.

In the parameter file, specify a RMTHOST entry before any RMTTRAIL

Entries to identify the remote system and TCP/IP port for the Manager

Process.

Syntax:

ADD RMTTRAIL, EXTRACT

[, MEGABYTES]

[SEQNO]

The fully qualified path name of the trail. The actual trail name can

Contain only two characters. Oracle GoldenGate appends this name with a

Six-digit sequence number whenever a new file is created. For example

A trail named. / dirdat/tr would have files named

. / dirdat/tr000001,. / dirdat/tr000002, and so forth.

The name of the Extract group to which the trail is bound. Only one

Extract process can write data to a trail.

MEGABYTES

The maximum size, in megabytes, of a file in the trail. The default is

one hundred。

SEQNO

Specifies that the first file in the trail will start with the

Specified trail sequence number. Do not include any zero padding. For

Example, to start at sequence 3 of a trail named "tr," specify SEQNO 3.

The actual file would be named / ggs/dirdat/tr000003. This option can be

Used during troubleshooting when Replicat needs to be repositioned to a

Certain trail sequence number. It eliminates the need to alter Replicat

To read the required sequence number.

Example:

ADD RMTTRAIL c:\ ggs\ dirdat\ aa, EXTRACT finance, MEGABYTES 200

GGSCI (oracleogg) 4 >

3. Supplemental log logs are supported by modifications on the source side

[oracle@oracle11g ~] $sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sun Nov 20 04:18:26 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > alter database add supplemental log data

Database altered.

SQL > alter system switch logfile

System altered.

SQL > select supplemental_log_data_min from v$database

SUPPLEME

-

YES

SQL >

4. Create tablespaces, users and test tables on the source side and target side (test data is available only on the source side)

Source node:

SQL > create tablespace wuhan datafile'/ u01 size oracle size 100m

Tablespace created.

SQL > create user gguser identified by system default tablespace wuhan quota unlimited on wuhan

User created.

SQL > grant dba,resource,connect to gguser

Grant succeeded.

SQL > conn gguser/system

Connected.

SQL > create table t (a number,b char (10))

Table created.

SQL > insert into t values (1)

1 row created.

SQL > insert into t values (2)

1 row created.

SQL > insert into t values (3)

1 row created.

SQL > commit

Commit complete.

SQL > select * from t

A B

--

1 a

2 b

3 c

SQL >

Target node:

SQL > create tablespace wuhan datafile'/ u01 size size 100m

Tablespace created.

SQL > create user gguser identified by system default tablespace wuhan quota unlimited on wuhan

User created.

SQL > grant dba,resource,connect to gguser

Grant succeeded.

SQL > conn gguser/system

Connected.

SQL > create table t (a number,b char (10))

Table created.

SQL >

Start the mgr process on both 5.source and target side (both nodes need to do it)

Aource node:

GGSCI (oracle11g) 3 > edit params mgr-- set the port of mgr

-- port-- this is a comment.

PORT 7809-specified port

GGSCI (oracle11g) 4 > start mgr-start mgr

Manager started.

GGSCI (oracle11g) 6 > info mgr-- View the status of mgr

Manager is running (IP port oracle11g.7809).

GGSCI (oracle11g) 7 >

6. Configure tables that need to be synchronized for glodengate (source node)

GGSCI (oracle11g) 7 > dblogin userid gguser, password system

Successfully logged into database.

GGSCI (oracle11g) 8 > add trandata gguser.t-you can also use wildcards (add trandata gguser.*)

2016-11-20 05:32:50 WARNING OGG-00869 No unique key is defined for table'tis. All viable columns will be used to represent the key, but may not guarantee uniqueness. KEYCOLS may be used to define the key.

Logging of supplemental redo data enabled for table GGUSER.T.

GGSCI (oracle11g) 9 > info trandata gguser.*

Logging of supplemental redo log data is enabled for table GGUSER.T.

Columns supplementally logged for table GGUSER.T: A, B.

GGSCI (oracle11g) 10 >

7. Initialize data (import data from source into a target node)

Source node:

GGSCI (oracle11g) 10 > add extract einiaa, sourceistable

EXTRACT added.

GGSCI (oracle11g) 11 > edit params einiaa

EXTRACT EINIAA

USERID GGUSER, PASSWORD "system"

RMTHOST 192.168.3.90, MGRPORT 7809

RMTTASK REPLICAT, GROUP RINIAA

TABLE gguser.t

GGSCI (oracle11g) 12 >

Target node:

GGSCI (oracleogg) 10 > add replicat riniaa, specialrun

REPLICAT added.

GGSCI (oracleogg) 11 > edit params riniaa

REPLICAT RINIAA

ASSUMETARGETDEFS

USERID gguser, PASSWORD "system"

DISCARDFILE. / dirrpt/RINIAA.dsc, PURGE

MAP gguser.*, TARGET gguser.*

GGSCI (oracleogg) 12 >

8. Start

Source node:

GGSCI (oracle11g) 12 > start extract einiaa

Sending START request to MANAGER...

EXTRACT EINIAA starting

GGSCI (oracle11g) 13 > view report einiaa

2016-11-20 05:56:55 INFO OGG-01017 Wildcard resolution set to IMMEDIATE because SOURCEISTABLE is used.

*

Oracle GoldenGate Capture for Oracle

Version 11.2.1.0.1 OGGCORE_11.2.1.0.1_PLATFORMS_120423.0230_FBO

Linux, x64, 64bit (optimized), Oracle 11g on Apr 23 2012 08:42:16

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

Starting at 2016-11-20 05:56:55

*

Operating System Version:

Linux

Version # 1 SMP Fri Nov 22 03:15:09 UTC 2013, Release 2.6.32-431.el6.x86_64

Node: oracle11g

Machine: x86_64

Soft limit hard limit

Address Space Size: unlimited unlimited

Heap Size: unlimited unlimited

File Size: unlimited unlimited

CPU Time: unlimited unlimited

Process id: 8706

Description:

*

* * Running with the following parameters * *

*

2016-11-20 05:56:55 INFO OGG-03035 Operating system character set identified as UTF-8. Locale: en_US, LC_ALL:.

EXTRACT EINIAA

USERID GGUSER, PASSWORD *

2016-11-20 05:56:55 INFO OGG-03500 WARNING: NLS_LANG environment variable does not match database character set, or not set. Using database character se

T value of AL32UTF8.

RMTHOST 192.168.3.90, MGRPORT 7809

RMTTASK REPLICAT, GROUP RINIAA

TABLE gguser.t

2016-11-20 05:56:56 WARNING OGG-00869 No unique key is defined for table'tis. All viable columns will be used to represent the key, but may not guarantee u

Niqueness. KEYCOLS may be used to define the key.

Using the following key columns for source table GGUSER.T: A, B.

2016-11-20 05:56:56 INFO OGG-01815 Virtual Memory Facilities for: COM

Anon alloc: mmap (MAP_ANON) anon free: munmap

File alloc: mmap (MAP_SHARED) file free: munmap

Target directories:

/ u01/glodengate/dirtmp.

CACHEMGR virtual memory values (may have been adjusted)

CACHESIZE: 64G

CACHEPAGEOUTSIZE (normal): 8m

PROCESS VM AVAIL FROM OS (min): 128G

CACHESIZEMAX (strict force to disk): 96G

Database Version:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production

PL/SQL Release 11.2.0.1.0-Production

CORE11.2.0.1.0Production

TNS for Linux: Version 11.2.0.1.0-Production

NLSRTL Version 11.2.0.1.0-Production

Database Language and Character Set:

NLS_LANG = ".AL32UTF8"

NLS_LANGUAGE = "AMERICAN"

NLS_TERRITORY = "AMERICA"

NLS_CHARACTERSET = "AL32UTF8"

Processing table GGUSER.T

*

* Run Time Statistics * *

*

Report at 2016-11-20 05:57:15 (activity since 2016-11-20 05:56:56)

Output to RINIAA:

From Table GGUSER.T:

# inserts: 3

# updates: 0

# deletes: 0

# discards: 0

REDO Log Statistics

Bytes parsed 0

Bytes output 252

GGSCI (oracle11g) 14 >

Target node:

GGSCI (oracleogg) 14 > view report riniaa-View logs

[oracle@oracleogg glodengate] $sqlplus gguser/system

SQL*Plus: Release 11.2.0.1.0 Production on Sat Nov 19 22:01:32 2016

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

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0-64bit Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL > select * from t

A B

--

1 a

2 b

3 c

SQL >

8. Configure real-time updates of user data

Source node:

GGSCI (oracle11g) 14 > add extract eoraaa, tranlog, begin now, threads 1

EXTRACT added.

GGSCI (oracle11g) 15 > info extract *

EXTRACT EORAAA Initialized 2016-11-20 06:17 Status STOPPED

Checkpoint Lag 00:00:00 (updated 00:00:30 ago)

Log Read Checkpoint Oracle Redo Logs

2016-11-20 06:17:37 Thread 1, Seqno 0, RBA 0

SCN 0.0 (0)

GGSCI (oracle11g) 16 > edit params eoraaa

EXTRACT EORAAA

USERID gguser, PASSWORD "system"

RMTHOST 192.168.3.90, MGRPORT 7809

RMTTRAIL. / dirdat/aa

TABLE gguser.t

GGSCI (oracle11g) 18 > add rmttrail. / dirdat/aa, extract eoraaa, megabytes 10

RMTTRAIL added.

GGSCI (oracle11g) 19 > info rmttrail *

Extract Trail:. / dirdat/aa

Extract: EORAAA

Seqno: 0

RBA: 0

File Size: 10M

GGSCI (oracle11g) 20 > start extract eoraaa

Sending START request to MANAGER...

EXTRACT EORAAA starting

GGSCI (oracle11g) 21 > info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

EXTRACT RUNNING EORAAA 00:00:00 00:00:09

GGSCI (oracle11g) 22 > info extract eoraaa, detail

EXTRACT EORAAA Initialized 2016-11-20 06:17 Status STOPPED

Checkpoint Lag 00:00:00 (updated 00:10:50 ago)

Log Read Checkpoint Oracle Redo Logs

2016-11-20 06:17:37 Thread 1, Seqno 0, RBA 0

SCN 0.0 (0)

Target Extract Trails:

Remote Trail Name Seqno RBA Max MB

. / dirdat/aa 0 0 10

Extract Source Begin End

Not Available * Initialized * 2016-11-20 06:17

Current directory / u01/glodengate

Report file / u01/glodengate/dirrpt/EORAAA.rpt

Parameter file / u01/glodengate/dirprm/eoraaa.prm

Checkpoint file / u01/glodengate/dirchk/EORAAA.cpe

Process file / u01/glodengate/dirpcs/EORAAA.pce

Stdout file / u01/glodengate/dirout/EORAAA.out

Error log / u01/glodengate/ggserr.log

GGSCI (oracle11g) 23 >

Target node:

GGSCI (oracleogg) 14 > edit params. / GLOBALS-you must exit after creating the GLOBALS parameter

CHECKPOINTTABLE system.ggchecktable

GGSCI (oracleogg) 2 > dblogin userid system, password system

Successfully logged into database.

GGSCI (oracleogg) 3 > add checkpointtable

No checkpoint table specified, using GLOBALS specification (system.ggchecktable)...

Successfully created checkpoint table system.ggchecktable.

GGSCI (oracleogg) 4 > add replicat roraaa, exttrail. / dirdat/aa

REPLICAT added.

GGSCI (oracleogg) 5 > edit params roraaa

REPLICAT RORAAA

USERID gguser, PASSWORD "system"

HANDLECOLLISIONS

ASSUMETARGETDEFS

DISCARDFILE. / dirrpt/RORAAA.DSE, PURGE

MAP gguser.t, TARGET gguser.t

GGSCI (oracleogg) 8 > info all

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

REPLICAT RUNNING RORAAA 00:00:00 00:00:05

GGSCI (oracleogg) 9 >

9. Verify real-time data updates

Source node:

SQL > select * from t

A B

--

1 a

2 b

3 c

4 d

SQL > insert into t values (5 recordings)

1 row created.

SQL > commit

Commit complete.

SQL > select * from t

A B

--

1 a

2 b

3 c

4 d

5 e

SQL >

Target node:

SQL > select * from t

A B

--

4 d

5 e

1 a

2 b

3 c

SQL >

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report