Vous êtes sur la page 1sur 9

CreatingaStandbyusingRMANDuplicate(RACorNonRAC)(DocID1617946.

1)

InthisDocument

Goal
Solution
References

APPLIESTO:

OracleDatabaseEnterpriseEditionVersion11.2.0.0to12.1.0.2[Release11.2to12.1]
Informationinthisdocumentappliestoanyplatform.

GOAL

MaximumAvailabilityArchitecture

MaximumAvailabilityArchitecture(MAA)definesOraclesmostcomprehensivearchitectureforreducingdowntimefor
scheduledoutages,andpreventing,detectingandrecoveringfromunscheduledoutages.RealApplicationClusters
(RAC)andDataGuardprovidethebasisofthedatabaseMAAsolution,wheretheprimarysitecontainstheRAC
database,andthesecondarysitecontainstheRACphysicalstandbydatabase.

Moredetailedinformation,suchasadiscussionofthepurposeofMAAandthebenefitsitprovides,canbefoundonthe
OracleTechnologyNetwork(OTN)athttp://www.oracle.com/technetwork/database/features/availability/maa
096107.html

PurposeofthisDocument

ThepurposeofthisdocumentistoprovideastepbystepguidefortheinstallationandconfigurationofanOracle
Database11.2or12.1MAAenvironments.Thispaperassumesthatthefollowingconditionsexist:

1. PrimaryRACorsingleinstancedatabaseutilizingASMfordatafilestorage
2. Primarydatabaseisinarchivelogmode
3. StandbyhostshaveexistingOraclesoftwareinstallation
4. StandbydatabasestoragewillutilizeASM

ItisrecommendedthatyouconsulttheDataGuardConceptsandAdministrationguideaswellastheHABest
Practiceguideforcompleteinformationandunderstanding.

SupportedVersions

ThisdocumentappliestobothtoOracleServerversions11.2.0.xand12.1.0.x.Someimportantdifferencesinhow
DUPLICATEFROMACTIVEDATABASEfunctionsbetweenthetworeleasesarenotedbelow:

11.2:

DUPLICATEFROMACTIVEDATABASEusesdatafileimagecopieswhichdoesnotsupportsectionsize,
compression,orencryption

12.1:

SECTIONSIZEclauseworksthesameinDUPLICATEFROMACTIVEDATABASE,asitdoesinnormalBACKUP
Ifsectionsizeisused,inordertogainanybenefit,multipleauxiliarychannelsmustbeconfigured.
YoucansetcompressionalgorithmandthenuseUSINGCOMPRESSEDBACKUPSETtohavethesourceDB
compressthebackupsetsbeforetheyarepulledover
YoucansetencryptionalgorithmandthenthefollowingDUPLICATEFROMACTIVEDATABASEwill
encryptthebackupsetsonthesourcebeforetheyarepulledover
ForRAC>RACduplicate,youcanallocatemultipleauxchannelstoperformthepull,butthesewillonly
connecttooneinstance.

MultipleChannelsConsideration:

WhenperforminganRMANduplicatefromactivemultiplechannelscanbeevenlyspreadacrossmultiplesending
nodes.Bydoingthiswecanutilizemorenetworkinterfacesforthesendingoperations,however,onlyoneauxiliary
instanceisusedbydefault.Bestpracticeforconfiguration:

Usethefollowingconfigurationcommandstoparallelizebackupsacrossalldatabasenodes

allowingallthedisksandnetworkconnectionstobeleveragedforincreasedperformance.

UsetwotoeightRMANchannelsperinstance.

RMANconfigurationchanges

CONFIGUREDEFAULTDEVICETYPETODISK

CONFIGUREDEVICETYPEDISKPARALLELISM16

UseSQL*NetserviceloadbalancingtodistributeRMANchannelsevenlyamongthe

allocatedinstances.

1)Createaservicethatrunsontheselectednodesinthecluster:

