In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Http://www.dataguru.cn/thread-171156-1-1.html
Introduction to several important processes of GoldenGate:
1. The Manager management process starts at both ends, monitors and restarts other processes, allocates data storage and reports errors and events
2. The Extract process grabs and transfers transaction data from the log to the target side.
3. The Server Collector process accepts data on the target side and writes it to the trail file.
4. The Replicat process reads the trail file and applies it to the traget database
5. The trail file is the file of gg's own capture information, which is an OS file, stored under. / dirdat/, named after X00000, N order 1min2jue 3. This file is automatically deleted after using the configurable parameters.
Question:
1. The database is set to archive mode
2. Pay special attention to the relationship among extraction process, delivery process and receiving process
The extraction process defines the file path as the local path of the delivery process add extract pump_so,exttrailsource. / dirdat/et/dd
The extraction process defines the remote file path as accepting the process path add replicat rep7,exttrail. / dirdat/dp1/sd
The environment prepares and installs GoldenGate
1. Database readiness
1) Source server
IP address: 192.168.14.150
Database: 10.2.0.5 64 bit
SID: orcl
Operating system version: Oracle 5.464 bit
Database: 10.2.0.5 64 bit
SID: slave
Operating system version: Oracle 5.464 bit
two。 Download the OGG software and extract the installation
1) Source server
Mkdir-p / u01/app/oracle/ogg
Unzip fbo_ggs_Linux_x64_ora10g_64bit.zip
Tar-xvf fbo_ggs_Linux_x64_ora10g_64bit.tar-C / u01/app/oracle/ogg/
Chown-R oracleinstall / u01/app/oracle/ogg
2) all target servers should be configured
Mkdir-p / u01/app/oracle/ogg
Unzip fbo_ggs_Linux_x64_ora10g_64bit.zip
Tar-xvf fbo_ggs_Linux_x64_ora10g_64bit.tar-C / u01/app/oracle/ogg/
Chown-R oracle:oinstall / u01/app/oracle/ogg
3. Prepare the OGG environment variable
# both source server and target server should be configured
$vi / home/oracle/.bash_profile
Add the following line:
Export GGATE=$ORACLE_BASE/ogg
Effective environment variable
Source / home/oracle/.bash_profile
4. Configure log mode
# Source server, destination server does not need to be configured (non-bidirectional)
1) View the regulation file and log mode
Select log_mode,supplemental_log_data_min,force_logging from v$database
2) configure it in regular file mode
Shutdown immediate
Startup mount
Alter database archivelog
Alter database open
Alter system set log_archive_dest_1='location=/u01/archive' scope=both
3) configure log mode (open mandatory file and supplementary log mode)
Alter database add supplemental log data
Alter database force logging
4) View the configuration results:
SQL > select log_mode,supplemental_log_data_min,force_logging from v$database
LOG_MODE SUPPLEME FOR
-
ARCHIVELOG YES YES
5. Create a GoldenGate user account
1) Source server
Conn / as sysdba
Create tablespace tbs_ogg datafile'/ u01 size size oracle autoextend on next 10m
Create user ogg identified by ogg default tablespace tbs_ogg temporary tablespace TEMP quota unlimited on tbs_ogg
Grant connect,resource to ogg
Grant create session,alter session to ogg
Grant select any dictionary,select any table to ogg
Grant alter any table to ogg
Grant flashback any table to ogg
Grant execute on dbms_flashback to ogg
2) Target server
Conn / as sysdba
Create tablespace tbs_ogg datafile'/ u01 size size oracle autoextend on next 10m
Create user ogg identified by ogg default tablespace tbs_ogg temporary tablespace TEMP quota unlimited on tbs_ogg
Grant connect,resource to ogg
Grant create session,alter session to ogg
Grant select any dictionary,select any table to ogg
Grant alter any table to ogg
Grant flashback any table to ogg
Grant execute on dbms_flashback to ogg
Grant insert any table to ogg
Grant delete any table to ogg
Grant update any table to ogg
6. Install GoldenGate softwar
(1) both the source server and the target server should be configured
. / ggsci
GGSCI (test) 1 > create subdirs
Parameter files / u01/app/oracle/ogg/dirprm: created
Report files / u01/app/oracle/ogg/dirrpt: created
Checkpoint files / u01/app/oracle/ogg/dirchk: created
Process status files / u01/app/oracle/ogg/dirpcs: created
SQL script files / u01/app/oracle/ogg/dirsql: created
Database definitions files / u01/app/oracle/ogg/dirdef: created
Extract data files / u01/app/oracle/ogg/dirdat: created
Temporary files / u01/app/oracle/ogg/dirtmp: created
Veridata files / u01/app/oracle/ogg/dirver: created
(2) all target servers should be configured.
. / ggsci
GGSCI (slave) 1 > create subdirs
Creating subdirectories under current directory / u01/app/oracle/ogg
Parameter files / u01/app/oracle/ogg/dirprm: created
Report files / u01/app/oracle/ogg/dirrpt: created
Checkpoint files / u01/app/oracle/ogg/dirchk: created
Process status files / u01/app/oracle/ogg/dirpcs: created
SQL script files / u01/app/oracle/ogg/dirsql: created
Database definitions files / u01/app/oracle/ogg/dirdef: created
Extract data files / u01/app/oracle/ogg/dirdat: created
Temporary files / u01/app/oracle/ogg/dirtmp: created
Veridata files / u01/app/oracle/ogg/dirver: created
7. Configuration source and target databases are consistent
There are many ways to configure the consistency of source and target data, which can be done by oracle. In this way, imp is used to achieve the consistency of the initial data table.
(1) Source test users:
Create user hr identified by hr
Grant connect,resource,select_catalog_role to hr
Conn hr/hr
Create table T1 as select * from dba_objects
Alter table T1 add constraint prikey_t1 primary key (object_id)
(2) Test users on the target side:
The target server is imported through exp/imp, only the table structure is imported.
Create user hr identified by hr
Grant connect,resource,select_catalog_role to hr
Conn hr/hr
Imp hr/hr file=hr.dmp rows=n
Note: data synchronization can also be achieved by initializing data loading with goldengate.
II. GoldenGate DML synchronization source configuration
Configuration ideas:
1) configure DML synchronization first
2) configure DDL synchronization again
. / ggsci
1. Source MGR process and start
1) Edit the main process group
PORT 7809
DYNAMICPORTLIST 7800-7900
AUTORESTART EXTRACT *, RETRIES 3, WAITMINUTES 5, RESETMINUTES 60
PURGEOLDEXTRACTS. / dirdat/*/*, USECHECKPOINTS, MINKEEPFILES 100
LAGREPORTMINUTES 1
LAGINFOMINUTES 1
LAGCRITICALMINUTES 1
Description:
Port specifies the mgr process communication port
Dynamicportlist indicates that the mgr process can specify ports for dynamic communication between source and destination
Autorestart extract means to automatically restart the extract process group, try to restart all processes every 2 minutes, retry 5 times, and clear zero every 5 minutes.
After configuring the parameters, the restart of the mgr process takes effect
2) start the main management process
Start mgr
two。 Configure the Extract process group
1) Edit configuration file
Edit params eora
Extract eora
Dynamicresolution
SETENV (ORACLE_HOME= "/ u01/app/oracle/product/11.2.0/db_1")
SETENV (ORACLE_SID= "source")
SETENV (NLS_LANG= "AMERICAN_AMERICA.ZHS16GBK")
UsERID ogg password ogg
Exttrail. / dirdat/et/dd- this path is closely related to the pump process
Ddl include all
Ddloptions addtrandata, report
Table hr.*
2) add extraction process
Add extract eora, tranlog,begin now
3) add a local trail file
ADD EXTTRAIL. / dirdat/et/dd (this path is closely related to the pump process) EXTRACT eora, MEGABYTES 5
Description: create a local trail file, the main extract process is responsible for writing this part of the file, and pump is responsible for transmitting this part of the file to the target server.
4) start the service
Start extract eora
3. Configure the Pump process group
1) Edit configuration file
Edit params pump_so
EXTRACT pump_so
PASSTHRU
DYNAMICRESOLUTION
RMTHOST 192.168.31.14, MGRPORT 7809
RMTTRAIL. / dirdat/dp1/sd
DISCARDFILE. / dirrpt/dp2.dsc,APPEND,MEGABYTES 5
DISCARDROLLOVER AT 6:00
REPORTROLLOVER AT 6:00
REPORTCOUNT EVERY 1 HOURS,RATE
Table hr.*
2) add a pump process and indicate the local file
Add extract pump_so,exttrailsource. / dirdat/et/dd (pay special attention to the location of the extraction process file queue)
3) add remote trail files
Add RMTTRAIL. / dirdat/dp1/sd (pay special attention to the location of the parameter file rmttrail), EXTRACT PUMP_SO, MEGABYTES 5
Description: specify a remote trail file
4) start the pump process
Start extract pump_so
3. GoldenGate DML synchronization destination configuration
1. Target-side MGR process
1) Edit configuration file
Edit params mgr
Port 7809
Dynamicportlist 7800-8000
Autostart er *
Autorestart extract *, waitminutes 2, resetminutes 5
Lagreporthours 1
Laginfominutes 3
Lagcriticalminutes 5
Purgeoldextracts / u01 minkeepdays minkeepdays, usecheckpoints, oracle
2) start
Start mgr
two。 Add checklist
Note: when we specify the default checkpoint in the GLOBALS file, the new Replicat groups will automatically use this parameter when it is created, and no other instructions are required.
1) Edit the global configuration file
Edit params. / GLOBALS
Successfully logged into database.
GGSCI (slave) 2 > add checkpointtable ogg.checkpoint
Successfully created checkpoint table OGG.CHECKPOINT.
Configure the target side Peplicat process group
1) Edit configuration file
Edit params repl
REPLICAT rep1
SETENV (ORACLE_HOME = "/ u01/app/oracle/product/11.2.0/db_1")
SETENV (ORACLE_SID = "target")
SETENV (NLS_LANG = "AMERICAN_AMERICA.ZHS16GBK")
USERID ogg, PASSWORD ogg
HANDLECOLLISIONS
ASSUMETARGETDEFS
DISCARDFILE. / dirrpt/rep1.dsc, append, megabytes 5
-- SOURCEDEFS. / dirdef/def.def
DDL INCLUDE MAPPED, OBJTYPE 'TABLE' &
INCLUDE MAPPED OBJTYPE 'INDEX'
MAP hr.T1, TARGET hr.T1
2) add replication process
Add replicat rep7,exttrail. / dirdat/dp1/sd (this path is the remote path defined by the pump process)
3) start the process
Start repl
4. You can view the checkpoint status
Su-oracle
Sqlplus ogg/ogg
SQL > select tname from tab
TNAME
-
CHECKPOINT TABLE
CHECKPOINT_LOX TABLE
Select * from checkpoint
Note 1:ogg_11.1.1.1.2 has only one table for CHECKPOINT.
Note 2:ogg_11.2.x.x.1 has two tables of CHECKPOINT,CHECKPOINT_LOX.
5. DML configuration test
1) the number of records of the table viewed by the source
Conn hr/hr
SQL > select count (*) from T1
2) submit after performing DML operation
SQL > delete from T1 where rownum
< 200; SQL>Select count (*) from T1
3) View on the destination side
Conn hr/hr
SQL > select count (*) from T1
Description:
At this point, the goldengate DML one-way configuration has been configured, through a simple test example.
3) install DDL object
SQL > grant dba to ogg
SQL > @ marker_setup description: all specify user ogg
SQL > @ ddl_setup description: 11.1.1.2 requires manual input of ogg,INITIALSETUP,yes
SQL > @ role_setup
SQL > grant GGS_GGSUSER_ROLE to ogg
SQL > @ ddl_enable
SQL > @ marker_status.sql
SQL > @? / rdbms/admin/dbmspool.sql
Note 1: executing the dbmspool package creates the DBMS_SHARED_POOL package in the database, after which the ddl_pin package needs to be used
Note 2: execute ddl_pin.sql to keep DDLReplication-related objects in a shared pool through the dbms_shared_pool.keep stored procedure to ensure that these objects do not RELOAD and improve performance.
SQL > @ ddl_pin.sql ogg
two。 Modify the params file of the extract process
# Server source configuration
# the source side modifies the params file of the extract process, adds the "ddl include all" parameter, and restarts the extract process
1) stop the eora_t1 process
GGSCI (test) 2 > stop extract eora
2) Edit configuration file
GGSCI (test) 3 > edit params eora
Extract eora
Dynamicresolution
Setenv (NLS_LANG=AMERICAN_AMERICA.ZHS16GBK)
Userid ogg,password ogg
Exttrail / u01/app/oracle/ogg/dirdat/et
Ddl include all
Ddloptions addtrandata, report
Table hr.*
# description: add two lines tranlogoption and ddl
3) start the mgr,eora process
GGSCI (test) 4 > start mgr
GGSCI (test) 5 > start extract eora
4) check the startup of the eora_t1 process
GGSCI (test) 6 > info extract eora
3. Modify the params file of the target replicat process
# Target server configuration
# modify the params file of the replicat process on target
Add parameters such as "ddlerror default ignore retryop maxretries 3 retrydelay 5" to restart the replicat process
1) stop the mgr process
GGSCI (slave) 1 > stop mgr
2) stop the repl process
GGSCI (slave) 1 > stop replicat repl
3) Edit repl configuration file
GGSCI (slave) 1 > edit params repl
GGSCI (slave) 2 > view params repl
Replicat repl
Userid ogg, password ogg
Assumetargetdefs
Reperror default, discard
Discardfile / u01/app/oracle/ogg/dirrpt/repl.dsc, append, megabytes 50
Dynamicresolution
Ddloptions report
Ddlerror default ignore retryop maxretries 3 retrydelay 5
Ddlerror default discard
Ddlerror default ignore retryop
Map hr.*, target hr.*
Note: it indicates that the target side does not need to configure DDL include all statements, otherwise, errors will occur.
# # Error text [Error code [1031], ORA-01031: insufficient privileges
4) start the rora_t1 process
GGSCI (slave) 5 > info replicat repl
4. test
Create a table on the source side of the hr user to see if the destination side has been created successfully.
Create table abc (id integer, name char (10))
Insert into abc values (1, 'abc')
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.