2024数据库迁移升级操作指南_第1页
2024数据库迁移升级操作指南_第2页
2024数据库迁移升级操作指南_第3页
2024数据库迁移升级操作指南_第4页
2024数据库迁移升级操作指南_第5页
已阅读5页,还剩52页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

数据库迁移升级操作手册目录一、操作系统安装及环境配置 31、操作系统安装 32、环境配置 33、配置共享存储 6二、GI集群软件安装 131、检查安装环境 132、安装GI软件 153、创建ASM磁盘组 29三、RAC数据库安装 301、安装RAC数据库软件 302、创建数据库 363、创建用户及用户表空间 44四、.4.17补丁 451,升级Opatch 452,检查Opatch版本 453,检查Inventory有效性 454,配置OCM 455,解压patch文件 456,PatchGI,用root用户执行 457,执行脚本 458,检查GI的补丁情况 469,升级DBPSU 4610,安装patch 4611,执行脚本 4612,验证Opatch是否成功 46五、GoldenGate软件安装及配置 461、安装OGG软件并配置相关用户 462、源数据库配置 483、配置进程参数文件 494、创建进程 51六、初始化数据 511,启动抽取进程,记录源端SCN号 512,EXPDP指定SCN号导出源端数 523,传输dump文件 524,导入数据 525,查询归档空间大小,修改归档空间大小 52七、同步数据 521,源端开启投递进程 522,目标端开启复制进程 52八、业务切换 521,收集统计信息 522,停止业务 523,开启数据库附加日志 534,开启数据库强制日志 535,启动DB2->DB1的ogg进程组 53九,回退 53十、配置DG 53数据库迁移升级详细步骤红色部分为注意点,橙色部分为操作步骤。一、操作系统安装及环境配置(DB2)IP及机器名配置(ESXI:66):IPHostnameSID源端(DB1)60ora11gora11g目标端(DB2)Scan-ip:6561rac1ora11g163(vip)(privip)62rac2ora11g264(vip)(privip)1、操作系统安装(略)2、环境配置(rac1,rac2)配置/etc/hosts文件[root@rac1~]#vi/etc/hostslocalhostlocalhost.localdomainlocalhost4localhost4.localdomain4::1localhostlocalhost.localdomainlocalhost6localhost6.localdomain661rac162rac263rac1-vip64rac2-viprac1-privrac2-priv65rac-scan配置/etc/sysctl.conf文件[root@rac1~]#vi/etc/sysctl.conffs.aio-max-nr=1048576fs.file-max=6815744kernel.shmall=4194304kernel.shmmaxernel.shmmni=4096kernel.sem=25032000100128net.ipv4.ip_local_port_range=900065500net.core.rmem_default=262144net.core.rmem_max=4194304net.core.wmem_default=262144net.core.wmem_max=1048576立即生效:[root@rac1~]#sysctl-p配置/etc/security/limits.conf文件[root@rac1~]#vi/etc/security/limits.confgridsoftnproc2047gridhardnproc16384gridsoftnofile1024gridhardnofile65536oraclesoftnproc2047oraclehardnproc16384oraclesoftnofile1024oraclehardnofile65536配置/etc/pam.d/login文件[root@rac1~]#vi/etc/pam.d/loginsessionrequiredpam_limits.so修改共享内存[root@rac1~]#vi/etc/fstabtmpfs/dev/shmtmpfsdefaults,size=15g00[root@rac1~]#mount–oremount/dev/shm创建用户、组和相应目录创建用户和组:groupaddoinstallgroupadddbagroupaddasmdbauseradd-goinstall-Gdba,asmdbaoracleuseradd-goinstall-Gasmdba,dbagrid设置用户密码:passwdoraclePasswdgrid创建目录并修改权限:mkdir-p/u01/app/oraclemkdir-p/u01/app/gridmkdir-p/u01/app/grid_basemkdir-p/u01/app/oraInventorychown-Rgrid:oinstall/u01/app/gridchown-Rgrid:oinstall/u01/app/grid_basechown-Roracle:oinstall/u01/app/oraclechown-Rgrid:oinstall/u01/app/oraInventorychmod-R775/u01配置oracle,grid用户的环境变量[root@rac1~]#su-grid[grid@rac1~]$vi.bash_profileexportORACLE_SID=+ASM1exportORACLE_BASE=/u01/app/grid_baseexportORACLE_HOME=/u01/app/gridexportLD_LIBRARY_PATH=$ORACLE_HOME/libexportPATH=$ORACLE_HOME/bin:$PATH注:节点2同样配置,修改ORACLE_SID为+ASM2即可[root@rac1~]#su-oracle[oracle@rac1~]$vi.bash_profileexportORACLE_SID=ora11g1exportORACLE_BASE=/u01/app/oracleexportORACLE_HOME=$ORACLE_BASE/product//dbhome_1exportLD_LIBRARY_PATH=$ORACLE_HOME/libexportPATH=$PATH:$ORACLE_HOME/bin注:节点2同样配置,修改ORACLE_SID为ora11g2即可安装缺少的软件包[root@rac1~]#yum-yinstallbinutilscompat-libstdc++compat-libstdc++.i686elfutils-libelfgccgcc-c++glibcglibc.i686glibc-develglibc-devel.i686libaiolibaio.i686libaio-devellibaio-devel.i686libgcclibgcc.i686libstdc++libstdc++.i686libstdc++-develsysstatunixODBCunixODBC.i686unixODBC-develunixODBC-devel.i686compat-libcap1elfutils-libelf-develcompat-libstdc++-33compat-libstdc++-33.i686配置oracle,grid用户的SSH互信[root@rac1~]#su-grid[grid@rac1~]$ssh-keygen-trsa[root@rac2~]#su-grid[grid@rac2~]$ssh-keygen-trsa[grid@rac1~]$cat.ssh/id_rsa.pub>>.ssh/authorized_keys[grid@rac1~]$sshrac2cat/home/grid/.ssh/id_rsa.pub>>.ssh/authorized_keys[grid@rac1~]$scp.ssh/authorized_keysrac2:/home/grid/.ssh配置完成后分别测试:[grid@rac1~]$sshrac1date[grid@rac1~]$sshrac2date[grid@rac1~]$sshrac1-privdate[grid@rac1~]$sshrac2-privdate同理:节点2重复执行。Oracle用户互信配置同上。配置NTP本例采用集群自己的时间同步进程ctss来同步,线上环境需配置NTP。防火墙配置略(本地环境关闭了防火墙,线上需配置策略)3、配置共享存储添加共享磁盘(VM虚拟化为例)关闭虚拟机电源,编辑虚拟机设置:rac1:添加硬盘(此处添加三块:OCR20g,FRA50g,DATA100g,线上环境待具体规划):完成后重复此步骤继续添加剩下的两块磁盘,虚拟设备节点分别为SCSI(1:2),SCSI(1:3),不要使用操作系统本身磁盘的SCSI0控制器。rac2:重复以上步骤,将剩下的两块盘也添加进来。rac1,rac2设置共享磁盘的SCSI1控制器为可共享:配置UDEV重新启动虚拟机,rac1和rac2分别fdisk–l,检查是否都能识别刚才添加的三块磁盘。本例采用UDEV管理,也可以使用oracle的asmlib来管理。获取刚才添加的三块磁盘的id:[root@rac1~]#scsi_id--whitelisted--replace-whitespace--device=/dev/sdb36000c2992d5f6a517b1edbb8dabc0cc2[root@rac1~]#scsi_id--whitelisted--replace-whitespace--device=/dev/sdc36000c2988db1edb3771d786ec510e76a[root@rac1~]#scsi_id--whitelisted--replace-whitespace--device=/dev/sdd36000c298c4021632891ef28c57497389创建并配置udevrules文件:[root@rac1~]#vi/etc/udev/rules.d/99-oracle-asmdevices.rulesKERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c2992d5f6a517b1edbb8dabc0cc2",NAME="asm-diskb",OWNER="grid",GROUP="oinstall",MODE="0660"KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c2988db1edb3771d786ec510e76a",NAME="asm-diskc",OWNER="grid",GROUP="oinstall",MODE="0660"KERNEL=="sd*",BUS=="scsi",PROGRAM=="/sbin/scsi_id--whitelisted--replace-whitespace--device=/dev/$name",RESULT=="36000c298c4021632891ef28c57497389",NAME="asm-diskd",OWNER="grid",GROUP="oinstall",MODE="0660"将配置文件发送至rac2:[root@rac1~]#scp/etc/udev/rules.d/99-oracle-asmdevices.rulesrac2:/etc/udev/rules.drac1,rac2启动udev,并配置开机自动启动:[root@rac1~]#start_udev[root@rac1~]#vi/etc/rc.local添加:/sbin/start_udev重启虚拟机(不重启看不到刚才添加的磁盘)。分区rac1操作:[root@rac1~]#fdisk/dev/sdbCommand(mforhelp):nCommandactioneextendedpprimarypartition(1-4)pPartitionnumber(1-4):1Firstcylinder(1-2610,default1):Usingdefaultvalue1Lastcylinder,+cylindersor+size{K,M,G}(1-2610,default2610):Usingdefaultvalue2610Command(mforhelp):wThepartitiontablehasbeenaltered!Callingioctl()tore-readpartitiontable.Syncingdisks.同上,对sdc,sdd分区。分区完成后rac1,rac2执行fdisk–l检查分区情况。至此,环境准备完毕。二、GI集群软件安装(DB2)用ftp或者其它方式上传grid安装介质并解压(grid用户):[grid@rac1~]$unzipp13390677_112040_Linux-x86-64_3of7.zip1、检查安装环境进入刚解压的目录,执行脚本检查安装环境:[grid@rac1grid]$./runcluvfy.shstage-precrsinst-nrac1,rac2-fixup-verbosePerformingpre-checksforclusterservicessetupCheckingnodereachability...Check:Nodereachabilityfromnode"rac1"DestinationNodeReachable?rac2yesrac1yesResult:Nodereachabilitycheckpassedfromnode"rac1"Checkinguserequivalence...Check:Userequivalenceforuser"grid"NodeNameStatusrac2passedrac1passedResult:Userequivalencecheckpassedforuser"grid"Checkingnodeconnectivity...Checkinghostsconfigfile...NodeNameStatusrac2passedrac1passedVerificationofthehostsconfigfilesuccessfulInterfaceinformationfornode"rac2"NameIPAddressSubnetGatewayDef.GatewayHWAddressMTUeth0625400:0C:29:EF:9A:521500eth15400:0C:29:EF:9A:5C1500Interfaceinformationfornode"rac1"NameIPAddressSubnetGatewayDef.GatewayHWAddressMTUeth0615400:0C:29:B6:35:D91500eth15400:0C:29:B6:35:E31500检查状态为failed的项,并进行相关配置(软件包版本错误可以忽略。本例采用oracle自己的ctss进程进行时间同步,此步骤会报NTP配置不通过,也可以忽略)。2、安装GI软件本例采用xmanager图形化安装:[grid@rac1grid]$exportDISPLAY=40:0.0[grid@rac1grid]$./runInstaller选择需要的语言,这里全选密码设置过于简单,继续有些检查失败的项可以忽略,需具体分析。根据提示,分别在两个节点以root用户执行这两个脚本:Rac1:[root@rac1app]#/u01/app/grid/root.shPerformingrootuseroperationforOracle11gThefollowingenvironmentvariablesaresetas:ORACLE_OWNER=gridORACLE_HOME=/u01/app/gridEnterthefullpathnameofthelocalbindirectory:[/usr/local/bin]:--此处默认敲回车即可Copyingdbhometo/usr/local/bin...Copyingoraenvto/usr/local/bin...Copyingcoraenvto/usr/local/bin...Creating/etc/oratabfile...Entrieswillbeaddedtothe/etc/oratabfileasneededbyDatabaseConfigurationAssistantwhenadatabaseiscreatedFinishedrunninggenericpartofrootscript.Nowproduct-specificrootactionswillbeperformed.Usingconfigurationparameterfile:/u01/app/grid/crs/install/crsconfig_paramsCreatingtracedirectoryUserignoredPrerequisitesduringinstallationInstallingTraceFileAnalyzerOLRinitialization-successfulrootwalletrootwalletcertrootcertexportpeerwalletprofilereaderwalletpawalletpeerwalletkeyspawalletkeyspeercertrequestpacertrequestpeercertpacertpeerrootcertTPprofilereaderrootcertTPparootcertTPpeerpacertTPpapeercertTPprofilereaderpacertTPprofilereaderpeercertTPpeerusercertpausercertAddingClusterwareentriestoupstartCRS-2672:Attemptingtostart'ora.mdnsd'on'rac1'CRS-2676:Startof'ora.mdnsd'on'rac1'succeededCRS-2672:Attemptingtostart'ora.gpnpd'on'rac1'CRS-2676:Startof'ora.gpnpd'on'rac1'succeededCRS-2672:Attemptingtostart'ora.cssdmonitor'on'rac1'CRS-2672:Attemptingtostart'ora.gipcd'on'rac1'CRS-2676:Startof'ora.cssdmonitor'on'rac1'succeededCRS-2676:Startof'ora.gipcd'on'rac1'succeededCRS-2672:Attemptingtostart'ora.cssd'on'rac1'CRS-2672:Attemptingtostart'ora.diskmon'on'rac1'CRS-2676:Startof'ora.diskmon'on'rac1'succeededCRS-2676:Startof'ora.cssd'on'rac1'succeededASMcreatedandstartedsuccessfully.DiskGroupOCRcreatedsuccessfully.clscfg:-installmodespecifiedSuccessfullyaccumulatednecessaryOCRkeys.CreatingOCRkeysforuser'root',privgrp'root'..Operationsuccessful.CRS-4256:UpdatingtheprofileSuccessfuladditionofvotingdisk86eb98a0eec94f76bf910bdfcd0719a4.Successfullyreplacedvotingdiskgroupwith+OCR.CRS-4256:UpdatingtheprofileCRS-4266:Votingfile(s)successfullyreplaced##STATEFileUniversalIdFileNameDiskgroup--1.ONLINE86eb98a0eec94f76bf910bdfcd0719a4(/dev/asm-diskb)[OCR]Located1votingdisk(s).CRS-2672:Attemptingtostart'ora.asm'on'rac1'CRS-2676:Startof'ora.asm'on'rac1'succeededCRS-2672:Attemptingtostart'ora.OCR.dg'on'rac1'CRS-2676:Startof'ora.OCR.dg'on'rac1'succeededPreparingpackagesforinstallation...cvuqdisk-1.0.9-1ConfigureOracleGridInfrastructureforaCluster...succeeded如有错误脚本运行失败需要删除配置重新运行:/u01/app/grid/crs/install/roothas.pl-deconfig-force–verbose/u01/app/grid/crs/install/rootcrs.pl-verbose-deconfig–force/u01/app/grid/root.shRac2节点输出日志略,运行完脚本点击OK继续下一步。###有文章说次错误是因为hosts里面配置了scanip,手动ping一下scanip,如果能ping通则可忽略。3、创建ASM磁盘组Grid用户下运行asmca命令:同样的步骤创建最后一块DATA盘。创建完成,退出。至此,GI安装完成。三、RAC数据库安装(DB2)用FTP或者其它工具上传oracle安装介质并解压:[oracle@rac1~]$unzipp13390677_112040_Linux-x86-64_1of7.zip[oracle@rac1~]$unzipp13390677_112040_Linux-x86-64_2of7.zip1、安装RAC数据库软件[oracle@rac1~]$exportDISPLAY=40:0.0[oracle@rac1~]$cddatabase/[oracle@rac1database]$./runInstaller按提示运行相应脚本,默认回车就行。2、创建数据库使用dbca命令创建数据库:[oracle@rac1database]$dbca会报密码过简的警告,点击yes继续。至此,数据库安装完成。3、创建用户及用户表空间根据具体规划增加空间大小SQL>createtablespaceccpsdatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacecreated.SQL>altertablespaceccpsadddatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacealtered.SQL>createtablespaceccps_partdatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacecreated.SQL>altertablespaceccps_partadddatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacealtered.SQL>createtablespaceccps_inxdatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacecreated.SQL>altertablespaceccps_inxadddatafile'+DATA'size2gautoextendonmaxsize10g;Tablespacealtered.SQL>createuserccpsidentifiedbyop123defaulttablespaceccps;Usercreated.SQL>grantresource,connect,dbatoccps;Grantsucceeded.四、.4.17补丁 环境:Oracle11gRAC