srvctladdserviced<dbname>s<servicename>r

<instance1>,<instancen>

2)WhenrunningRMAN,usetheservicenameintheconnectstringforthetarget

parameter:

rmantargetsys/<password>@<scan_address>/<service_name>target

Alloftheexamplesillustratedinthisdocumentusethefollowingnaming:

Primary Standby

Hosts exa503,exa504 exa505,exa506

DatabaseUniqueName ssa ssb

Instancenames ssa1,ssa2 ssb1,ssb2

SOLUTION

StepstoDuplicatethePrimaryDatabase
Thefollowingarethestepsusedtocreatetheconfiguration:

1.Createstandbyredologsontheprimaryandstandbydatabasethatarethesamesizeoftheonlineredologs.
Oraclerecommendshavingthesamenumberplusoneadditionalstandbyredologforeachthread.Forexample:

SQL>alterdatabaseaddstandbylogfilethread1
group9size500M,
group10size500M,
group11size500M

SQL>alterdatabaseaddstandbylogfilethread2
group12size500M,
group13size500M,
group14size500M

2.Ontheprimarydatabaseenableforcelogging:

SQL>alterdatabaseforcelogging

3.Inthestandbydatabasehome,createandstartalistenerthatoffersastaticSIDentryforthestandbydatabasethat
isthesameORACLE_SIDastheprimary(ssa1).

LISTENER_duplicate=
(DESCRIPTION_LIST=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)
(HOST=exa505)
(PORT=1521)(IP=FIRST))))

SID_LIST_LISTENER_duplicate=
(SID_LIST=
(SID_DESC=
(SID_NAME=ssa1)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)))

4.Inthedatabasehomeontheprimarynode,createanOracleNetaliastoconnecttothelistenercreatedintheabove
step.

dup=
(DESCRIPTION=
(ADDRESS=
(PROTOCOL=TCP)
(HOST=exa505)
(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SID=ssa1)))

5.Createapasswordfileonthestandbyhostthatwheretheauxiliaryinstancewillbestarted.Forexample:

orapwdfile=orapwssa1password=<primarydatabasesyspassword>

6.IfthestandbywillbeRACthencopytheprimarypasswordfiletoallstandbyhostsandleaveitthesameasthe
primarysid(ssa1andssa2).
7.OnthestandbyhostintheORACLE_HOME/dbsdirectorycreateapfile(initssa1.ora)withthefollowingparameters:

db_name=ssa
db_unique_name=ssb
sga_target=5g

8.Onallstandbyhostscreatetheauditdirectoryforthessadatabase:

mkdirp/u01/app/oracle/admin/ssa/adump

9.OnallprimaryhostscreateanOracleNetaliastoreachthessbdatabaseonthestandbynodes.Makesurethatall
hostshavebothanssaandssbOracleNetaliasandthatallthealiasesreferencethescanlistenerandnotthenode
vip.Also,iflocal_listenerissettoanaliasontheprimarycreateacorrespondingentryonthestandbysidethatpoints
tothelocallisteneronthatsystem.Forexample:

Inalltnsnames.orafilesontheprimarynodes Inalltnsnames.orafilesonthestandbynodes

ssa= ssa=
(DESCRIPTION= (DESCRIPTION=
(ADDRESS_LIST= (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=prmyscan) (ADDRESS=(PROTOCOL=TCP)(HOST=prmyscan)
(PORT=1521)) (PORT=1521))
) )
(CONNECT_DATA= (CONNECT_DATA=
(SERVER=DEDICATED) (SERVER=DEDICATED)
(SERVICE_NAME=ssa) (SERVICE_NAME=ssa)
) )
) )

ssb= ssb=
(DESCRIPTION= (DESCRIPTION=
(ADDRESS_LIST= (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=stbyscan) (ADDRESS=(PROTOCOL=TCP)(HOST=stbyscan)
(PORT=1521)) (PORT=1521))
) )
(CONNECT_DATA= (CONNECT_DATA=
(SERVER=DEDICATED) (SERVER=DEDICATED)
(SERVICE_NAME=ssb) (SERVICE_NAME=ssb)
) )
) )

