Oracle Goldengate采用RMAN进行初始化全过程

教程发布:风哥 教程分类:ITPUX技术网 更新日期:2022-02-12 浏览学习:356

Oracle Goldengate采用RMAN进行初始化全过程

[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]1.环境介绍:
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]客户三台数据库,三台之间相互同步DDL、DML
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]2.前言:[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]每个高可用的场景不一样,处理各有千秋,但是大致步骤雷同。我的故障不能直接就去处理这样的故障,需要先分析每个库的差异,哪个库的数据是正常的在初始化到其它数据库上,在启动同步。由于是生产环境,数据库的数据实时在变化,所以源端的抽取进程需要开启(传输进程可开),目标端的恢复停止,待初始化完成后再开启。
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]3.步骤如下:
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]生产端===============================================[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]1)使用oracle用户登录,执行rman备份[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]–备份数据库:[color=#555555][font=宋体,][font=Consolas,]

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;[font=Consolas]}
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]–备份归档和控制文件: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;[font=Consolas]}[color=#555555][font=宋体,][font=Consolas,]

[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]--在源机执行SQL>select * from Gv$log; INST_ID GROUP# THREAD# SEQUENCE# BYTES BLOCKSIZE MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM NEXT_CHANGE# NEXT_TIME[color=#555555][font=宋体,][font=Consolas,]

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[font=Consolas] [font=Consolas]1 3 1 797 52428800 512 1 NO CURRENT 17689026 09-OCT-15 2.8147E+14[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]记录该SCN号 17689018[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]======================================== 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[font=Consolas] [font=Consolas]1 3 1 797 52428800 512 1 NO CURRENT 17689026 09-OCT-15 2.8147E+14[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]目标端===============================================[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]2)启动数据库到nomount状态[font=Consolas]startup nomount[font=Consolas]
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]3)启动RMAN恢复控制文件rman target /[font=Consolas]RMAN>restore controlfile from [color=rgb(0, 0, 255)][font=Consolas]'/data/backup/bk_controlfile'[font=Consolas];[font=Consolas]
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]4)将数据库更改为mount状态sqlplus / as sysdba[font=Consolas]SQL>alter database [color=rgb(255, 20, 147)][font=Consolas]mount[font=Consolas];

[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]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;[font=Consolas]}
[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]6)查看[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]
[color=rgb(85, 85, 85)]SQL> SELECT CHECKPOINT_CHANGE#,CHECKPOINT_TIME FROM V$DATAFILE_HEADER;[color=rgb(85, 85, 85)]CHECKPOINT_CHANGE# CHECKPOIN[color=rgb(85, 85, 85)]------------------ ---------[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)] 17689018 09-OCT-15[color=rgb(85, 85, 85)]8 rows selected.[color=rgb(85, 85, 85)]
[color=rgb(85, 85, 85)]SQL>alter database open resetlogs;[color=#555555]
[color=#555555][font=宋体,][font=Consolas,]
[align=right]

[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]到这里备份恢复已经完成。[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]7)启动恢复[color=#555555][font=宋体,][font=Consolas,][font=Consolas]start rini_1, aftercsn 17689018

[p=28, null, left][color=rgb(85, 85, 85)][font=宋体,]8)开启目标端所以进程

本文标签:
网站声明:本文由风哥整理发布,转载请保留此段声明,本站所有内容将不对其使用后果做任何承诺,请读者谨慎使用!
【上一篇】
【下一篇】