search
HomeDatabaseMysql TutorialGoldenGate for Oracle 数据一致性初始化方案

GoldenGate for Oracle 数据一致性初始化方案

运维的过程是不断产生新的问题,需要不断研究和前进的过程。十一假期刚过客户就电话告知之前的Oracle 同步数据不一致需要处理,然而又不能停业务。

这里研究使用RMAN初始化方案

--不需要源数据库停机。

1.环境介绍:

客户三台数据库,三台之间相互同步DDL、DML

2.前言:

每个高可用的场景不一样,处理各有千秋,但是大致步骤雷同。我的故障不能直接就去处理这样的故障,需要先分析每个库的差异,哪个库的数据是正常的在初始化到其它数据库上,在启动同步。由于是生产环境,数据库的数据实时在变化,所以源端的抽取进程需要开启(传输进程可开),目标端的恢复停止,待初始化完成后再开启。

3.步骤如下:

生产端===============================================

1)使用oracle用户登录,执行rman备份

–备份数据库:

mkdir -p /data/backup /data/dbback/gpofullbak

chown -R oracle.oinstall /data/backup /data/dbback/gpofullbak

rman target /

run {

allocate channel ch00 type disk maxpiecesize 30g;

allocate channel ch01 type disk maxpiecesize 30g;

crosscheck backupset;

delete noprompt expired backupset;

sql 'alter system archive log current';

backup as backupset skip inaccessible tag hot_db_bk_level0

full database

format '/data/backup/bk_%s_%p_%t';

release channel ch00;

release channel ch01;

}

–备份归档和控制文件:

run {

ALLOCATE CHANNEL ch00 TYPE DISK MAXPIECESIZE 30g;

ALLOCATE CHANNEL ch01 TYPE DISK MAXPIECESIZE 30g;

sql 'alter system switch logfile';

sql 'alter system switch logfile';

sql 'alter system switch logfile';

sql 'alter system archive log current';

BACKUP ARCHIVELOG ALL FORMAT '/data/backup/ARCH_%U';

BACKUP CURRENT CONTROLFILE FORMAT '/data/backup/bk_controlfile';

RELEASE CHANNEL ch00;

RELEASE CHANNEL ch01;

}

--在源机执行

SQL>select * from Gv$log;

INST_ID    GROUP#        THREAD#  SEQUENCE#        BYTES        BLOCKSIZE    MEMBERS ARC STATUS          FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME

---------- ---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- --------- ------------ ---------

1            1              1        795  52428800              512          1 YES INACTIVE              17689009 09-OCT-15    17689018 09-OCT-15

1            2              1        796  52428800              512          1 YES INACTIVE              17689018 09-OCT-15    17689026 09-OCT-15

1            3              1        797  52428800              512          1 NO  CURRENT              17689026 09-OCT-15  2.8147E+14

记录该SCN号 17689018

========================================

SQL>create pfile='/tmp/initora11g.ora' from spfile ;

scp -rp /tmp/initora11g.ora root@192.168.80.71:/u01/app/oracle/product/11.2.0/db_1/dbs/

scp -rp /data/backup/ /data/dbback/ root@192.168.80.71:/data

目标端===============================================

2)启动数据库到nomount状态

SQL>startup nomount

3)启动RMAN恢复控制文件

rman target /

RMAN>restore controlfile from '/data/backup/bk_controlfile';

4)将数据库更改为mount状态

sqlplus / as sysdba

SQL>alter database mount;

5)启动RMAN恢复数据库

rman target /

RMAN>restore database;

RMAN>

run

{

set archivelog destination to '/u01/app/oracle/flash_recovery_area';

SET UNTIL SCN 17689018; #注意使用前面记录下的scn号

RECOVER DATABASE;

}

6)查看

SQL> SELECT CHECKPOINT_CHANGE#,CHECKPOINT_TIME FROM V$DATAFILE_HEADER;

CHECKPOINT_CHANGE# CHECKPOIN

------------------ ---------

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

17689018 09-OCT-15

8 rows selected.

SQL>alter database open resetlogs;

到这里备份恢复已经完成。

7)启动恢复

start rini_1, aftercsn 17689018

8)开启目标端所以进程

Oracle GoldenGate 学习教程一:介绍和安装 

Oracle GoldenGate 学习教程二、配置和使用 

Oracle GoldenGate 学习教程三、加密 

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Reduce the use of MySQL memory in DockerReduce the use of MySQL memory in DockerMar 04, 2025 pm 03:52 PM

This article explores optimizing MySQL memory usage in Docker. It discusses monitoring techniques (Docker stats, Performance Schema, external tools) and configuration strategies. These include Docker memory limits, swapping, and cgroups, alongside

How to solve the problem of mysql cannot open shared libraryHow to solve the problem of mysql cannot open shared libraryMar 04, 2025 pm 04:01 PM

This article addresses MySQL's "unable to open shared library" error. The issue stems from MySQL's inability to locate necessary shared libraries (.so/.dll files). Solutions involve verifying library installation via the system's package m

How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Run MySQl in Linux (with/without podman container with phpmyadmin)Run MySQl in Linux (with/without podman container with phpmyadmin)Mar 04, 2025 pm 03:54 PM

This article compares installing MySQL on Linux directly versus using Podman containers, with/without phpMyAdmin. It details installation steps for each method, emphasizing Podman's advantages in isolation, portability, and reproducibility, but also

What is SQLite? Comprehensive overviewWhat is SQLite? Comprehensive overviewMar 04, 2025 pm 03:55 PM

This article provides a comprehensive overview of SQLite, a self-contained, serverless relational database. It details SQLite's advantages (simplicity, portability, ease of use) and disadvantages (concurrency limitations, scalability challenges). C

Running multiple MySQL versions on MacOS: A step-by-step guideRunning multiple MySQL versions on MacOS: A step-by-step guideMar 04, 2025 pm 03:49 PM

This guide demonstrates installing and managing multiple MySQL versions on macOS using Homebrew. It emphasizes using Homebrew to isolate installations, preventing conflicts. The article details installation, starting/stopping services, and best pra

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks agoBy尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment