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

OGG single table initialization operation steps

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

Share

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

Sometimes the data at both ends of the ogg are inconsistent, and the amount of data is large, and manual modification is more complex, so we need to initialize these tables. The general idea of initialization is:

Stop both ends of OGG

If the business cannot be stopped for a long time, you need to configure the target process to pause the synchronization of these problem tables. After the new data is imported, stop the process again

The source side backs up the problem table through the SCN number and transmits it to the destination side for restoration.

Modify the process configuration of the target side and start the recovery from SCN

Start the OGG process

Crude configuration at the source end:

GGSCI (db1) 9 > infoall

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

EXTRACT RUNNING EXTFPZX 00:00:00 00:00:05

GGSCI (db1) 10 > view params EXTFPZX

Extract extfpzx

Useridogg,password ogg

Rmthost192.168.25.101,mgrport 7809

Rmttrail / u01/goldengate/dirdat/fp

Ddl include mappedobjname db_fpzx.*

Table db_fpzx.*

Crude configuration on the target side:

GGSCI (db2) 6 > infoall

Program Status Group Lag at Chkpt Time Since Chkpt

MANAGER RUNNING

REPLICAT RUNNING REPFPZX 00:00:00 00:00:01

GGSCI (db2) 7 > view params REPFPZX

REPLICAT repfpzx

USERID ogg,PASSWORDogg

Discardfile/u01/goldengate/discard/rep2_discard.dsc, append, megabytes 10

DDL INCLUDE MAPPED

DDLERROR DEFAULTIGNORE RETRYOP

ASSUMETARGETDEFS

Map db_fpzx.*,target db_fpzx.*

We initialize the db_fpzx.liuliu table

SQL > select * from liuliu

IDAGENAMEEEEWWW1

Liu

Liuliu2222

Liu

Liuliu2223

Liu123liuliu3334

Liu

Liuliu4445

Liu

Liuliu5556

Liu

Liuliu6667

Liu

Liuliu2228

Shshshs

Liuliu2229

Liu

Liuliu222

9 rowsselected.

If we delete the data in the destination side and insert several pieces of data in the source side, we will not report an error, but at this time, the data on both sides are inconsistent, so we need to initialize the destination side. Generally speaking, initialization is carried out when you don't know what data is lost. If there are two or three pieces of data that you know, it is faster to insert or modify them directly on the target side.

SQL > delete from liuliu

9 rows deleted.

SQL > commit

Commit complete.

SQL > select * from liuliu

No rows selected

1. Stop the OGG process at both ends

Source query SCN number:

SQL > selectdbms_flashback.get_system_change_number from dual

GET_SYSTEM_CHANGE_NUMBER

-

729295

2. Real-time processing

In the system with high real-time requirement of data, the problem table is determined first, and then the problem table is removed only in the target configuration file.

MAPEXCLUDE DB_FPZX.LIULIU

Then start the process.

3. The source side backs up the problem table through the SCN number and transmits it to the destination side for restoration.

Backup

Exp db_fpzx/fpzx file=/u01/backup/db_fpzx20161129.dmp tables= (liuliu) log=/u01/backup/db_fpzx20161129.log flashback_scn=729295

Transmission

Scp db_fpzx20161129.dmp oracle@192.168.25.101:/u01/backup

Reduction

Imp system/oracle file=/u01/backup/db_fpzx20161129.dmp fromuser=db_fpzx touser=db_fpzx tables=liuliu ignore=y

4. Modify the process configuration of the target side and restore it from SCN.

GGSCI (db2) 44 > edit params REPFPZX

REPLICAT repfpzx

USERID ogg,PASSWORD ogg

Discardfile / u01/goldengate/discard/rep2_discard.dsc, append, megabytes 10

DDL INCLUDE MAPPED

DDLERROR DEFAULT IGNORE RETRYOP

ASSUMETARGETDEFS

Map db_fpzx.liuliu, target db_fpzx.liuliu, filter (@ GETENV ("transaction", "csn") > 729295)

Map db_fpzx.*,target db_fpzx.*

~

~ 5. Start OGG to query the status of both ends

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