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

OOG: the OGG between two instances of a server

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

Share

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

Here we have to complain that there was something wrong with the brother who proposed the test, and then I said to him to do it. But he now plays video games in Internet cafes.

The purpose and idea of testing

The main purpose of this paper is to verify whether synchronization between instances can be practiced through OGG on a multi-instance server (table data between two instances on a host is synchronized through OGG)

Main idea: generally, our idea of OGG is extraction, transmission and application. Although OGG has many applications, but most of them are multiple servers, after all, it is rare to encounter a server to do ogg between two libraries. When my brother asked me if this environment could be synchronized through OGG, my first reaction was yes, probably by extracting it and putting it into direct application locally. (it can be tested.)

Environment description operating system: RatHat Linux 6.5x64 hostname: source.zhanIP address: 192.168.214.52 Database version: 11.2.0.4 x64 Database SID:zhankys (source), zhankyd (destination) OGG version: 12.1.2.1 Environment preparation

Create the required directory and authorize

Empower the installation package mkdir-p / softchown-R oracle:oinstall / softchmod-R 775 / soft-- archive log path mkdir-p / archivelog/zhankysmkdir-p / archivelog/zhankydchown-R oracle:oinstall / archivelogchmod-R 775 / archivelog-- to create the OGG installation directory mkdir / oggchown-R oracle:oinstall / oggchmod-R 775 / ogg-- to set the OGG environment variable echo 'export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib' > > / home/oracle/.bash_profile

Database preparation (zhankys)

-- Log in to the database export ORACLE_SID=zhankyssqlplus / as sysdba-- to create an ogg account create tablespace ogg_tablespace datafile'/ u01ActionPlacedoradataActionzhankysGOG01.dbf' size 10m autoextend on next 5m autoextend on next create user goldengate identified by goldengate default tablespace ogg_tablespace;grant dba to goldengate;-- to check whether the archive, mandatory log mode, database-level supplementary logs are enabled (pay attention to the archive directory) archive log list;select force_logging,supplemental_log_data_min from vault database show show parameter enable_goldengate_replication -- enable archival shutdow immediatestart mountalter database archivelog;alter system set log_archive_dest_1='location=/archivelog/zhankys' scope = both;alter database open;-- enable database mandatory log mode, database-level supplementary log alter database force logging;alter database add supplemental log data;-- modification allows the use of ogg parameters (for 11.2.0.4 library) ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE SCOPE=BOTH

Database preparation (zhankyd)

-- Log in to the database export ORACLE_SID=zhankydsqlplus / as sysdba-- to create an ogg account-- create an ogg account create tablespace ogg_tablespace datafile'/ u01ActionoradataActionActionoradataActionOG01.dbf'size 10m autoextend on next 5m create user goldengate identified by goldengate default tablespace ogg_tablespace;grant dba to goldengate;-- to check whether the archive, mandatory log mode, database-level supplementary logs are enabled (pay attention to the archive storage directory) archive log list;select force_logging,supplemental_log_data_min from v$database Show parameter enable_goldengate_replication;-- enable archiving shutdow immediatestart mountalter database archivelog;alter system set log_archive_dest_1='location=/archivelog/zhankyd' scope = both;alter database open;-- enable database mandatory log mode, database-level supplementary log alter database force logging;alter database add supplemental log data;-- modification allows the use of ogg parameters (for 11.2.0.4 library) ALTER SYSTEM SET ENABLE_GOLDENGATE_REPLICATION = TRUE SCOPE=BOTH

Change tnsname (same source destination)

Vi / u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora {ZHANKYS = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.214.52) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ZHANKYS)) ZHANKYD = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.214.52) (PORT = 1521) )) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = ZHANKYD))}

Initialize data preparation (both libraries are built)

