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

How to install OGG

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article is about how to install OGG. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

1.GoldenGate installation implementation

2.1Create the GoldenGate software installation directory

Create the file system: / u01/gg on the database server as the installation directory for GoldenGate.

2.2 Administrative users of GoldenGate

When installing the GoldenGate software and maintaining the GoldenGate software, you can use the oracle user on the system. The owner of the GoldenGate installation directory must be the GoldenGate administrative user. In this implementation, use the oracle user as the GoldenGate administrative user and add the environment variables of the oracle user (do the following on both the production side and the disaster recovery side):

Export GG_HOME=/u01/gg

Export LD_LIBRARY_PATH=GGHOME:GGHOME:ORACLE_HOME/lib:/usr/bin:/lib

Export PATH=GGHOME:GGHOME:PATH

2.3 install GoldenGate software

Switch to the oracle user, store the compressed package of the GG software in the GoldenGate installation directory, namely / u01/gg, and decompress the package to the GoldenGate installation directory (do the following on both the production side and the disaster recovery side):

Tar-zxvf * .gz

Go to the GoldenGate installation directory and run the GGSCI command to enter the GG interface (do the following on both the production side and the disaster recovery side):

Cd / u01/gg

. / ggsci

Create a subdirectory under the GGSCI interface (do the following on both the production side and the disaster recovery side):

GGSCI > create subdirs

At this point, the GoldenGate software has been installed.

2.4 set database archiving mode

View the archive mode of the database:

SQL > archive log list

If it is in non-archive mode, you need to enable the archive mode:

Shutdown immediate

Startup mount

Alter database archivelog

Alter database open

2.5 Open additional logs for the database

Open additional logs and switch logs (make sure Online redo log and Archive log are consistent)

Alter database add supplemental log data

Alter database add supplemental log data (primary key, unique,foreign key) columns

Alter system switch logfile

2.6 enable database mandatory log mode

Alter database force logging

2.7Create GoldenGate administrative user

The following operations should be carried out on both the production side and the disaster recovery side:

-- create tablespace

SQL > create tablespace ogg datafile'$ORACLE_BASE/oradata/test/ogg01.dbf' size 300m

-- create the user

SQL > create user ogg identified by ogg default tablespace ogg

-- grant role privileges

SQL > grant resource, connect, dba to ogg

2.8Editing GLOBALS parameter files

Change to the GoldenGate installation directory and execute the command:

Cd / u01/gg

. / ggsci

GGSCI > EDIT PARAMS. / GLOBALS

Add the following to the file:

GGSCHEMA ogg-the specified database user for DDL replication

Use the default key to generate ciphertext:

GGSCI > encrypt password ogg encryptkey default

Encrypted password: AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB

Record this ciphertext, which will be used in the configuration of the following process parameters.

2.9 manage process MGR parameter configuration

PORT 7839

DYNAMICPORTLIST 7840-7860

-- AUTOSTART ER *

-- AUTORESTART EXTRACT *, RETRIES 5 Magi WAITMINUTES 3

