Вы находитесь на странице: 1из 10

8/30/2016

Document 1475344.1

CreatingaPhysicalStandbyDatabase(DocID1475344.1)
InthisDocument
Purpose
Scope
Details
PrerequisitesandAssumptionstogetstarted
EnvironmentInformation
PreparingtheEnvironmentandStandbyInstance
CreatethePhysicalStandbyDatabase

CreatingaStandbyDatabaseviaUserManagedBackups

CreatingaStandbyDatabaseusingRMAN(Backupbased)

CreatingaStandbyDatabaseusingRMANwithoutBackup(fromactiveDatabase)

PostCreationStepstomaketheDataGuardEnvironmentoperational
OptionaladditionalSteps
References

APPLIESTO:
OracleDatabaseEnterpriseEditionVersion10.1.0.2to12.1.0.2[Release10.1to12.1]
Informationinthisdocumentappliestoanyplatform.

PURPOSE
**checkedforrelevance'7Jul2015'**
ThisDocumentshowsthevariousPossibilitiestocreateaPhysicalStandbyDatabaseonOracleDatabase11.2.0.x.
ItshouldbeseenasanAdditionandClarificationtotheDocumentation.Youmayalsoreview
OracleDataGuard,ConceptsandAdministration,11gRelease2(11.2),E256080x
Chapter3:CreatingaPhysicalStandbyDatabase
AppendixE:CreatingaStandbyDatabasewithRecoveryManager
whichistheBaseforthisDocument.WetakeanExampleDatabaseandshowthevariousMethodstocreatetheStandby
Database.NotethatonlythebasicConceptsareshown.FurthermorecomplexScenariosarepossibleaswell,ofcourse.
TakeaLookintothecorrespondingDocumentationtogetthedeeperInsight.

WouldyouliketoexplorethisTopicfurtherwithotherOracleCustomers,OracleEmployeesand
IndustryExperts??
YoucandiscussthisNote,showyourExperiencesoraskQuestionsaboutitdirectlyrightattheBottomofthisNotein
theDiscussionThreadaboutthisDocument.
IfyouwanttodiscoverDiscussionsaboutotherArticlesundSubjectsorevenpostnewDiscussionsyoucanaccessthe
MyOracleSupportCommunityPageforHighAvailabilityDataGuard

SCOPE
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

1/10

8/30/2016

Document 1475344.1

ThisDocumentisintendedforSystemAdminstratorsplanningtosetupaStandbyDatabase.DependingontheNeedsand
PrerequisitesontheexistingEnvironmentyoucanchooseanyofthementionedWaystocreatetheStandbyDatabaseand
DataGuardEnvironment.
NotethatthisNotedoesnotcoverSettingupLogTransportandLogApplyServicesinDetailwetakethebasicdefault
Setuphere.ThesameistruefortheRMANEnvironmentinCasewheredifferentBackupTypesandScenariosarepossible.
WejusttrytoshowthebasicConcepthere.

DETAILS

PrerequisitesandAssumptionstogetstarted

TherealreadyexistsaPrimaryDatabaseyouwanttocreateyourStandbyDatabasefor
PrimaryDatabaseisinARCHIVELOGModeandlocalArchivingisusingFastRecoveryArea
FORCELOGGINGisenabledonthePrimaryDatabase
ThePrimaryDatabaseisusingaSPFILE
OntheStandbySiteORACLE_HOMEisinstalledusingthesameOracleReleaseandPatchlevel
ThePlatformoftheStandbyDatabaseisthesameasthePrimarySiteorasupportedCombinationasperNote
413484.1
ThereisNetworkConnectivitybetweenthePrimaryandStandbySystem
ListenerisconfiguredandrunningonthePrimaryandStandbySite
WearecreatingaStandbyDatabaseusingdefaultLogTransportServicesinMaximumPerformanceMode

EnvironmentInformation

ForallmentionedPossibilitiesweareusingthisEnvironment