ssa_local_listener= ssb_local_listener=
(DESCRIPTION= (DESCRIPTION=
(ADDRESS_LIST= (ADDRESS_LIST=
(ADDRESS=(PROTOCOL=TCP)(HOST=prmyvip) (ADDRESS=(PROTOCOL=TCP)(HOST=stbyvip)(PORT
(PORT=1521)) =1521))
) )
) )

10.OnthestandbyhostsettheSIDtothesameastheprimarysid(ssa1)andstartupnomountthestandby/auxiliary
instance.

11.Ifthecluster_interconnectsparameterissetontheprimaryitwillbenecessarytounsetit.

SQL>altersystemresetcluster_interconnectsscope=spfilesid='ssa1'
SQL>altersystemresetcluster_interconnectsscope=spfilesid='ssa2'
12.Ontheprimaryhostrunanrmanscriptthatduplicatestheprimarydatabaseusingtheduplicatetargetdatabase
forstandbyfromactivedatabasecommand.Notethatthecontentsoftheduplicatecommandwillvarydependingon
yourenvironment.Pleaseconsultchapter24oftheOracleDatabaseBackupandRecoveryUser'sGuideforcomplete
information.

Considerthefollowingexamplewhichillustrateshowtoduplicatebetweentwosystemswherethediskgroupnames
aredifferent:

rman<<EOF
connecttargetsys/welcome1@prmy
connectauxiliarysys/welcome1@dup
run{
allocatechannelprmy1typedisk
allocateauxiliarychannelstbytypedisk
duplicatetargetdatabaseforstandbyfromactivedatabase
spfile
parameter_value_convert'+DATA_prmy','+DATA_stby','+RECO_prmy','+RECO_stby'

setcluster_database='false'
setdb_file_name_convert'+DATA_prmy','+DATA_stby'
setdb_unique_name='ssb'
setdb_create_online_log_dest_1='+DATA_stby'
setdb_create_file_dest='+DATA_stby'
setdb_recovery_file_dest='+RECO_stby'
setlog_file_name_convert'+DATA_prmy','+DATA_stby','+RECO_prmy','+RECO_stby'
setcontrol_files='+DATA_stby/ssb/standby.ctl'
setlocal_listener='ssb_local_listener'
setremote_listener='stbyscan:1521'
}EOF

Thefollowingexampleillustrateshowtoduplicatebetweentwosystemswherethediskgroupnamesarethesame:

rman<<EOF
connecttargetsys/welcome1@prmy
connectauxiliarysys/welcome1@dup
run{
allocatechannelprmy1typedisk
allocateauxiliarychannelstbytypedisk

duplicatetargetdatabaseforstandbyfromactivedatabase
spfile
setdb_unique_name='ssb'
setcontrol_files='+DATA/ssb/standby.ctl'
setlocal_listener=ssb_local_listener
setremote_listener=stbyscan:1521
}
EOF

Thefollowingexampleillustrateshowtoduplicatebetweentwosystemswherethesourceisonafilesystemandthe
targetisusingadiskgroup:

rman<<EOF
connecttargetsys/welcome1@prmy
connectauxiliarysys/welcome1@dup
run{
allocatechannelprmy1typedisk
allocateauxiliarychannelstbytypedisk

duplicatetargetdatabaseforstandbyfromactivedatabase
db_file_name_convert'/u01/data','+DATA_stby'
spfile
parameter_value_convert'/u01/data','+DATA_stby','/u01/reco','+RECO_stby'
setdb_file_name_convert'/u01/data','+DATA_stby'
setdb_unique_name='ssb'
setdb_create_online_log_dest_1='+DATA_stby'
setdb_create_file_dest='+DATA_stby'
setdb_recovery_file_dest='+RECO_stby'
setlog_file_name_convert'/u01/data','+DATA_stby','/u01/reco','+RECO_stby'
setcontrol_files='+DATA_stby/ssb/standby.ctl'
setlocal_listener=ssb_local_listener
setremote_listener=stbyscan:1521
}
EOF