Connect goldengate/goldengate-- creates tables DROP TABLE tcustmer;CREATE TABLE tcustmer (cust_code VARCHAR (4) NOT NULL, name VARCHAR (30), city VARCHAR (20), state CHAR (2), PRIMARY KEY (cust_code); DROP TABLE tcustord;CREATE TABLE tcustord (cust_code VARCHAR (4) NOT NULL, product_code VARCHAR (8) NOT NULL,order_id INTEGER NOT NULL, product_price DECIMAL (8), product_amount INTEGER,transaction_id INTEGER, PRIMARY KEY (cust_code, product_code, order_id); select * from goldengate.tcustmer Select * from goldengate.tcustord; install OGG

OGG software installation

Xhost + su-oraclecd / softunzip 121210_ggs_Linux_x64_shiphome.zipcd fbo_ggs_Linux_x64_shiphome/Disk1/./runInstaller

Configure OGG parameters

Create an ogg directory

Cd / ogg./ggscicreate subdirs

Create the checkpoint table (note that dblogin is created to both libraries)

-- Source host creates checkpoint table {dblogin userid goldengate@zhankys,password goldengateadd checkpointtable goldengate.ggs_checkpoint}-- after source instance is created, exit builds checkpoint table {dblogin userid goldengate@zhankyd,password goldengateadd checkpointtable goldengate.ggs_checkpoint} in login destination database.

Set up globals

Edit params. / globals {UNLOCKEDTRAILFILES}

Configure MGR

Edit params mgr {PORT 7809AUTOSTART ER * AUTORESTART ER *, RETRIES 3no. WAITMINUTES 5J RESETMINUTES 60LAGREPORTHOURS 1LAGINFOMINUTES 3LAGCRITICALMINUTES 10PURGEOLDEXTRACTS. / dirdat/*,USECHECKPOINTS,MINKEEPDAYS 3} start mgr

Configure the objects that require trandata (the tracked table is the source database, pay attention to whether the dblogin login is the source database)

Dblogin userid goldengate@zhankys,password goldengateadd trandata goldengate.tcustmeradd trandata goldengate.tcustordinfo trandata goldengate.*

Configure extract (note that userid specifies the extracted library)

Add extract eLINTERVAL userid goldengate@zhankys,password goldengateEXTTRAIL. / dirdat/single,extract bachelors 29dirrpt/e_single.dsc,PURGE--NOCOMPRESSDELETESNOCOMPRESSUPDATESGETUPDATEBEFORESGETUPDATEAFTERSTRANLOGOPTIONS LOGRETENTION disabledWARNLONGTRANS megabytes 5 edit param e_single {EXTRACT e_singleSETENV (NLS_LANG= "AMERICAN_AMERICA.ZHS16GBK") GETENV (NLS_LANG) userid goldengate@zhankys,password goldengateEXTTRAIL. / dirdat/single,FORMAT RELEASE 12.1DISCARDFILE. / dirrpt/e_single.dsc,PURGE--NOCOMPRESSDELETESNOCOMPRESSUPDATESGETUPDATEBEFORESGETUPDATEAFTERSTRANLOGOPTIONS LOGRETENTION disabledWARNLONGTRANS 30m 3mtable goldengate.tcustmer;table goldengate.tcustord;} start e_singleinfo e_single

Configure replicat (note that userid specifies the library of the application)

Dblogin userid goldengate@zhankyd,password goldengateadd replicat ringing singleSingle exttrail. / dirdat/single,checkpointtable goldengate.ggs_checkpointedit param r_single {REPLICAT r_singleSETENV (NLS_LANG= "AMERICAN_AMERICA.ZHS16GBK") GETENV (NLS_LANG) USERID goldengate@zhankyd,PASSWORD goldengateHANDLECOLLISIONSASSUMETARGETDEFSREPERROR DEFAULT,DISCARDDBOPTIONS NOSUPPRESSTRIGGERSDISCARDFILE. / dirrpt/b_r_29.dsc,PURGEMAP goldengate.TCUSTMER, TARGET goldengate.TCUSTMER;MAP goldengate.TCUSTORD, TARGET goldengate.TCUSTORD;} start r_singleinfo r_single check result statement select * from goldengate.TCUSTMER;select * from goldengate.TCUSTORD INSERT INTO goldengate.tcustmer VALUES ('ZZZ','BG SOFTWARE CO.','SEATTLE','WZ'); INSERT INTO goldengate.tcustord VALUES (' ZZZ','CAR',144,17520,3100); COMMIT;INSERT INTO goldengate.tcustmer VALUES ('ZqZZ','BqG SOFTWARE CO.','SEATTLE','WZ'); INSERT INTO goldengate.tcustord VALUES (' ZqZZ','CAR',144,17520,3100); COMMIT;INSERT INTO goldengate.tcustmer VALUES ('ZbZ','BzG SOFTWARE CO.','SEATTLE','WZ') INSERT INTO goldengate.tcustord VALUES ('ZbZ','CAR',144,17520,3100); COMMIT;INSERT INTO goldengate.tcustmer VALUES (' ZghZ','BG SOFTWARE CO.','SEATTLE','WZ'); INSERT INTO goldengate.tcustord VALUES ('ZghZ','CAR',144,17520,3100); COMMIT;delete goldengate.tcustmer where cust_code='ZZZ';delete goldengate.tcustord where cust_code='ZZZ';delete goldengate.tcustmer where cust_code='ZqZZ';delete goldengate.tcustord where cust_code='ZqZZ';delete goldengate.tcustmer where cust_code='ZbZ' Delete goldengate.tcustord where cust_code='ZbZ';delete goldengate.tcustmer where cust_code='ZghZ';delete goldengate.tcustord where cust_code='ZghZ';commit

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