OS:Linuxx6464
Hostname(Primary):TSTPRIM
Hostname(Standby):TSTSTBY
DatabaseVersion:11.2.0.x
DB_NAME(PrimaryandStandby):prim_db
SID/DB_UNIQUE_NAME(Primary):prim_db
SID/DB_UNIQUE_NAME(Standby):stby_db
ListenerPort(PrimaryandStandby):1521
PrimaryDatabaseFilesLocation:/oracle/oradata/prim_db
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

2/10

8/30/2016

Document 1475344.1

StandbyDatabaseFilesLocation:/oracle/oradata/stby_db

PreparingtheEnvironmentandStandbyInstance

CreateTNSAliastoresolvetheStandbyDatabaselater.TheTNSAliastoresolvethePrimaryandStandby
DatabasemustbepresentinthePrimaryandStandbyDatabaseTNSNAMES.ORA.Hereitlookslikethat:

PRIM_DB=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=TSTPRIM)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=prim_db.world)
)
)

STBY_DB=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=TSTSTBY)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=stby.world)
)
)

CreateFoldersinADMINandORADATAFolderstohosttheDatabaseFilesandDumpfiles(canuse
$ORACLE_BASE/adminofthePrimaryasaReferencewhichFolderstocreatetypicallythosearetheadumpand
dpdumpFolders)

$cd$ORACLE_BASE/admin
$mkdirstby_db
$cdstby_db
$mkdiradump
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

3/10

8/30/2016

Document 1475344.1

$mkdirdpdump

CreateaPFILEfromthePrimaryPFILEintheFormatinit<StandbySID>.ora

SQL>createpfile=/tmp/initstby_db.orafromspfile

SetthefollowingInitializationParametersonthePrimaryDatabase:
log_archive_dest_1=location=USE_DB_RECOVERY_FILE_DEST
log_archive_dest_2=service=stby_dbasyncvalid_for=(ONLINE_LOGFILES,PRIMARY_ROLE)
db_unique_name=stby_db
log_archive_dest_state_2=defer
log_archive_config=dg_config=(prim_db,stby_db)
log_archive_max_processes=8

>ThoseParameterspreparethePrimaryDatabasetosupportaStandbyDatabasestby_db.log_archive_dest_2is
responsiblefortransferringRedototheStandbySitelatercurrentlyitisdeferred,wewillenablelateroncetheStandby
Databaseexists.log_archive_configrecordsalldb_unique_namesparticipatinginthisConfiguration.

ModifythefollowingInitializationParametersinthePFILE(initstby_db.ora)fortheStandbyDatabasewecreated
before:
log_archive_dest_1=location=USE_DB_RECOVERY_FILE_DEST
log_archive_config=dg_config=(prim_db,stby_db)
log_archive_max_processes=8
fal_server=prim_db
log_file_name_convert=<absolutepathorasmdiskgroupnameofprimaryonlineredologfiles>,<absolutepath
orasmdiskgroupnameofstandbyonlineredologfiles>
db_file_name_convert=<absolutepathorasmdiskgroupnameofprimarydatafiles>,<absolutepathorasm
diskgroupnameofstandbydatafiles>
db_unique_name=stby_db

>ThoseParametersarerequiredtobeadjustedfortheStandbyDatabase.log_archive_dest_1heredefinesthelocal
ArchiveDestinationwherewewillputArchiveLogsarrivingfromthePrimaryDatabaselater.log_archive_configand
db_unique_namearerequiredfortheDataGuardConfiguration(likeonthePrimary)andfal_serverisrequiredforGap
ResolutiontobeabletoautomaticallyfetchArchiveLogsfromthePrimaryagaininCasethereisaGap.Toautomatethe
SubstitutionofDatabaseFileLocationswesetdb_file_name_convertandlog_file_name_convert.ThosePairsofValuesare
asimpleStringSubstitution.SeeNote1367014.1forfurtherDetails.
>Youmayalsoadjustaudit_file_destandcontrol_filestomatchwithyourEnvironmentandLocations.