13.Ifyouunsettheprimaryscluster_interconnectinstep11thenyoushouldnowsetthosebacktotheoriginalvalues
intheprimaryspfile.

14.Optionallystopandremovethelistenercreatedinstep3.

CompleteStandbyRACConfiguration

Aftercompletionofthestepsintheabovesectionhavecompletedthenthestandbydatabasehasbeencreatedonthe
standbyhost.Iftheprimarywassingleinstancedatabasethennofurtherworkneedstobedoneandyoushould
proceedtothesectionbelowoncreatingthebrokerconfiguration.IftheprimarywasRACthenafewconfiguration
itemsneedtobecompletedtofinishtheRACconfigurationonthestandby.Theseremainingconfigurationstepsare
coveredbelow.

1.Createatemporarypfilefromspfileonthestandby.

SQL>createpfile='/tmp/p.ora'fromspfile

2.Ifthestandbywillbestartedwithdifferentinstancenamesthanthatoftheprimaryinstancesthenmodifythe
temporarypfileonthestandbysystemtoadjustthesidprefixestomatchthestandbyinstancenames.Forexample:

Primary Standby

ssa2.__db_cache_size=12280922112 ssb2.__db_cache_size=12280922112
ssa1.__db_cache_size=11609833472 ssb1.__db_cache_size=11609833472
ssa1.__java_pool_size=469762048 ssb1.__java_pool_size=469762048
ssa2.__java_pool_size=469762048 ssb2.__java_pool_size=469762048
ssa1.__large_pool_size=8589934592 ssb1.__large_pool_size=8589934592
ssa2.__large_pool_size=8589934592 ssb2.__large_pool_size=8589934592
.. ..
. .
. .

3.Createaspfilein+DATA_stbyforthestandbydatabase:

SQL>createspfile='+DATA_stby/ssb/spfilessb.ora'frompfile='/tmp/p.ora'

4.Onallstandbyhostscreateaninitssbn.orafilethatpointstothespfilecreatedintheabovestep

5.Restartthestandbyinstances.IfthestandbyisRACthenregisterthedatabasewithCRS:

srvctladddatabasedssbo/u01/app/oracle/product/11.2.0/db_1
srvctladdinstancedssbissb1nexa505
srvctladdinstancedssbissb2nexa506
srvctlmodifydatabasedssbrphysical_standby

CreatingaDataGuardBrokerconfiguration:

ThefollowingsectiondescribeshowthebasicstepsonhowtocreateaDataGuardbrokerconfiguration.Forcomplete
informationontheDataGuardbrokerconsulttheOracleDataGuardBrokerguide.

1.OnboththeprimaryandstandbyconfiguretheDataGuardbrokermetadatafilesandenablethebroker:

Primary:

SQL>altersystemsetdg_broker_config_file1='+DATA_prmy/ssa/dr1.dat'scope=both
SQL>altersystemsetdg_broker_config_file2='+DATA_prmy/ssa/dr2.dat'scope=both
SQL>altersystemsetdg_broker_start=truescope=both

Standby

SQL>altersystemsetdg_broker_config_file1='+DATA_stby/ssb/dr1.dat'scope=both
SQL>altersystemsetdg_broker_config_file2='+DATA_stby/ssb/dr2.dat'scope=both
SQL>altersystemsetdg_broker_start=truescope=both

2.Addstaticsidentriesintothelocalnodelistener.oralocatedinthegridinfrastructurehomeonallhostsinthe
configuration(pleasereferenceNote1387859.1forcompleteinformation):

