Goldengate for oracle 資料一致性初始化方案

來源:互聯網
上載者:User

標籤:goldengate   ogg   

營運的過程是不斷產生新的問題,需要不斷研究和前進的過程。十一假期剛過客戶就電話告知之前的oracle 同步資料不一致需要處理,然而又不能停業務。


這裡研究使用RMAN初始化方案

--不需要來源資料庫停機。


1.環境介紹:

客戶三台資料庫,三台之間相互同步DDL、DML


2.前言:

每個高可用的情境不一樣,處理各有千秋,但是大致步驟雷同。我的故障不能直接就去處理這樣的故障,需要先分析每個庫的差異,哪個庫的資料是正常的在初始化到其它資料庫上,在啟動同步。由於是生產環境,資料庫的資料即時在變化,所以源端的抽取進程需要開啟(傳輸進程可開),目標端的恢複停止,待初始化完成後再開啟。


3.步驟如下:

生產端===============================================

1)使用oracle使用者登入,執行rman備份

–備份資料庫:

mkdir -p /data/backup /data/dbback/gpofullbakchown -R oracle.oinstall /data/backup /data/dbback/gpofullbakrman 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_level0full databaseformat ‘/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 [email protected]:/u01/app/oracle/product/11.2.0/db_1/dbs/scp -rp /data/backup/ /data/dbback/ [email protected]:/data

目標端===============================================

2)啟動資料庫到nomount狀態

SQL>startup nomount


3)啟動RMAN恢複控制檔案

rman target /RMAN>restore controlfile from ‘/data/backup/bk_controlfile‘;

4)將資料庫更改為mount狀態

sqlplus / as sysdbaSQL>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-158 rows selected.SQL>alter database open resetlogs;


到這裡備份恢複已經完成。

7)啟動恢複

start rini_1, aftercsn 17689018

8)開啟目標端所以進程


本文出自 “每天一點點” 部落格,請務必保留此出處http://perlin.blog.51cto.com/1202304/1701437

Goldengate for oracle 資料一致性初始化方案

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.