Opatch:p6880880_112000_Linux-x86-64 GI补丁:p26030799_112040_Linux-x86-64 DB补丁:p25869727_112040_Linux-x86-641,升级Opatch(RAC1,RAC2)GRID用户:$mvOPatchOPatch.bak$unzipp6880880_112000_Linux-x86-64.zip-d/u01/app/grid$chown-Rgrid:oinstallOpatchORACLE用户:$mvOPatchOPatch.bak$unzipp6880880_112000_Linux-x86-64.zip-d/u01/app/oracle/product//dbhome_1$chown-Roracle:oinstallOpatch2,检查Opatch版本(RAC1,RAC2)[grid@rac1OPatch]$/u01/app/grid/OPatch/opatchversion3,检查Inventory有效性(RAC1,RAC2)[grid@rac1OPatch]$/u01/app/grid/OPatch/opatchlsinventory-detail-oh$ORACLE_HOME4,配置OCM(RAC1,RAC2)用root用户在/u01/app/grid/OPatch/ocm/bin/下,用emocmrsp生成ocm.rsp文件[root@rac1/]#cd/u01/app/grid/OPatch/ocm/bin[root@rac1bin]#./emocmrspemocmrsp-no_banner-output~/grid_ocm.rsp5,解压patch文件,授权为grid用户(RAC1,RAC2) $unzipp26030799_112040_Linux-x86-64$chown-Rgrid:oinstall/260307996,PatchGI,用root用户执行(RAC1,RAC2)./opatchauto/home/grid/26030799-ocmrf/home/grid/grid_ocm.rsp如节点二执行报错,添加-oh/u01/app/grid后正确执行:./opatchauto/home/grid/26030799/-oh/u01/app/grid-ocmrf/home/grid/grid_ocm.rsp7,执行脚本(RAC1)$sqlplus/assysdbaSQL>@$ORACLE_HOME/rdbms/admin/catbundle.sqlpsuapplySQL>@$ORACLE_HOME/rdbms/admin/utlrp.sql8,检查GI的补丁情况(RAC1,RAC2)$/u01/app/grid/OPatch/opatchlsinventory-detail-oh$ORACLE_HOME|grep-ipatch9,升级DBPSU(RAC1,RAC2) 采用滚动升级或者全部停止后升级(这里采用全部停止后升级的方式) $unzipp25869727_112040_Linux-x86-64$chown-Roracle:oinstall25869727检查补丁是否冲突[oracle@rac124732075]$/u01/app/oracle/product//dbhome_1/OPatch/opatchprereqCheckConflictAgainstOHWithDetail-ph./[oracle@rac224732075]$/u01/app/oracle/product//dbhome_1/OPatch/opatchprereqCheckConflictAgainstOHWithDetail-ph./10,安装patch(RAC1,RAC2)[oracle@rac125869727]$/u01/app/oracle/product//dbhome_1/Opatch/opatchapply[oracle@rac225869727]$/u01/app/oracle/product//dbhome_1/Opatch/opatchapply11,执行脚本(RAC1) 启动rac并执行如下脚本:SQL>@$ORACLE_HOME/rdbms/admin/catbundle.sqlpsuapplySQL>@$ORACLE_HOME/rdbms/admin/utlrp.sql12,验证Opatch是否成功(RAC1,RAC2)[oracle@rac1~]$/u01/app/oracle/product//dbhome_1/Opatch/opatchlsinventory-detail -oh$ORACLE_HOME|grep-ipatch[oracle@rac2~]$/u01/app/oracle/product//dbhome_1/Opatch/opatchlsinventory-detail -oh$ORACLE_HOME|grep-ipatch五、GoldenGate软件安装及配置1、安装OGG软件并配置相关用户(DB1,RAC1)上传OGG软件安装介质并解压:[oracle@rac1~]$unzip121210_fbo_ggs_Linux_x64_shiphome.zip用root创建OGG安装目录:mkdir-p/u01/app/oggchown-Roracle:oinstall/u01/app/oggchmod775/u01/app/ogg配置OGG环境变量(本例采用oracle用户安装,直接配置oracle环境变量):[oracle@rac1~]$vi.bash_profileexportLD_LIBRARY_PATH=$ORACLE_HOME/lib:$GG_HOME/libexportGG_HOME=/u01/app/oggexportPATH=$PATH:$ORACLE_HOME/bin:$GG_HOME/bin安装OGG软件:[oracle@rac1~]$cdfbo_ggs_Linux_x64_shiphome/Disk1/[oracle@rac1Disk1]$exportDISPLAY=40:0.0[oracle@rac1Disk1]$./runInstaller注意端口,如果被占用可以更换别的端口。创建ogg用户及表空间:SQL>createtablespaceoggdatafile'+DATA'SIZE500M;Tablespacecreated.SQL>createuseroggidentifiedbyoggdefaulttablespaceogg;Usercreated.SQL>grantresource,connect,dbatoogg;Grantsucceeded.在源端也需要重复以上操作。SQL>createtablespaceoggdatafile'/u01/app/oracle/oradata/ora11g/ogg.dbf'SIZE500M;SQL>createuseroggidentifiedbyoggdefaulttablespaceogg;SQL>grantresource,connect,dbatoogg;2、源数据库配置(DB1)开启数据库归档模式:略开启数据库附加日志:SQL>alterdatabaseaddsupplementallogdata;SQL>alterdatabaseaddsupplementallogdata(primarykey,unique,foreignkey)columns;[oracle@ora11g~]$cd/u01/app/ogg[oracle@ora11g~]$./ggsciGGSCI(ora11g)1>dbloginuseridogg,passwordoggGGSCI(ora11g)2>addtrandataccps.*SQL>altersystemswitchlogfile;SQL>selectsupplemental_log_data_min,supplemental_log_data_pk,supplemental_log_data_ui fromv$database;(检查日志开启情况,全为YES即可)开启数据库强制日志:SQL>alterdatabaseforcelogging;RAC环境需要修改此参数:(DB2)SQL>ALTERSYSTEMSETENABLE_GOLDENGATE_REPLICATION=TRUESCOPE=BOTHsid='*';配置sequence同步(DB1,DB2):[oracle@ora11g~]$cd/u01/app/ogg[oracle@ora11gogg]$sqlplus/assysdbaSQL>@sequence.sql;oggSQL>grantexecuteonogg.updatesequencetoogg;