Note:Static"_DGMGRL"entriesarenolongerneededasofOracleDatabase12.1.0.2inOracleDataGuardBrok erconfigurationsthataremanaged
by OracleRestart,RA COnNodeorRA CastheBrok erwillusetheclusterwaretorestartaninstance.

LISTENER_SCAN2=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER
_SCAN2))))
LISTENER_SCAN3=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER
_SCAN3))))
LISTENER=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))))

LISTENER_SCAN1=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER
_SCAN1))))
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN1=ON
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER=ON
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=ssa_DGMGRL)
(SID_NAME=ssa1)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1)))
ENABLE_GLOBAL_DYNAMIC_ENDPOINT_LISTENER_SCAN3=ON

3.Bounceorreloadallthelistenerswheretheabovemodificationwasmade(primaryandstandbynodes):

srvctlstoplistener
srvctlstartlistener

4.Onaprimaryhostconnectwithdgmgrlandcreatetheconfiguration:
[oracle@exa501/etc]$dgmgrlsys/oracle

DGMGRL>createconfiguration'dg_config'as
primarydatabaseis'ssa'
connectidentifierisssa

Configuration"dg_config"createdwithprimarydatabase"ssa"

DGMGRL>adddatabase'ssb'as
connectidentifierisssb

Database"ssb"added

DGMGRL>enableconfiguration

Enabled.

5.Verifythattheconfigurationcreatedsuccessfullybyusingtheshowconfigurationcommand:

DGMGRL>showconfiguration

Configurationdg_config

ProtectionMode:MaxPerformance
Databases:
ssaPrimarydatabase
ssbPhysicalstandbydatabase

FastStartFailover:DISABLED

ConfigurationStatus:
SUCCESS

6.OptionallyenableFlashbackdatabaseonboththeprimaryandstandby:

Primary:

SQL>alterdatabaseflashbackon

StandbyviaSQL*Plus:

SQL>recovermanagedstandbydatabasecancel
SQL>alterdatabaseflashbackon
SQL>recovermanagedstandbydatabasedisconnectusingcurrentlogfile

OronstandbyviaDGMGRL(youmustbeconnectedtothestandbydatabaseviaDGMGRL):

DGMGRL>EDITDATABASEssbSETSTATE=APPLYOFF
DGMGRL>SQL"ALTERDATABASEFLASHBACKON"
DGMGRL>EDITDATABASEssbSETSTATE=APPLYON

CreateServicestobeUsedbyApplications:

1.Createservicesfortheworkloadthatperformsupdatesthatshouldonlybepresentedontheprimarydatabaseas
wellasservicesforreportsthatshouldonlybepresentonthephysicalstandby.Iftheprimary/standbyisRACorRAC
Onenodetheservicesarecreatedusingsrvctl.NoteforJDBCapplicationserversideTAFattributesshouldbesetto
NONE.Ifyouarecreatingservicesforamultitenantdatabasethenuseservicecommandsthatincludethepdboption.
Primarycluster:

srvctladdservicedssasworkloadrssa1,ssa2lPRIMARYqTRUEeSESSIONmBASICw10
z150
srvctladdservicedssasreportsrssa1,ssa2lPHYSICAL_STANDBYqTRUEeSESSIONm
BASICw10z150

StandbyCluster:

srvctladdservicedssbsworkloadrssb1,ssb2lPRIMARYqTRUEeSESSIONmBASICw10
z150
srvctladdservicedssbsreportsrssb1,ssb2lPHYSICAL_STANDBYqTRUEeSESSIONm
BASICw10z150

PrimaryDatabase:

SQL>EXECUTEDBMS_SERVICE.CREATE_SERVICE('reports','reports',NULL,NULL,TRUE,'BASIC',
'SESSION',150,10,NULL)

2.CreateOracleNetaliasthatreferencetheaboveservices

Didn'tfindwhatyouarelookingfor?

Vous aimerez peut-être aussi