Copypreparedinitstby_db.oratogetherwiththePasswordfileofthePrimaryDatabase(orapwprim_dbin
$ORACLE_HOME/dbs)totheStandbySiteandplacebothinto$ORACLE_HOME/dbsFolder.Thenyouhavetorenamethe
PasswordfiletomatchwiththeStandbySID:

$mvorapwprim_dborapwstby_db

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

4/10

8/30/2016

Document 1475344.1

CreatethePhysicalStandbyDatabase

InthepreviousSectionwepreparedtheEnvironmentsandthePrimaryDatabasetosupportaStandbyDatabase.Nowwe
canproceedandcreatethePhysicalStandbyDatabaseitself.Thereare3commonWaystoperformthiswhichwillbe
showninthenextSection.YoucanchooseanyWaymostsuitableforyou:
1.CreatingmanuallyviaUserManagedBackups
2.UsingRMANBackupbasedDuplication
3.CreatingaStandbyDatabasefromtheactivePrimaryDatabasewithoutaBackupusingRMANDuplicate

CreatingaStandbyDatabaseviaUserManagedBackups
WecanuseaHotorColdDatabaseBackuptocreatetheStandbyDatabase.ItisonlyimportanttocreatetheStandby
ControlfilefromthePrimaryaftertheBackuphascompleted.
ForaColdBackupwesimplyperformacleanshutdownofthePrimaryDatabaseandcopyallDatafilestoatemporary
Location,thenstartupthePrimaryDatabaseagain:

