广州远佳信息科技有限公司Oracle数据库教程——DBA强化实战系列第三期:oracle11.2.0.4搭建adg全过程从oracle11g开始,支持windows与linux异构dg,同时也开时支持备节点只读打开。所以在企业中,可以实现读写分离,客户知道这个新特性后,要求我们帮他们部署一套这样的activedataguard,来分担他们生产库的压力。下面,我就把我的实施过程发布出来与大家共享!1、安装操作系统及数据库软件具体的安装、建库等操作,请参阅《DBA强化实战系列第一期:centos6.4安装oracle11.2.0.4单实例asm》。注意,建库,只需要在一台机器上建就可以了!2、开始配置adg的准备工作2.1主节点操作,配置归档[oracle@mytest1bin]$sqlplus/assysdbaSQL*Plus:Release11.2.0.4.0ProductiononThuJan216:08:292014Copyright(c)1982,2013,Oracle.Allrightsreserved.Connectedto:OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProductionWiththePartitioning,AutomaticStorageManagement,OLAP,DataMiningandRealApplicationTestingoptions配置强制归档,这是建dg必须的,因为在我们实际过程中,不允许有nologging的方式存在,这样会造成数据不一致SQLalterdatabaseforcelogging;Databasealtered.配置归档设置归档路径及格式SQLaltersystemsetlog_archive_format='%S_%t_%r.log'scope=spfile;Systemaltered.SQLaltersystemsetlog_archive_dest_state_1='ENABLE';Systemaltered.广州远佳信息科技有限公司SQLaltersystemsetlog_archive_dest_1='location=+datadg';Systemaltered.SQLshutdownimmediateDatabaseclosed.Databasedismounted.ORACLEinstanceshutdown.SQLstartupmountORACLEinstancestarted.TotalSystemGlobalArea2989854720bytesFixedSize2256912bytesVariableSize822087664bytesDatabaseBuffers2147483648bytesRedoBuffers18026496bytesDatabasemounted.SQL!lsnrctlstopLSNRCTLforLinux:Version11.2.0.4.0-Productionon02-JAN-201416:11:59Copyright(c)1991,2013,Oracle.Allrightsreserved.Connectingto(ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))ThecommandcompletedsuccessfullySQLalterdatabasearchivelog;Databasealtered.SQLalterdatabaseopen;Databasealtered.--注意,到这一步,主节点的归档就基本上配置完成了。数据库重启后,注册一下监听SQLaltersystemregister;Systemaltered.2.2主节点操作,在线备份数据库,参数文件等,并传输到备节点本次备份的时候,把数据库及控制文件也进行了备份,注意control的选择为standby的方式了![oracle@mytest1bin]$rmantarget/RecoveryManager:Release11.2.0.4.0-ProductiononThuJan216:26:362014Copyright(c)1982,2011,Oracleand/oritsaffiliates.Allrightsreserved.connectedtotargetdatabase:oradgdb(DBID=3596765127)广州远佳信息科技有限公司RMANbackupascompressedbackupsetfulldatabaseincludecurrentcontrolfileforstandbyformat'/u02/dbfull_%T_%s_%p.bak'plusarchivelogformat'/u02/archfull_%T_%s_%p.bak';Startingbackupat2012-03-0516:26:43currentlogarchivedusingtargetdatabasecontrolfileinsteadofrecoverycatalogallocatedchannel:ORA_DISK_1channelORA_DISK_1:SID=45devicetype=DISKchannelORA_DISK_1:startingcompressedarchivedlogbackupsetchannelORA_DISK_1:specifyingarchivedlog(s)inbackupsetinputarchivedlogthread=1sequence=5RECID=1STAMP=835806404channelORA_DISK_1:startingpiece1at2012-03-0516:26:45channelORA_DISK_1:finishedpiece1at2012-03-0516:26:46piecehandle=/u02/archfull_20140102_1_1.baktag=TAG20140102T162645comment=NONEchannelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:01Finishedbackupat2012-03-0516:26:46Startingbackupat2012-03-0516:26:46usingchannelORA_DISK_1channelORA_DISK_1:startingcompressedfulldatafilebackupsetchannelORA_DISK_1:specifyingdatafile(s)inbackupsetinputdatafilefilenumber=00001name=+DATADG/oradgdb/datafile/system.256.835804411inputdatafilefilenumber=00002name=+DATADG/oradgdb/datafile/sysaux.257.835804411inputdatafilefilenumber=00003name=+DATADG/oradgdb/datafile/undotbs1.258.835804411inputdatafilefilenumber=00004name=+DATADG/oradgdb/datafile/users.259.835804411channelORA_DISK_1:startingpiece1at2012-03-0516:26:46channelORA_DISK_1:finishedpiece1at2012-03-0516:27:21piecehandle=/u02/dbfull_20140102_2_1.baktag=TAG20140102T162646comment=NONEchannelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:35channelORA_DISK_1:startingcompressedfulldatafilebackupsetchannelORA_DISK_1:specifyingdatafile(s)inbackupsetincludingstandbycontrolfileinbackupsetincludingcurrentSPFILEinbackupsetchannelORA_DISK_1:startingpiece1at2012-03-0516:27:23channelORA_DISK_1:finishedpiece1at2012-03-0516:27:24piecehandle=/u02/dbfull_20140102_3_1.baktag=TAG20140102T162646comment=NONE广州远佳信息科技有限公司channelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:01Finishedbackupat2012-03-0516:27:24Startingbackupat2012-03-0516:27:24currentlogarchivedusingchannelORA_DISK_1channelORA_DISK_1:startingcompressedarchivedlogbackupsetchannelORA_DISK_1:specifyingarchivedlog(s)inbackupsetinputarchivedlogthread=1sequence=6RECID=2STAMP=835806444channelORA_DISK_1:startingpiece1at2012-03-0516:27:24channelORA_DISK_1:finishedpiece1at2012-03-0516:27:25piecehandle=/u02/archfull_20140102_4_1.baktag=TAG20140102T162724comment=NONEchannelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:01Finishedbackupat2012-03-0516:27:25RMANquitRecoveryManagercomplete.[oracle@mytest1bin]$sqlplus/assysdbaSQL*Plus:Release11.2.0.4.0ProductiononThuJan216:35:022014Copyright(c)1982,2013,Oracle.Allrightsreserved.Connectedto:OracleDatabase11gEnterpriseEditionRelease11.2.0.4.0-64bitProductionWiththePartitioning,AutomaticStorageManagement,OLAP,DataMiningandRealApplicationTestingoptions--创建standby的参数文件SQLcreatepfile='/u02/standby.ora'fromspfile;Filecreated.[oracle@mytest1u02]$scpstandby.ora10.10.1.52:/u02oracle@10.10.1.52'spassword:standby.ora100%7720.8KB/s00:00[oracle@mytest1u02]$cd$ORACLE_HOME[oracle@mytest1db1]$cddbs广州远佳信息科技有限公司[oracle@mytest1dbs]$ls-a.hc_oradgd