PURGEOLDEXTRACTS. / dirdat/*,usecheckpoints, minkeepdays 2

Userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKY default

PURGEDDLHISTORY MINKEEPDAYS 11,MAXKEEPDAYS 14

PURGEMARKERHISTORY MINKEEPDAYS 11, MAXKEEPDAYS 14

2.10 EXTN parameter configuration of the extraction process

EXTRACT extn

Setenv (NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252)

Userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKEY default

REPORTCOUNT EVERY 1 MINUTES, RATE

DISCARDFILE. / dirrpt/discard_extn.dsc,APPEND,MEGABYTES 1024

DBOPTIONS ALLOWUNUSEDCOLUMN

WARNLONGTRANS 2h,CHECKINTERVAL 3m

EXTTRAIL. / dirdat/na

TRANLOGOPTIONS EXCLUDEUSER OGG

TRANLOGOPTIONS ALTARCHIVEDLOGFORMAT t_%s_%r.dbf

FETCHOPTIONS NOUSESNAPSHOT

TRANLOGOPTIONS CONVERTUCS2CLOBS

TRANLOGOPTIONS altarchivelogdest primary instance test / oradata/arch

-- TRANLOGOPTIONS RAWDEVICEOFFSET 0

DYNAMICRESOLUTION

DDL INCLUDE ALL

DDLOPTIONS addtrandata, NOCROSSRENAME, REPORT

Table QQQ.*

Table CUI.*

2.11 Transport process DPEN parameter configuration

EXTRACT dpen

RMTHOST 192.168.4.171, MGRPORT 7839, compress

PASSTHRU

Numfiles 50000

RMTTRAIL. / dirdat/na

TABLE QQQ.*

TABLE CUI.*

2.12 create the DDL object of OGG

$cd / u01/gg

$sqlplus "/ as sysdba"

SQL > @ marker_setup.sql

Enter GoldenGate schema name:ogg

Alter system set recyclebin=off

SQL > @ ddl_setup.sql

Enter GoldenGate schema name: ogg

SQL > @ role_setup.sql

Grant this role to each user assigned to the Extract, Replicat, GGSCI, and Manager processes, by using the following SQL command:

SQL > GRANT GGS_GGSUSER_ROLE TO

Where is the user assigned to the GoldenGate processes.

Note the hint here: you need to manually assign this GGS_GGSUSER_ROLE to the database user used by extract (that is, the user specified through userid in the parameter file). You can execute a similar sql under sqlplus:

SQL > GRANT GGS_GGSUSER_ROLE TO ogg

Note: the ogg here is the user used by extract. If you have multiple extract and use different database users, you need to repeat the above process to grant GGS_GGSUSER_ROLE permissions.

Run the following script to make the trigger effective:

SQL > @ ddl_enable.sql

Note: before enabling extraction on the production side, disable the DDL capture trigger and call ddl_disable.sql.

2.13 data initialization

In the initialization process, the source database does not need to be down, and the initialization process is divided into three parts:

The production side starts the extraction process.

Export data from the production side

Import data from disaster recovery end

Add the extraction process, the transmission process and the corresponding queue file on the production side, and execute the command as follows:

/ / create process EXTN

GGSCI > add extract extn,tranlog,begin now

GGSCI > add exttrail. / dirdat/na,extract extn,megabytes 500

/ / create process DPEN

GGSCI > add extract dpen,exttrailsource. / dirdat/na

GGSCI > add rmttrail. / dirdat/na,extract dpen,megabytes 500

Start the management process on the production side:

GGSCI > start mgr

Enable DDL capture trigger:

$cd / u01/gg

$sqlplus "/ as sysdba"

SQL > @ ddl_enable.sql

Start the extraction process on the production side:

GGSCI > start EXTN

In the database, get the current SCN number and record the SCN number:

SQL > select to_char (dbms_flashback.get_system_change_number) from dual

603809

In the database, create the required directories for the data pump and grant permissions:

SQL > CREATE OR REPLACE DIRECTORY DATA_PUMP AS'/ u01'

SQL > grant read, write on DIRECTORY DATA_PUMP to ogg

Use data pump to export data on the production side:

Expdp ogg/ogg schemas='QQQ' directory=DATA_PUMP dumpfile=QQQ_bak_%U flashback_scn=123456789 logfile=expdp_QQQ.log filesize=4096m

Expdp ogg/ogg schemas='CUI' directory=DATA_PUMP dumpfile=CUI_bak_%U flashback_scn=123456789 logfile=expdp_ CUI.log filesize=4096m

Expdp ogg/ogg schemas='test1' directory=DATA_PUMP dumpfile=test1_bak_%U flashback_scn=603809 logfile=expdp_QQQ.log filesize=4096m

Transfer the exported file to the disaster recovery end, and use the data pump to import the data:

Impdp ogg/ogg DIRECTORY=DATA_PUMP DUMPFILE=QQQ_bak_%U logfile=impdp_ QQQ.log

Impdp ogg/ogg DIRECTORY=DATA_PUMP DUMPFILE=CUI_bak_%U logfile=impdp_CUI.log

2.14 configuration of MGR parameters for disaster tolerant management process

PORT 7839

DYNAMICPORTLIST 7840-7860

-- AUTOSTART ER *

-- AUTORESTART EXTRACT *, RETRIES 5 Magi WAITMINUTES 3

PURGEOLDEXTRACTS. / dirdat/*,usecheckpoints, minkeepdays 2

Userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKEY default

2.15 Editing the GLOBALS parameter file

Change to the GoldenGate installation directory and execute the command:

Cd / u01/gg

. / ggsci

Ggsci > EDIT PARAMS. / GLOBALS

Add the following to the file:

GGSCHEMA ogg-the specified database user for DDL replication

2.16 REPN parameter configuration of replication process on disaster tolerance side

REPLICAT repn

Setenv (NLS_LANG=AMERICAN_AMERICA.WE8MSWIN1252)

Userid ogg, password AACAAAAAAAAAAADAHBLDCCIIOIRFNEPB, ENCRYPTKEY default

SQLEXEC "ALTER SESSION SET CONSTRAINTS=DEFERRED"

REPORT AT 01:59

REPORTCOUNT EVERY 30 MINUTES, RATE

REPERROR DEFAULT, ABEND

Assumetargetdefs

DISCARDFILE. / dirrpt/repna.dsc, APPEND, MEGABYTES 1024

DISCARDROLLOVER AT 02:30

ALLOWNOOPUPDATES

REPERROR (1403, discard)

DDL INCLUDE MAPPED

DDLOPTIONS REPORT

MAPEXCLUDE QQQ.T0417

MAP QQQ.*, TARGET QQQ.*

MAP CUI.*, TARGET CUI.*

2.17 create replication process repn

Execute the following command to create the replication process repn:

GGSCI > add replicat repn, exttrail. / dirdat/na, nodbcheckpoint

2.18 start the transmission process on the production side and the replication process on the disaster recovery side

GGSCI > start dpen

GGSCI > start REPLICAT repn aftercsn 123456789

2.19 Test scenario

(1) create a table on the production side database.

(2) modify the data of this table on the production side database.

(3) on the production side database, delete this table.

Thank you for reading! This is the end of the article on "how to install OGG". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

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