Create Logic DataGuard.docx
《Create Logic DataGuard.docx》由会员分享,可在线阅读,更多相关《Create Logic DataGuard.docx(15页珍藏版)》请在冰豆网上搜索。
CreateLogicDataGuard
创建LogicDataGuard的基本步骤
参与人:
张大鹏
提交日期:
2009-10-26
目录
1CreatePhysics:
For10gRACPrimarytoRACPhysicalStandby3
1.1TASK1:
GATHERFILESANDPERFORMBACKUP3
1.2TASK2:
CONFIGUREORACLENETSERVICESONTHESTANDBY3
1.3TASK3:
CREATETHESTANDBYINSTANCESANDDATABASE4
1.4TASK4:
CONFIGURETHEPRIMARYDATABASEFORDATAGUARD9
1.5TASK5:
VERIFYDATAGUARDCONFIGURATION10
2CreateLogicalStandbyDatabaseFromExistingPhysicalStandbyDatabase11
1CreatePhysics:
For10gRACPrimarytoRACPhysicalStandby
1.1TASK1:
GATHERFILESANDPERFORMBACKUP
1.Ontheprimarynode,createastagingdirectory.Forexample:
[oracle@chicago_host1oracle]$mkdir-p/opt/oracle/stage
2.Createthesameexactpathononeofthestandbyhosts:
[oracle@boston_host1oracle]$mkdir-p/opt/oracle/stage
3.Ontheprimarynode,connecttotheprimarydatabaseandcreateaPFILEfromtheSPFILEinthestagingdirectory.Forexample:
SQL>CREATEPFILE='/opt/oracle/stage/initCHICAGO.ora'FROMSPFILE;
4.Ontheprimarynode,performanRMANbackupoftheprimarydatabasethatplacesthebackuppiecesintothestagingdirectory.Forexample:
[oracle@chicago_host1stage]$rmantarget/
RMAN>BACKUPDEVICETYPEDISKFORMAT'/opt/oracle/stage/%U'DATABASEPLUSARCHIVELOG;
RMAN>BACKUPDEVICETYPEDISKFORMAT'/opt/oracle/stage/%U'CURRENTCONTROLFILEFORSTANDBY;
5.Placeacopyofthelistener.ora,tnsnames.ora,andsqlnet.orafilesintothestagingdirectory.Forexample:
[oracle@chicago_host1oracle]$cp$ORACLE_HOME/network/admin/*.ora/opt/oracle/stage
6.CopythecontentsofthestagingdirectoryontheRACprimarynodetothestandbynodeonwhichthestagingdirectorywascreatedoninstep2.Forexample:
[oracle@chicago_host1oracle]$scp/opt/oracle/stage/*\
oracle@boston_host1:
/opt/oracle/stage
1.2TASK2:
CONFIGUREORACLENETSERVICESONTHESTANDBY
1.Copythelistener.ora,tnsnames.ora,andsqlnet.orafilesfromthestagingdirectoryonthestandbyhosttothe$ORACLE_HOME/network/admindirectoryonallstandbyhosts.
2.Modifythelistener.orafileeachstandbyhosttocontaintheVIPaddressofthathost.
3.Modifythetnsnames.orafileoneachnode,includingtheprimaryRACnodesandstandbyRACnodes,tocontainallprimaryandstandbynetservicenames.YoushouldalsomodifytheOracleNetaliasesthatareusedforthelocal_listenerandremote_listenerparameterstopointtothelisteneroneachstandbyhost.Inthisexample,eachtnsnames.orafileshouldcontainallofthenetservicenamesinthefollowingtable:
ExampleEntriesinthetnsnames.oraFiles
PrimaryNetServiceNames
StandbyNetServiceName
CHICAGO=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=chicago_host1vip)
(HOST=chicago_host2vip)
(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=CHICAGO)
)
)
BOSTON=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=boston_host1vip)
(HOST=boston_host2vip)
(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=BOSTON)
)
)
4.Startthestandbylistenersonallstandbyhosts.
1.3TASK3:
CREATETHESTANDBYINSTANCESANDDATABASE
1.Toenablesecuretransmissionofredodata,makesuretheprimaryandstandbydatabasesuseapasswordfile,andmakesurethepasswordfortheSYSuserisidenticaloneverysystem.Forexample:
$cd$ORACLE_HOME/dbs
$orapwdfile=orapwBOSTONpassword=oracle
Thenamingandlocationofthepasswordfilevariesondifferentplatforms.See“CreatingandMaintainingaPasswordFile”intheOracleDatabaseAdministrator’sGuideformoreinformation.
2.CopyandrenametheprimarydatabasePFILEfromthestagingareaonallstandbyhoststothe$ORACLE_HOME/dbsdirectoryonallstandbyhosts.Forexample:
[oracle@boston_host1stage]$cpinitCHICAGO1.ora$ORACLE_HOME/dbs/initBOSTON1.ora
3.ModifythestandbyinitializationparameterfilecopiedfromtheprimarynodetoincludeDataGuardparametersasillustratedinthefollowingtable:
IntheaboveexampletheprimaryandstandbydatafilesareinasingleASMdiskgroup.IftheprimaryandstandbydatafilesaredistributedacrossmultipleASMdiskgroupsthentheunsettheDB_CREATE_FILE_DESTparameterpriortostartingthestandbyinstance.ForfurtherinformationrefertoMetaLinknote340848.1.
Formoreinformationabouttheseinitializationparameters,seeChapter13,“InitializationParameters”inOracleDataGuardConceptsandAdministrationmanual.
IfyouareusinganSPFILEinsteadofaninitializationparameterfile,thenseethe“ManagingInitializationParametersUsingaServerParameterFile”sectionintheOracleDatabaseAdministrator’sGuideforinstructionsonmanaginganSPFILE.
4.ConnecttotheASMinstanceononestandbyhost,andcreateadirectorywithintheDATAdiskgroupthathasthesamenameastheDB_UNIQUE_NAMEofthestandbydatabase.Forexample:
SQL>ALTERDISKGROUPdataADDDIRECTORY'+DATA/BOSTON';
5.Connecttothestandbydatabaseononestandbyhost,withthestandbyintheIDLEstate,andcreateanSPFILEinthestandbyDATAdiskgroup:
SQL>CREATESPFILE='+DATA/BOSTON/spfileBOSTON.ora'FROMPFILE='?
/dbs/initBOSTON.ora';
6.Inthe$ORACLE_HOME/dbsdirectoryoneachstandbyhost,createaPFILEthatisnamedinitoracle_sid.orathatcontainsapointertotheSPFILE.Forexample:
[oracle@boston_host1oracle]$cd$ORACLE_HOME/dbs
[oracle@boston_host1dbs]$echo"SPFILE='+DATA/BOSTON/spfileBOSTON.ora'">initBOSTON1.ora
7.Createthedumpdirectoriesonallstandbyhostsasreferencedinthestandbyinitializationparameterfile.Forexample:
[oracle@boston_host1oracle]$mkdir-p$ORACLE_BASE/admin/BOSTON/bdump
[oracle@boston_host1oracle]$mkdir-p$ORACLE_BASE/admin/BOSTON/cdump
[oracle@boston_host1oracle]$mkdir-p$ORACLE_BASE/admin/BOSTON/udump
[oracle@boston_host1oracle]$mkdir-p$ORACLE_BASE/admin/BOSTON/adump
8.Aftersettinguptheappropriateenvironmentvariablesoneachstandbyhost,suchasORACLE_SID,ORACLE_HOME,andPATH,startthestandbydatabaseinstanceonthestandbyhostthathasthestagingdirectory,withoutmountingthecontrolfile.
SQL>STARTUPNOMOUNT
9.Fromthestandbyhostwherethestandbyinstancewasjuststarted,duplicatetheprimarydatabaseasastandbyintotheASMdiskgroup.Forexample:
$rmantargetsys/oracle@CHICAGOauxiliary/
RMAN>DUPLICATETARGETDATABASEFORSTANDBY;
10.Connecttothestandbydatabase,andcreatethestandbyredologstosupportthestandbyrole.Thestandbyredologsmustbethesamesizeas
theprimarydatabaseonlinelogs.Therecommendednumberofstandbyredologsis:
(maximum#oflogfiles+1)*maximum#ofthreads
Thisexampleusestwoonlinelogfilesforeachthread.Thus,thenumberofstandbyredologsshouldbe(2+1)*2=6.Thatis,onemorestandbyredologfileforeachthread.
SQL>ALTERDATABASEADDSTANDBYLOGFILETHREAD1
GROUP5SIZE10M,
GROUP6SIZE10M,
GROUP7SIZE10M;
SQL>ALTERDATABASEADDSTANDBYLOGFILETHREAD2
GROUP8SIZE10M,
GROUP9SIZE10M,
GROUP10SIZE10M;
Thesestatementscreatetwostandbylogmembersforeachgroup,andeachmemberis10MBinsize.OnememberiscreatedinthedirectoryspecifiedbytheDB_CREATE_FILE_DESTinitializationparameter,andtheothermemberiscreatedinthedirectoryspecifiedbyDB_RECOVERY_FILE_DESTinitializationparameter.Becausethisexampleassumesthattherearetworedologgroupsintwothreads,thenextgroupisgroupfive.
YoucancheckthenumberandgroupnumbersoftheredologsbyqueryingtheV$LOGview:
SQL>SELECT*FROMV$LOG;
YoucanchecktheresultsofthepreviousstatementsbyqueryingtheV$STANDBY_LOGview:
SQL>SELECT*FROMV$STANDBY_LOG;
YoucanalsoseethememberscreatedbyqueryingtheV$LOGFILEview:
SQL>SELECT*FROMV$LOGFILE;
Seethe“ConfigureaStandbyRedoLog”sectioninOracleDataGuardConceptsandAdministrationmanualformoreinformation.
11.Ononlyonestandbyhost(andthisisyourdesignatedRedoApplyinstance),startmanagedrecoveryandreal-timeapplyonthestandbydatabase:
SQL>ALTERDATABASERECOVERMANAGEDSTANDBYDATABASEUSINGCURRENTLOGFILEDISCONNECT;
12.Oneithernodeofthestandbycluster,registerthestandbydatabaseandthedatabaseinstanceswiththeOracleClusterRegistry(OCR)usingtheServerControl(SRVCTL)utility.Forexample:
$srvctladddatabase-dBOSTON–o/opt/oracle/product/10g_db_rac
$srvctladdinstance-dBOSTON-iBOSTON1-nboston_host1
$srvctladdinstance-dBOSTON-iBOSTON2-nboston_host2
Thefollowingaredescriptionsoftheoptionsinthesecommands:
The-doptionspecifiesthedatabaseuniquename(DB_UNIQUE_NAME)ofthedatabase.
The-ioptionspecifiesthedatabaseinsancename.
The-noptionspecifiesthenodeonwhichtheinstanceisrunning.
The-ooptionspecifiestheOraclehomeofthedatabase.
RegistertheASMinstancewiththeOCR:
$srvctladdasm-nboston_host1-i+ASM1–o/opt/oracle/product/10g_db_rac–p/opt/oracle/product/10g_db_rac/dbs/spfile+ASM1.ora
$srvctladdasm-nboston_host2-i+ASM2-o/opt/oracle/product/10g_db_rac–p/opt/oracle/product/10g_db_rac/dbs/spfile+ASM2.ora
Thefollowingaredescriptionsoftheoptionsinthesecommands:
The-ioptionspecifiestheASMinstancename.IfyourASMinstanceisnamed+ASM1,thenspecifyitwiththe‘+’included.Incrs_statoutput,theresourcenamewillnothavethe‘+’intheresourcename.However,the‘+’mustbespecifiedwhenanASMinstancenameisspecifiedinSRVCTLcommands.
The–noptionspecifiesthenodenameonwhichtheASMinstanceisrunning.
The-ooptionspecifiestheOraclehomefortheASMinstance.
The-poptionspecifiesthe