ogg操作手册.docx
《ogg操作手册.docx》由会员分享,可在线阅读,更多相关《ogg操作手册.docx(8页珍藏版)》请在冰豆网上搜索。
ogg操作手册
ogg操作手册
版本:
V1.0
1.源端库准备工作
[oracle@rac1~]$ps-ef|grepogg|grep-vgrep
//查看业务系统是否安装过ogg
[oracle@rac1~]$sqlplus/assysdba
SQL>showparameterprocesses;
//查询oracle最大连接数
SQL>selectcount(*)fromv$process;
//查询当前连接数
SQL>archiveloglist
//查看是否开启归档
DatabaselogmodeArchiveMode
AutomaticarchivalEnabled–开启状态
Archivedestination+ARCHDG
Oldestonlinelogsequence342
Nextlogsequencetoarchive343
Currentlogsequence343
******************开启归档的步骤***************************
SQL>shutdownimmediate;
//必须是immediate一至性关闭数据库
SQL>startupmount;
//开启数据库到mount状态
SQL>altersystemsetlog_archive_dest_1='location=+archdg';
//指定归档日志存放的路径
SQL>alterdatabasearchivelog;
//开启归档
SQL>alterdatabaseopen;
//打开数据库
SQL>altersystemswitchlogfile;
//切换归档
SQL>altersystemarchivelogcurrent;
//切换归档
SQL>SELECTFORCE_LOGGINGFROMV$DATABASE;
//查看是否开启强制日志
SQL>alterdatabaseforcelogging;
//开启强制日志的命令
SQL>selectsupplemental_log_data_minfromv$database;
//查看是否开启附加日志
SQL>alterdatabaseaddsupplementallogdata;
//开启附加日至命令
SQL>altersystemswitchlogfile;
//切换归档
1.1创建ogg管理用户并授权
SQL>createusercas_sgcisidentifiedbySap12345;
SQL>grantconnecttocas_sgcis;
SQL>grantSELECTANYDICTIONARYtocas_sgcis;
SQL>grantselectanytabletocas_sgcis;
1.2安装telnet工具
[oracle@rac1~]$rpm-ivhtelnet-0.17-47.el6_3.1.x86_64.rpm
[oracle@rac1~]$rpm-ivhtelnet-server-0.17-47.el6_3.1.x86_64.rpm
//源端和目标端都要安装telnet
编辑设置/etc/xinetd.d/telnet,将disable=yes设置成disable=no
echo'pts/0'>>/etc/securetty
echo'pts/1'>>/etc/securetty
servicexinetdrestart
//设置root远程登录
1.3磁盘使用情况
[oracle@rac1~]$df-h
FilesystemSizeUsedAvailUse%Mountedon
/dev/sda3145G19G119G14%/
tmpfs1.5G980M457M69%/dev/shm
/dev/sda1291M39M238M14%/boot
2.源端ogg准备工作
[oracle@rac1~]$mkdir/ogg
//创建ogg目录
[oracle@rac1~]$chownoracle:
oinstall-R/ogg
[oracle@rac1~]$chmod775-R/ogg
2.1设置ogg环境变量
[oracle@rac1~]$vi.bash_profile
exportOGG_HOME=/ogg
[oracle@rac1~]$..bash_profile
2.2上传ogg软件到相关目录
[oracle@rac1ogg]$unzipogg112101_fbo_ggs_Linux_x64_ora11g_64bit.zip
[oracle@rac1ogg]$tar-xvffbo_ggs_Linux_x64_ora11g_64bit.tar
//解压ogg软件
[oracle@rac1ogg]$cp$ORACLE_HOME/lib/libnnz11.so/ogg
[oracle@rac1ogg]$cp$ORACLE_HOME/lib/libclntsh.so.11.1/ogg
//拷贝ogg所需要的共享文件
[oracle@rac1ogg]$./ggsci
GGSCI(rac1)1>createsubdirs
//初始化ogg目录
Creatingsubdirectoriesundercurrentdirectory/ogg
Parameterfiles/ogg/dirprm:
alreadyexists
Reportfiles/ogg/dirrpt:
created
Checkpointfiles/ogg/dirchk:
created
Processstatusfiles/ogg/dirpcs:
created
SQLscriptfiles/ogg/dirsql:
created
Databasedefinitionsfiles/ogg/dirdef:
created
Extractdatafiles/ogg/dirdat:
created
Temporaryfiles/ogg/dirtmp:
created
Stdoutfiles/ogg/dirout:
created
2.3登陆
GGSCI(rac1)1>dbloginuseridcas_sgcis,passwordSap12345
2.4创建def文件
GGSCI(rac1)1>editparamsfdpm_def
defsfile/ogg/dirdef/fdpmaster_ah.def
useridCAS_SGCIS,passwordSap12345
tablefdpmaster_ah.G_LINE;
[oracle@rac1ogg]$./defgenparamfile./dirprm/fdpm_def.prm
//生成def定义文件
[oracle@rac1ogg]$scp/ogg/dirdef/fdpmaster_ah.defroot@192.168.1.205:
/ogg/dirdef
//把定义文件传到目标端
2.5创建Manager进程
GGSCI>editparamsmgr
PORT8333
DYNAMICPORTLIST8334-8999
--AUTOSTARTER*
AUTORESTARTEXTRACT*,RETRIES5,WAITMINUTES3
PURGEOLDEXTRACTS./dirdat/*,usecheckpoints,minkeepdays3
LAGREPORTHOURS1
LAGINFOMINUTES30
LAGCRITICALMINUTES45
2.6创建Extract进程
GGSCI(rac1)2>editparamsextract
extractextract
GETTRUNCATES
GETUPDATEBEFORES
FETCHOPTIONSFETCHPKUPDATECOLS
dynamicresolution
useridCAS_SGCIS,passwordSap12345
TRANLOGOPTIONSASMUSERsys@asm,ASMPASSWORDoracle
exttrail/ogg/dirdat/a5
tablefdpmaster_ah.G_LINE;
GGSCI(rac1)2>addextractExtract,tranlog,threads2,beginnow
GGSCI(rac1)2>addexttrail/ogg/dirdat/a5,extractExtract
2.7创建Pump进程
GGSCI(rac1)2>editparamspump
extractpump
passthru
dynamicresolution
useridCAS_SGCIS,passwordSap12345
rmthost192.168.1.205,mgrport8333
rmttrail/ogg/dirdat/a5
tablefdpmaster_ah.G_LINE;
GGSCI(rac1)2>addextractPump,exttrailsource/ogg/dirdat/a5
GGSCI(rac1)2>addrmttrail/ogg/dirdat/a5,extractPump
2.8开启源端进程
GGSCI(rac1)3>startmgr
GGSCI(rac1)3>startExtract
GGSCI(rac1)3>startPump
2.9查看进程状态
GGSCI(rac1)4>infoall
ProgramStatusGroupLagatChkptTimeSinceChkpt
MANAGERRUNNING
EXTRACTRUNNINGExtract00:
00:
0000:
00:
07
EXTRACTRUNNINGPump00:
00:
0000:
00:
01
3.目标端ogg准备工作
3.1磁盘使用情况
[root@node01~]#df-h
FilesystemSizeUsedAvailUse%Mountedon
/dev/sda3145G19G119G14%/
tmpfs1.5G980M457M69%/dev/shm
/dev/sda1291M39M238M14%/boot
3.2创建用户并授权
mysql>createuser'dbscale'@'%'identifiedby'oracle';
QueryOK,0rowsaffected(0.02sec)
mysql>grantALLPRIVILEGESon*.*to'dbscale'@'%';
QueryOK,0rowsaffected(0.12sec)
[root@node01~]#mkdir/ogg
//创建ogg目录
3.2设置ogg环境变量
[root@node01~]#vi.bash_profile
exportOGG_HOME=/ogg
[root@node01~]#..bash_profile
3.3上传ogg软件到相关目录
[root@node01~]#unzipggs_Linux_x64_MySQL_64bit.zip
[root@node01~]#tar-xvfggs_Linux_x64_MySQL_64bit.tar
//解压ogg软件
[oracle@rac1ogg]$./ggsci
GGSCI(rac1)1>createsubdirs
//初始化ogg目录
Creatingsubdirectoriesundercurrentdirectory/ogg
Parameterfiles/ogg/dirprm:
created
Reportfiles/ogg/dirrpt:
created
Checkpointfiles/ogg/dirchk:
created
Processstatusfiles/ogg/dirpcs:
created
SQLscriptfiles/ogg/dirsql:
created
Databasedefinitionsfiles/ogg/dirdef:
created
Extractdatafiles/ogg/dirdat:
created
Temporaryfiles/ogg/dirtmp:
created
Stdoutfiles/ogg/dirout:
created
3.4登陆
GGSCI(rac1)1>dbloginsourcedbmysql_ogg@192.168.1.210:
23306,useriddbscale,passwordoracle
GGSCI(rac1)1>dbloginsourcedbmysql_ogg,useridroot,passwordoracle
3.5添加检查点系统表
GGSCI(rac1)1>editparams./GLOBALS
checkpointtablemysql_ogg.chktab
GGSCI(rac1)1>addcheckpointtablemysql_ogg.chktab
3.6创建Manager进程
GGSCI>editparamsmgr
PORT8333
DYNAMICPORTLIST8334-8999
--AUTOSTARTER*
AUTORESTARTEXTRACT*,RETRIES5,WAITMINUTES3
PURGEOLDEXTRACTS./dirdat/*,usecheckpoints,minkeepdays3
LAGREPORTHOURS1
LAGINFOMINUTES30
LAGCRITICALMINUTES45
3.7创建Replicat进程
GGSCI(node01)2>editparamsreplicat
replicatreplicat
sourcedefs/ogg/dirdef/fdpmaster_ah.def
GETTRUNCATES
applynoopupdates
dboptionsnolimitrows
INSERTUPDATES
INSERTDELETES
INSERTALLRECORDS
REPERROR(DEFAULT,ABEND)
TARGETDBmysql_ogg@192.168.1.210:
23306,useriddbscale,passwordoracle
Mapfdpmaster_ah.G_LINE,targetyxjcsjpt_fdpmaster_ah.G_LINE,colmap(usedefaults,informatica_row_id=@GETENV('RECORD','ROWID'),informatica_date_time=@GETENV('GGHEADER','COMMITTIMESTAMP'),informatica_flag=@CASE(@GETENV('GGHEADER','OPTYPE'),'DELETE','D','UPDATE',@CASE(@GETENV('GGHEADER','BEFOREAFTERINDICATOR'),'BEFORE','D','AFTER','I',0),'PKUPDATE',@CASE(@GETENV('GGHEADER','BEFOREAFTERINDICATOR'),'BEFORE','D','AFTER','I',0),'INSERT','I','SQLCOMPUPDATE',@CASE(@GETENV('GGHEADER','BEFOREAFTERINDICATOR'),'BEFORE','D','AFTER','I',0),0),informatica_ogg_seq=@COLSTAT(NULL));
GGSCI(node01)2>addreplicatreplicat,exttrail/ogg/dirdat/a5,checkpointtablemysql_ogg.chktab
3.8开启目标端进程
GGSCI(node01)2>startmgr
GGSCI(node01)2>startReplicat
3.9查看目标端进程的状态
GGSCI(node01DBLOGINasdbscale)54>infoall
ProgramStatusGroupLagatChkptTimeSinceChkpt
MANAGERRUNNING
REPLICATRUNNINGReplicat00:
00:
0000:
00:
02