Grantsucceeded.

SQL>grantexecuteonogg.replicatesequencetoogg;

Grantsucceeded.SQL>ALTERTABLEsys.seq$addSUPPLEMENTALLOGDATA(PRIMARYKEY)COLUMNS;

Tablealtered.3、配置进程参数文件管理进程MGR(DB1,DB2)[root@rac1~]#su–oracle[oracle@rac1~]$cd/u01/app/ogg/[oracle@rac1ogg]$./ggsciGGSCI(rac1)1>editparammgrPORT7809抽取进程EXTN(DB1->DB2)(RAC1)GGSCI(ora11g)1>editparamextn1extractextn1useridogg,passwordoggTRANLOGOPTIONSEXCLUDEUSERoggdiscardfile./dirrpt/discard_extn1.dsc,append,megabytes1024exttrail./dirdat/naTABLECCPS.*;SEQUENCECCPS.*;投递进程DPEN(DB1->DB2)(RAC1)GGSCI(ora11g)2>editparamdpen1extractdpen1RMTHOST61,MGRPORT7809,compressPASSTHRURMTTRAIL./dirdat/naTABLECCPS.*;SEQUENCECCPS.*;复制进程REPN(DB1->DB2)(RAC1)GGSCI(rac1)2>editparamrepn1replicatrepn1useridogg,passwordoggassumetargetdefsDISCARDFILE./dirrpt/repna.dsc,APPEND,MEGABYTES1024MAPCCPS.*,TARGETCCPS.*;抽取进程(DB2->DB1)(RAC1)GGSCI(rac1)2>editparamextn2extractextn2useridogg,passwordoggTRANLOGOPTIONSEXCLUDEUSERoggTRANLOGOPTIONSDBLOGREADERdiscardfile./dirrpt/discard_extn2.dsc,append,megabytes1024exttrail./dirdat/nbTABLECCPS.*;SEQUENCECCPS.*;投递进程(DB2->DB1)(RAC1)GGSCI(rac1)2>editparamdpen2extractdpen2RMTHOST60,MGRPORT7809,compressPASSTHRURMTTRAIL./dirdat/nbTABLECCPS.*;SEQUENCECCPS.*;复制进程(DB2->DB1)(DB1)GGSCI(ora11g)2>editparamrepn2replicatrepn2useridogg,passwordoggassumetargetdefsDISCARDFILE./dirrpt/repnb.dsc,APPEND,MEGABYTES1024MAPCCPS.*,TARGETCCPS.*;4、创建进程抽取进程(DB1)GGSCI(ora11g)2>addextractextn1,tranlog,beginnowEXTRACTadded.GGSCI(ora11g)3>addexttrail./dirdat/na,extractextn1,megabytes500EXTTRAILadded.投递进程(DB1)GGSCI(ora11g)4>addextractdpen1,exttrailsource./dirdat/naEXTRACTadded.GGSCI(ora11g)5>addrmttrail./dirdat/na,extractdpen1,megabytes500RMTTRAILadded.复制进程(RAC1)GGSCI(rac1)3>addreplicatrepn1,exttrail./dirdat/na,nodbcheckpointREPLICATadded.抽取进程(RAC1)GGSCI(ora11g)2>addextractextn2,threads2,tranlog,beginnowEXTRACTadded.GGSCI(ora11g)3>addexttrail./dirdat/nb,extractextn2,megabytes500EXTTRAILadded.投递进程(RAC1)GGSCI(ora11g)4>addextractdpen2,exttrailsource./dirdat/nbEXTRACTadded.GGSCI(ora11g)5>addrmttrail./dirdat/nb,extractdpen2,megabytes500RMTTRAILadded.复制进程(DB1)GGSCI(rac1)3>addreplicatrepn2,exttrail./dirdat/nb,nodbcheckpointREPLICATadded.OGG基本管理命令:$cd/u01/app/ogg./ggsciGGSCI(rac1)1>infoallProgramStatusGroupLagatChkptTimeSinceChkptMANAGERRUNNINGREPLICATSTOPPEDREPN100:00:0000:14:25六、初始化数据1,启动抽取进程,记录源端SCN号(DB1) GGSCI(ora11g)6>startextn1SendingSTARTrequesttoMANAGER...EXTRACTEXTNstarting SQL>selectto_char(dbms_flashback.get_system_change_number)fromdual;TO_CHAR(DBMS_FLASHBACK.GET_SYSTEM_CHANGE16789032,EXPDP指定SCN号导出源端数据(DB1)[oracle@ora11gdpdump]$expdpogg/oggschemas=ccpsdirectory=DATA_PUMP_DIR dumpfile=full.dmpflashback_scn=1678903logfile=expdp.log3,传输dump文件(DB1) [oracle@ora11gdpdump]$scp–Cfull.dmp61:/u01/app/oracle/product//dbhome_1/rdbms/log4,导入数据(RAC1) [oracle@rac1dpdump]$impdpogg/oggschemas=ccpsdirectory=DATA_PUMP_DIRdumpfile=full.dmpexclude=statisticslogfile=impdp.log5,查询归档空间大小,修改归档空间大小(DB2) SQL>showparameterdb_recoverySQL>altersystemsetdb_recovery_file_dest_size=49gscope=bothsid='*';七、同步数据1,源端开启投递进程(DB1) GGSCI(ora11g)6>startdpen12,目标端开启复制进程(DB2) GGSCI(rac1)2>startreplicatrepn1aftercsn1678903八、业务切换1,收集统计信息(DB2) SQL>execdbms_stats.gather_database_stats(estimate_percent=>100,method_opt=>'forallcolumnssizeauto',degree=>4,cascade=>true);2,开启数据库附加日志(DB2):防止业务切换失败,在业务切换的同时启动DB2->DB1的数据传输。 SQL>alterdatabaseaddsupplementallogdata;SQL>alterdatabaseaddsupplementallogdata(primarykey,unique,foreignkey)columns;[oracle@ora11g~]$cd/u01/app/ogg[oracle@ora11g~]$./ggsci GGSCI(ora11g)1>dbloginuseridogg,passwordogg GGSCI(ora11g)2>addtrandataccps.* SQL>altersystemswitchlogfile; SQL>selectupplemental_log_data_min,supplemental_log_data_pk,supplemental_log_data_uifromv$database;(检查日志开启情况,全为YES即可)3,开启数据库强制日志:(DB2)SQL>alterdatabaseforcelogging;4,停止业务 确认数据同步完成后启动新环境业务并停止DB1->DB2的ogg进程组。 GGSCI(ora11g)1>lagextn1GGSCI(ora11g)2>lagdpen1GGSCI(rac1)1>lagrepn1停止进程:GGSCI(ora11g)1>stopextn1GGSCI(ora11g)2>stopdpen1GGSCI(rac1)1>stoprepn15,启动DB2->DB1的ogg进程组,检查数据同步情况。修改原备库上的extn进程的启动时间到现在,已保证它不去抽取那些之前的重做日志GGSCI(rac1)1>alterextn2,beginnowGGSCI(rac1)1>startextn2GGSCI(rac1)2>startdpen2GGSCI(ora11g)1>startrepn26,切换业务九,回退十、配置DG1,备库安装数据库软件2,开启主库归档模式,强制日志模式 略3,创建及复制密码文件rac1(/u01/app/oracle/product//dbhome_1/dbs):cporapwora11g1orapwora11g2scporapwora11g160:/u01/app/oracle/product//db_home1/dbsmvorapwora11g1orapwora11grac2(/u01/app/oracle/product//dbhome_1/dbs):cporapwora11g2orapwora11g14,创建备库参数文件及相关目录参数文件:vi/u01/app/oracle/product//db_home1/dbs/initora11g.oraora11g.__oracle_base='/u01/app/oracle'#ORACLE_BASEsetfromenvironment*.audit_file_dest='/u01/app/oracle/admin/ora11g/adump'*.audit_trail='db'*.compatible='.0'*.control_files='/u01/app/oracle/oradata/ora11g/control01.ctl','/u01/app/oracle/flash_recovery_area/ora11g'*.db_block_size=8192*.db_domain=''*.db_file_name_convert='+DATA/ora11g/datafile','/u01/app/oracle/oradata/ora11g','+DATA/ora11g/tempfile','/u01/app/oracle/oradata/ora11g'*.db_name='ora11g'*.db_recovery_file_dest_size=52613349376*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area'*.db_unique_name='standby1'*.diagnostic_dest='/u01/app/oracle'*.dispatchers='(PROTOCOL=TCP)(SERVICE=ora11gXDB)'*.fal_server='primary'*.log_archive_config='dg_config=(standby1,primary)'*.log_archive_dest_1='location=/u01/app/oracle/flash_recovery_area/ora11gvalid_for=(all_logfiles,all_roles)db_unique_name=standby1'*.log_archive_dest_2='service=primarylgwrasyncvalid_for=(online_logfiles,all_roles)db_unique_name=primary'*.log_archive_format='%t_%s_%r.dbf'*.log_file_name_convert='+DATA/ora11g/onlinelog','/u01/app/oracle/oradata/ora11g'*.memory_target=10118758400*.open_cursors=300*.processes=1000*.remote_login_passwordfile='exclusive'*.service_names='ORA11G'*.sessions=1105*.standby_file_management='AUTO'*.undo_retention=3600*.undo_tablespace='UNDOTBS1'目录创建:mkdir–p/u01/app/oracle/admin/ora11g/adumpmkdir–p/u01/app/oracle/admin/ora11g/dpdumpmkdir–p/u01/app/oracle/admin/ora11g/pfilemkdir–p/u01/app/oradata/ora11gmkdir–p/u01/app/oracle/flash_recovery_area/ora11g5,备库配置tnsnames.ora文件[oracle@weblogicadmin]$vitnsnames.orastandby1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=60)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora11g)))primary=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=65)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora11g)))rac1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=61)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora11g)(INSTANCE_NAME=ora11g1)))rac2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=62)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ora11g

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论