SQL>shutdownimmediate
$cp/oracle/oradata/prim_db/*.dbf/backup/
SQL>startup

IfyouwanttouseaHostBackup,wehavetoputthePrimaryDatabaseintoBackupModeandcopytheDatafiles:

SQL>alterdatabasebeginbackup
$cp/oracle/oradata/prim_db/*.dbf/backup/
SQL>alterdatabaseendbackup

WecancreatetheStandbyControlfilesincetheBackupiscomplete(eitherHotorColdBackup)

SQL>alterdatabasecreatestandbycontrolfileas/backup/control01.ctl

NowtherequiredFilesfortheStandbyDatabasearecompleteandwecantransferthosetotheStandbyDatabase
andplacethemintotheStandbyDatabaseFileFolder(inourExampleto/oracle/oradata/stby_db/)
OncetheDatafilesaretherewecansettheEnvironmentandfirstmounttheStandbyDatabase

$exportORACLE_SID=stby_db
SQL>connect/assysdba
SQL>startupmount

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

5/10

8/30/2016

Document 1475344.1

WhentheDatabaseismountedproceedwiththePostCreationStepsbelow

CreatingaStandbyDatabaseusingRMAN(Backupbased)
InsteadofcreatingaUserManagedBackupwecanalsouseaRMANBackuptocreatetheStandbyDatabase.
InthisCasewehavetocreateaRMANBackupofthePrimaryDatabasefirst:

RMAN>connecttarget/
RMAN>backupdatabaseplusarchivelogformat/backup/STBY_%U

SincetheBackupalreadyincludestheControlfile,thereisnoNeedtobackuporcreateaStandbyControlfile
separately
TransferallBackuppiecescreatedbytheRMANBackuptotheexactsameFolder(inourCase/backup/)onthe
StandbyDatabase
StartupnomounttheStandbyDatabase

$exportORACLE_SID=stby_db
SQL>startupnomount

AtthisPointwecannowstarttheRMANDuplicatetocreatetheStandbyDatabase

$exportORACLE_SID=stby_db
RMAN>connecttargetsys/<Password>@prim_db
RMAN>connectauxiliary/
RMAN>duplicatetargetdatabaseforstandbynofilenamecheck

>TheRMANDuplicatenowextractstheControlfileandDatafilesfromtheBackuptobuildtheStandbyDatabase.Once
doneitmountstheStandbyDatabase.SowecannowproceedwiththePostCreationStepsbelow.

CreatingaStandbyDatabaseusingRMANwithoutBackup(fromactiveDatabase)
ItisnowpossibletocreateaPhysicalStandbyDatabasefromtheactivePrimaryDatabase,ie.Itisnotnecessarytocreate
aBackupfirst.TheBlocksaretransferredtotheStandbyDatabaseviatheNetworkduringtheRMANDuplicate.Beforeyou
decidetousethisOptiontocreateyourStandbyDatabaseyoushouldensureyousufficientBandwithavailabletotransfer
allDatabaseBlocksofthePrimarytotheStandby.DependingontheSizeofyourPrimaryDatabaseandtheBandwith
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

6/10

8/30/2016

Document 1475344.1

availableitmighttakelongTimetocompletethisTask.IfyouhavealargeDatabaseoraslowNetworkConnectionyou
mayconsidertouseanotherOptiontocreateyourStandbyDatabase.
TheStepstocreatetheStandbyDatabasethatWayaresimilartoaBackupbasedRMANDuplicate,butwedonthaveto
taketheBackup,wecandirectlystarttheRMANDuplicatefromtheStandbySite:

$exportORACLE_SID=stby_db
SQL>startupnomount
RMAN>connecttargetsys/<Password>@prim_db
RMAN>connectauxiliary/
RMAN>duplicatetargetdatabaseforstandbyfromactivedatabasenofilenamecheck

>TheRMANDuplicatefirstcopiestheControlfilefromthePrimaryDatabaseasaStandbyControlfile,thenmountsthe
StandbyDatabasewiththisControlfileandcreatestheDatafiles/copiestheDatabaseBlocksfromthePrimary.Oncedone
theDuplicatefinishesandleavestheDatabaseinmountStatus.SowecannowproceedwiththePostCreationSteps
below.
NOTE:IfprimaryandstandbysharingsamestoragedonotuseNOFILENAMECHECKclauseunlessyouaresureaboutthe
directoriesaredifferent.
ref,

<NOTE789370.1 >CreatingPhysicalStandbyusingRMANDuplicateWithout
ShuttingdownThePrimary

PostCreationStepstomaketheDataGuard
Environmentoperational

InthepreviousChapterswepreparedandcreatedthePhysicalStandbyDatabase.NowwecanstarttheLogTransport
andLogApplyServicestohavetheDataGuardEnvironmentcompletelyoperational.
FirstofallweshouldnowaddStandbyRedoLogstothenewcreatedStandbyDatabasetocollectthecurrentRedo
arrivingfromthePrimaryDatabase.Wecanaddthoseusing

SQL>alterdatabaseaddstandbylogfile<group#>(<Member>)size<size>

YoushouldaddatleastonemoreStandbyRedoLogsGroupthancorrespondingOnlineRedoLogGroup.SeeNote219344.1
forfurtherDetailsandExamples.

NextwecanenableLogTransportServicesonthePrimaryDatabasewhichhavebeenpreparedinitially
performingaLogfileSwitchafterwardswillfinallyenableit(allchangestolog_archive_dest_nand
log_archive_dest_state_nbecomeactiveafterthenextLogSwitchonceset).

SQL>altersystemsetlog_archive_dest_state_2=enablescope=both
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

7/10

8/30/2016

Document 1475344.1

SQL>altersystemswitchlogfile

ToverifyifStandbyRedoLogsgetallocatedontheStandbyDatabaseandsoLogTransportServicesarerunningquery
v$standby_logontheStandbyDatabase:

SQL>select*fromv$standby_log

AssumingthatLogTransportServicesarerunningnow,wecanfinallystartLogApplyServices(Managed
Recovery):
SQL>alterdatabaserecovermanagedstandbydatabaseusingcurrentlogfiledisconnect

Queryv$managed_standbytomonitortheProgressoftheManagedRecovery:

SQL>select*fromv$managed_standbywhereprocess=MRP0

MostlikelytherewillnowbeaFALGapRequestfirsttoshipandapplyallArchiveLogscreatedsincewetooktheBackup.
DependingontheTimeandAmountofRedogeneratedonthePrimarymeanwhileitmaytakeawhile.
NotethatstartingManagedRecoverywillalsoattempttoclear/createtheOnlineRedoLogsontheStandbyDatabase
proactivetoreduceSwitchover/FailoverTime.

OptionaladditionalSteps

BasicallywehavenowanactiveDataGuardConfiguration.DependingonyourRequirementsyoucanproceedperforming
thoseSteps:
CreateanSPFILEfromthecurrentPFILEontheStandbyDatabase
EnableFlashbacktobeabletoFlashbackthisDatabase(eg.insteadofthePrimaryDatabasetogethistoricalData
oravoidhavingtorecreatetheStandbyDatainCaseofaRESETLOGSOperationonthePrimaryDatabase)
SetupandenableaDataGuardBrokerConfigurationtheDataGuardBrokerisanOffsettoDataGuardinorder
tomakemonitoringandadministeringofaDataGuardConfigurationmucheasier.NotethatusingaDataGuard
ConfigurationwithCloudControl(formerlyGridControl)requirestheDataGuardBroker
RaiseProtectionModetoMaximumAvailabilityorMaximumProtection
ProactivesetupLogTransportServicesfromStandbyDatabasetothePrimaryandcreateStandbyRedoLogsonthe
PrimaryforSwitchoverPurposesisused
OpentheStandbyDatabaseREADONLYandrestartManagedRecovery(ActiveDataGuard).Notethatthis
requiresLicensingoftheActiveDataGuardOption.HoweveryoucanopentheStandbyDatabaseopenREADONLY
withoutApplyServicesthisdoesnotrequirethisOptiontobelicensed
SetupFastStartFailover(requirestheDataGuardBroker,too)
AddadditionalStandbyDatabase(s)
TurnthejustcreatedPhysicalStandbyDatabaseintoaLogicalStandbyDatabase

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

8/10

8/30/2016

Document 1475344.1

YoucandirectlyparticipateintheDiscussionaboutthisNotebelow.TheFrameistheinteractivelive
DiscussionnotaScreenshot)

Thorstens-Oracle Nov 22, 2013 7:59 AM

Discussion of Note 1475344.1: Creating a Physical Standb


Oracle 11.2.0.x
This question is Not Answered.

This Thread is used for a Discussion aboutNote 1475344.1: Creating a Physical Standby Database on O

I have the same question (0)

42976Views

Tags:

Average User Rating

Your Rating:

(1 rating)

Thorstens-Oracle Oct 2, 2012 5:24 AM ( in response to Thorstens-Oracle)


1. Re: Discussion of Note 1475344.1: Creating a Physical Standby Database on Oracle 11.2.0.x

Hi all !!
Please post your Comments about this Article below.
Thanks,
Thorsten

Actions

User478743-OC Nov 22, 2013 1:39 AM ( in response to Thorstens-Oracle)


2. Re: Discussion of Note 1475344.1: Creating a Physical Standby Database on Oracle 11.2.0.x

HI ,

REFERENCES
NOTE:1367014.1UsageandLimitationofdb_file_name_convertandlog_file_name_convert
NOTE:219344.1Usage,BenefitsandLimitationsofStandbyRedoLogs(SRL)
Didn'tfindwhatyouarelookingfor?
https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

9/10

8/30/2016

Document 1475344.1

https://support.oracle.com/epmos/faces/DocumentDisplay?_adf.ctrl-state=18kvo1vh87_238&id=1475344.1

10/10

Вам также может понравиться