OGG 12.2.0.1在standby數(shù)據(jù)庫(kù)上安裝
###########################軟件安裝配置############################
1.設(shè)置ORACLE_HOME和ORACLE_SID(主庫(kù)、備庫(kù)、目標(biāo)庫(kù))
如果只有一個(gè)實(shí)例,只需要設(shè)置環(huán)境變量ORACLE_HOME和ORACLE_SID即可,如果有多個(gè)實(shí)例,需要在每個(gè)進(jìn)程組(process group)的配置文件中設(shè)置:
2.設(shè)置library的path,源端(主庫(kù)、備庫(kù)、目標(biāo)庫(kù))
export GG_HOME=/home/oracle/ogg
export PATH=$PATH:$GG_HOME
export LIBPATH=$GG_HOME:$ORACLE_HOME/lib
3.執(zhí)行runinstaller(主庫(kù)、備庫(kù)、目標(biāo)庫(kù))
./runinstaller
4.修改日志模式(主庫(kù))
SELECT supplemental_log_data_min, force_logging FROM v$database;
ALTER DATABASE ADD SUPPLEMENTAL LOG DATA;
ALTER DATABASE FORCE LOGGING;
SELECT supplemental_log_data_min, force_logging FROM v$database;
5.在數(shù)據(jù)庫(kù)中啟用ogg(主庫(kù)、目標(biāo)庫(kù))
alter system set ENABLE_GOLDENGATE_REPLICATION=true scope=both;
6.設(shè)置Flashback Query(主庫(kù)和備庫(kù))
UNDO_MANAGEMENT=AUTO
UNDO_RETENTION=86400 #需要計(jì)算得出
8.建立GoldenGate Credentials(主庫(kù)、目標(biāo)庫(kù))
create tablespace ogg_tbs datafile '/home/db/oracle/oradata/bidb/ogg_tbs01.dbf' size 1m autoextend on next 1m maxsize unlimited;
create user ogg identified by ogg123 default tablespace ogg_tbs quota unlimited on ogg_tbs;
9.執(zhí)行setup腳本(主庫(kù),目標(biāo)庫(kù))
@marker_setup.sql
@ddl_setup.sql
@role_setup.sql
@ddl_enable.sql
@ddl_pin ogg
10.安全相關(guān)認(rèn)證(主庫(kù)、備庫(kù)、目標(biāo)庫(kù))
$ ./ggsci
注意下面兩個(gè)語(yǔ)句末尾不能有分號(hào),否則報(bào)ERROR: Invalid command.
GGSCI> add credentialstore
GGSCI> alter credentialstore add user ogg,password ogg123
GGSCI> dblogin useridalias ogg
########################主庫(kù)上添加trandata###############################
11.在DG主庫(kù)上添加trandata(主庫(kù))
$ ./ggsci
GGSCI> dblogin useridalias ogg
GGSCI> add trandata scott.T
GGSCI> info trandata scott.*
#######################源端配置################################
12 配置manager進(jìn)程(備庫(kù))
$ ./ggsci
GGSCI> edit params mgr
內(nèi)容如下:
PORT 7809
DYNAMICPORTLIST 7801-7809
--AUTORESTART ER *,RETRIES 5,WAITMINUTES 7
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 7
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
13.配置抽取進(jìn)程:
GGSCI> add extract extncf, tranlog, begin now
GGSCI> add exttrail ./dirdat/et extract extncf, megabytes 100
GGSCI> edit params extncf
內(nèi)容如下:
EXTRACT extncf
--SETENV (ORACLE_HOME="/home/db/oracle/product/11.2.0")
--setenv (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
--setenv (ORACLE_SID="stby")
useridalias ogg
GETTRUNCATES
REPORTCOUNT EVERY 1 MINUTES, RATE
DISCARDFILE ./dirrpt/extncf.dsc,APPEND,MEGABYTES 1000
WARNLONGTRANS 2h,CHECKINTERVAL 10m
EXTTRAIL ./dirdat/et
--TRANLOGOPTIONS CONVERTUCS2CLOBS
TRANLOGOPTIONS EXCLUDEUSER ogg
TRANLOGOPTIONS MINEFROMACTIVEDG
DBOPTIONS ALLOWUNUSEDCOLUMN
--DYNAMICRESOLUTION
FETCHOPTIONS FETCHPKUPDATECOLS
--table
table SCOTT.T;
14.配置datapump進(jìn)程
GGSCI> add extract dpencf, exttrailsource ./dirdat/et
GGSCI> add rmttrail ./dirdat/rt, extract dpencf, megabytes 100
GGSCI> edit params dpencf
內(nèi)容如下:
EXTRACT dpencf
RMTHOST 192.168.137.7, MGRPORT 7800, compress
PASSTHRU
RMTTRAIL ./dirdat/rt
DYNAMICRESOLUTION
--table
table SCOTT.T;
15.啟動(dòng)進(jìn)程
$ ./ggsci
GGSCI> start mgr
GGSCI> start extncf
#######################目標(biāo)配置################################
16.目標(biāo)端GLOBALS配置:
GGSCI> edit params ./GLOBALS
內(nèi)容如下:
CHECKPOINTTABLE ogg.oggchkpt
GGSCI> exit
Shell> ggsci
(重新登陸以激活GLOBALS參數(shù))
GGSCI> dblogin useridalias ogg
GGSCI> add checkpointtable
17 配置目標(biāo)端manager進(jìn)程:
GGSCI> edit params mgr
內(nèi)容如下:
port 7800
DYNAMICPORTLIST 7801-7809
--AUTORESTART ER *,RETRIES 5,WAITMINUTES 7
PURGEOLDEXTRACTS ./dirdat/*,usecheckpoints, minkeepdays 7
LAGREPORTHOURS 1
LAGINFOMINUTES 30
LAGCRITICALMINUTES 45
18 配置目標(biāo)端復(fù)制進(jìn)程:
GGSCI> add replicat repncf, exttrail ./dirdat/rt
GGSCI> edit params repncf
內(nèi)容如下:
REPLICAT repncf
SETENV (ORACLE_HOME="/home/db/oracle/product/11.2.0")
setenv (NLS_LANG="AMERICAN_AMERICA.AL32UTF8")
setenv (ORACLE_SID="bidb")
useridalias ogg
--SQLEXEC "ALTER SESSION SET CONSTRAINTS=DEFERRED"
REPORT AT 01:59
REPORTCOUNT EVERY 30 MINUTES, RATE
REPERROR DEFAULT, ABEND
--numfiles 5000
--HANDLECOLLISIONS
assumetargetdefs
DISCARDFILE ./dirrpt/repncf.dsc, APPEND, MEGABYTES 1000
GETTRUNCATES
ALLOWNOOPUPDATES
--table
map SCOTT.T, target SCOTT.T;
#######################數(shù)據(jù)初始化################################
19.源端導(dǎo)出數(shù)據(jù)(主庫(kù)操作)
SQL> select dbms_flashback.get_system_change_number from dual;
GET_SYSTEM_CHANGE_NUMBER
------------------------
347494
expdp \'/ as sysdba\' directory=dump_dir dumpfile=scott.dmp logfile=scott.log tables=scott.t flashback_scn=347494
scp scott.dmp m3:/home/oracle/dump_dir
20.目標(biāo)端導(dǎo)入
cd /home/oracle/dump_dir
impdp \'/ as sysdba\' directory=dump_dir dumpfile=scott.dmp logfile=scott.log
#######################啟動(dòng)進(jìn)程################################
20.啟動(dòng)進(jìn)程
源端:
GGSCI> start extncf
目標(biāo)端:
GGSCI> alter replicat repncf extseqno 0, extrba 0
此處的extseqno后面的0代表trail文件的序號(hào),需要到ogg根目錄下的dirdat中檢查,如果初始配置的話,就是0
GGSCI> start repncf aftercsn 347494
成都創(chuàng)新互聯(lián)公司長(zhǎng)期為成百上千客戶提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開(kāi)放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為鄄城企業(yè)提供專業(yè)的成都網(wǎng)站設(shè)計(jì)、網(wǎng)站建設(shè),鄄城網(wǎng)站改版等技術(shù)服務(wù)。擁有10多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開(kāi)發(fā)。