Sunteți pe pagina 1din 13

OracleDatabaseAdministration

UmaMKatrublogaboutOracleDatabase

Home
About

Typetexttosearchhere...
Home>Dataguard>StepByStepGuideOnCreatingPhysicalStandby
UsingRMAN(ASM)

StepByStepGuideOnCreatingPhysicalStandby
UsingRMAN(ASM)
April15,2012ukatru454LeaveacommentGotocomments

ThisarticleexplainsstepstocreatephysicalstandbydatabaseusingOracleDatabase
11gRMANFROMACTIVEDATABASEcapabilitytotheDUPLICATEFOR
STANDBYcommand.

PrimarydatabaseName:primdv1

StandbydatabaseName:stbydv1

Step1)Makesureprimarydatabaseisrunninginarchivelogmode.

2)DetermineifFORCELOGGINGisenabled.Ifitisnotenabled,enableFORCE
LOGGINGmode.
SQL>SELECTforce_loggingFROMv$database

FOR

NO

SQL>ALTERDATABASEFORCELOGGING

Databasealtered.

SQL>SELECTforce_loggingFROMv$database

FOR

YES

3)Configuretheprimarydatabasetoreceiveredodata,byaddingthestandbylogfilesto
theprimary
Itishighlyrecommendedthatyouhaveonemorestandbyredologgroupthanyouhave
onlineredologgroupsastheprimarydatabase.
Thefilesmustbethesamesizeorlargerthantheprimarydatabasesonlineredologs.
ALTERDATABASEADDSTANDBYLOGFILE
+DATA1/primdv1/srl01.log
SIZE52428800
/

ALTERDATABASEADDSTANDBYLOGFILE
+DATA1/primdv1/srl02.log
SIZE52428800
/

ALTERDATABASEADDSTANDBYLOGFILE
+DATA1/primdv1/srl03.log
SIZE52428800
/

ALTERDATABASEADDSTANDBYLOGFILE
+DATA1/primdv1/srl04.log
SIZE52428800
/

4)Setprimarydatabaseinitializationparameters

ALTERSYSTEMSETlog_archive_config=dg_config=(primdv1,stbydv1)

ALTERSYSTEMSETlog_archive_dest_2=
service=stbydv1asyncvalid_for=(online_logfile,primary_role)
db_unique_name=stbydv1

showparameterlog_archive_config

showparameterlog_archive_dest_2
Ifyougetfollowingerror
ERRORatline1:
ORA02097:parametercannotbemodifiedbecausespecifiedvalueisinvalid
ORA16019:cannotuseLOG_ARCHIVE_DEST_1withLOG_ARCHIVE_DESTor
LOG_ARCHIVE_DUPLEX_DEST

Solution:

1.ResettheLOG_ARCHIVE_DESTtoNULLvalue:

SQL>ALTERSYSTEMsetlog_archive_dest=

2.SettheLOG_ARCHIVE_DEST_1tothevaluesettoLOG_ARCHIVE_DESTbefore

SQL>ALTERSYSTEMsetlog_archive_dest_1=LOCATION=/

ifyouusethiscode,youdontneedtorestartdatabase:

ALTERSYSTEMSETLOG_ARCHIVE_DEST_1=LOCATION=h:\oradata\archive
SCOPE=BOTH

Tocheckarchivaldestinationissueisok:
showparameterLOG_ARCHIVE_DEST
selectDEST_ID,DEST_NAME,DESTINATIONfromv$archive_dest
updatetnsnames.orafilewiththefollowingentriesonbothhosts:

PRIMDV1=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=dgprim0001.ukatru.com)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=primdv1.ukatru.com)
)
)

STBYDV1=
(DESCRIPTION=
(ADDRESS=(PROTOCOL=TCP)(HOST=dgstby0001.ukatru.com)(PORT=1521))
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=stbydv1.ukatru.com)
)
)
updatethelistner.orawiththefollowingvaluesonstandbydatabase:
SID_LIST_LISTENER=
(SID_LIST=
(SID_DESC=
(GLOBAL_DBNAME=standby1.example.com)
(ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME=standby1)
)
)

copytheremoteloginpasswordfile(orapwprimdv1)fromtheprimarydatabasesystemto
the$ORACLE_HOME/dbsdirectoryonthe
standbydatabasesystem,renamingittoorapwstbydv1.
Inthe$ORACLE_HOME/dbsdirectoryofthestandbysystem,createaninitialization
parameterfilenamedinitstbydv1.ora
containingasingleparameter:DB_NAME=stbydv1(i.e.stbydv1)

Onthestandbysystem,changetothe/u01/app/oracle/admindirectory.Createadirectory
withanamethatmatchesyourphysicalstandbySID(i.e.stbydv1).
Changetothenewlycreateddirectory(i.e.stbydv1)andcreateanadumpdirectory.

nowonthestandbysystemlogintodatabase
exportORACLE_SID=stbydv1
dgstby0001:/u01/app/oracle/admin/stbydv1>exportORACLE_SID=stbydv1
dgstby0001:/u01/app/oracle/admin/stbydv1>sqlplus/assysdba

SQL*Plus:Release11.2.0.3.0ProductiononSatApr1422:57:242012

Copyright(c)1982,2011,Oracle.Allrightsreserved.

Connectedtoanidleinstance.

SQL>
SQL>startupnomountpfile=$ORACLE_HOME/dbs/initstbydv1.ora
ORACLEinstancestarted.
TotalSystemGlobalArea238034944bytes
FixedSize2227136bytes
VariableSize180356160bytes
DatabaseBuffers50331648bytes
RedoBuffers5120000bytes

RMAN>connecttargetsys

targetdatabasePassword:
connectedtotargetdatabase:PRIMDV1(DBID=1462743077)

RMAN>connectauxiliarysys@stbydv1

auxiliarydatabasePassword:
connectedtoauxiliarydatabase:STBYDV1(notmounted)

Belowisthermanscripttocreatestandbydatabase:
run{
allocatechannelprmy1typedisk
allocatechannelprmy2typedisk
allocatechannelprmy3typedisk
allocatechannelprmy4typedisk
allocateauxiliarychannelstbytypedisk
duplicatetargetdatabaseforstandbyfromactivedatabase
spfile
parameter_value_convertprimdv1,stbydv1
setdb_unique_name=stbydv1
setdb_file_name_convert=/primdv1/,/stbydv1/
setlog_file_name_convert=/primdv1/,/stbydv1/
setcontrol_files=+DATA1
setlog_archive_max_processes=5
setfal_client=stbydv1
setfal_server=primdv1
setstandby_file_management=AUTO
setlog_archive_config=dg_config=(primdv1,stbydv1)
setlog_archive_dest_2=service=primdv1ASYNCvalid_for=
(ONLINE_LOGFILE,PRIMARY_ROLE)db_unique_name=primdv1

channelprmy3:SID=55devicetype=DISK

allocatedchannel:prmy4
channelprmy4:SID=56devicetype=DISK

allocatedchannel:stby
channelstby:SID=19devicetype=DISK

StartingDuplicateDbat14APR12

contentsofMemoryScript:
{
backupascopyreuse
targetfile/u01/app/oracle/product/11.2.0.3/db_1/dbs/orapwprimdv1auxiliaryformat
/u01/app/oracle/product/11.2.0.3/db_1/dbs/orapwstbydv1targetfile
+DATA1/primdv1/spfileprimdv1.oraauxiliaryformat
/u01/app/oracle/product/11.2.0.3/db_1/dbs/spfilestbydv1.ora
sqlclonealtersystemsetspfile=
/u01/app/oracle/product/11.2.0.3/db_1/dbs/spfilestbydv1.ora
}
executingMemoryScript

Startingbackupat14APR12
Finishedbackupat14APR12

sqlstatement:altersystemsetspfile=
/u01/app/oracle/product/11.2.0.3/db_1/dbs/spfilestbydv1.ora

contentsofMemoryScript:
{
sqlclonealtersystemsetaudit_file_dest=
/u01/app/oracle/admin/stbydv1/adumpcomment=
scope=spfile
sqlclonealtersystemsetdispatchers=
(PROTOCOL=TCP)(SERVICE=stbydv1XDB)comment=
scope=spfile
sqlclonealtersystemsetlog_archive_dest_1=
LOCATION=+DATA1/stbydv1comment=
scope=spfile
sqlclonealtersystemsetdb_unique_name=
stbydv1comment=
scope=spfile
sqlclonealtersystemsetdb_file_name_convert=
/primdv1/,/stbydv1/comment=
scope=spfile
sqlclonealtersystemsetlog_file_name_convert=
/primdv1/,/stbydv1/comment=
scope=spfile
sqlclonealtersystemsetcontrol_files=
+DATA1comment=
scope=spfile
sqlclonealtersystemsetlog_archive_max_processes=
5comment=
scope=spfile
sqlclonealtersystemsetfal_client=
stbydv1comment=
scope=spfile
sqlclonealtersystemsetfal_server=
primdv1comment=
scope=spfile
sqlclonealtersystemsetstandby_file_management=
AUTOcomment=
scope=spfile
sqlclonealtersystemsetlog_archive_config=
dg_config=(primdv1,stbydv1)comment=
scope=spfile
sqlclonealtersystemsetlog_archive_dest_2=
service=primdv1ASYNCvalid_for=(ONLINE_LOGFILE,PRIMARY_ROLE)
db_unique_name=primdv1comment=
scope=spfile
shutdowncloneimmediate
startupclonenomount
}
executingMemoryScript

sqlstatement:altersystemsetaudit_file_dest=/u01/app/oracle/admin/stbydv1/adump
comment=scope=spfile

sqlstatement:altersystemsetdispatchers=(PROTOCOL=TCP)
(SERVICE=stbydv1XDB)comment=scope=spfile

sqlstatement:altersystemsetlog_archive_dest_1=LOCATION=+DATA1/stbydv1
comment=scope=spfile

sqlstatement:altersystemsetdb_unique_name=stbydv1comment=scope=spfile

sqlstatement:altersystemsetdb_file_name_convert=/primdv1/,/stbydv1/
comment=scope=spfile

sqlstatement:altersystemsetlog_file_name_convert=/primdv1/,/stbydv1/
comment=scope=spfile

sqlstatement:altersystemsetcontrol_files=+DATA1comment=scope=spfile

sqlstatement:altersystemsetlog_archive_max_processes=5comment=scope=spfile

sqlstatement:altersystemsetfal_client=stbydv1comment=scope=spfile

sqlstatement:altersystemsetfal_server=primdv1comment=scope=spfile

sqlstatement:altersystemsetstandby_file_management=AUTOcomment=
scope=spfile

sqlstatement:altersystemsetlog_archive_config=dg_config=(primdv1,stbydv1)
comment=scope=spfile

sqlstatement:altersystemsetlog_archive_dest_2=service=primdv1ASYNCvalid_for=
(ONLINE_LOGFILE,PRIMARY_ROLE)db_unique_name=primdv1comment=
scope=spfile

Oracleinstanceshutdown

connectedtoauxiliarydatabase(notstarted)
Oracleinstancestarted

TotalSystemGlobalArea1068937216bytes

FixedSize2235208bytes
VariableSize616563896bytes
DatabaseBuffers444596224bytes
RedoBuffers5541888bytes
allocatedchannel:stby
channelstby:SID=21devicetype=DISK
contentsofMemoryScript:
{
sqlclonealtersystemsetcontrol_files=
+DATA1/stbydv1/controlfile/current.256.780620989comment=
SetbyRMANscope=spfile
backupascopycurrentcontrolfileforstandbyauxiliaryformat
+DATA1/stbydv1/controlfile/current.257.780620989
sqlclonealtersystemsetcontrol_files=
+DATA1/stbydv1/controlfile/current.257.780620989comment=
SetbyRMANscope=spfile
shutdowncloneimmediate
startupclonenomount
}
executingMemoryScript

sqlstatement:altersystemsetcontrol_files=
+DATA1/stbydv1/controlfile/current.256.780620989comment=SetbyRMAN
scope=spfile

Startingbackupat14APR12
channelprmy1:startingdatafilecopy
copyingstandbycontrolfile
outputfilename=/u01/app/oracle/product/11.2.0.3/db_1/dbs/snapcf_primdv1.f
tag=TAG20120414T230949RECID=1STAMP=780620989
channelprmy1:datafilecopycomplete,elapsedtime:00:00:03
Finishedbackupat14APR12

sqlstatement:altersystemsetcontrol_files=
+DATA1/stbydv1/controlfile/current.257.780620989comment=SetbyRMAN
scope=spfile

Oracleinstanceshutdown

connectedtoauxiliarydatabase(notstarted)
Oracleinstancestarted

TotalSystemGlobalArea1068937216bytes

FixedSize2235208bytes
VariableSize616563896bytes
DatabaseBuffers444596224bytes
RedoBuffers5541888bytes
allocatedchannel:stby
channelstby:SID=23devicetype=DISK

contentsofMemoryScript:
{
sqlclonealterdatabasemountstandbydatabase
}
executingMemoryScript

sqlstatement:alterdatabasemountstandbydatabase
RMAN05529:WARNING:DB_FILE_NAME_CONVERTresultedininvalidASM
namesnameschangedtodiskgrouponly.
contentsofMemoryScript:
{
setnewnamefortempfile1to
+data1
switchclonetempfileall
setnewnamefordatafile1to
+data1
setnewnamefordatafile2to
+data1
setnewnamefordatafile3to
+data1
setnewnamefordatafile4to
+data1
backupascopyreuse
datafile1auxiliaryformat
+data1datafile
2auxiliaryformat
+data1datafile
3auxiliaryformat
+data1datafile
4auxiliaryformat
+data1
sqlaltersystemarchivelogcurrent
}
executingMemoryScript

executingcommand:SETNEWNAME

renamedtempfile1to+data1incontrolfile

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

executingcommand:SETNEWNAME

Startingbackupat14APR12
channelprmy1:startingdatafilecopy
inputdatafilefilenumber=00001name=+DATA1/primdv1/datafile/system.261.780607599
channelprmy2:startingdatafilecopy
inputdatafilefilenumber=00002name=+DATA1/primdv1/datafile/sysaux.262.780607621
channelprmy3:startingdatafilecopy
inputdatafilefilenumber=00003
name=+DATA1/primdv1/datafile/undotbs1.263.780607639
channelprmy4:startingdatafilecopy
inputdatafilefilenumber=00004name=+DATA1/primdv1/datafile/users.265.780607653
outputfilename=+DATA1/stbydv1/datafile/users.260.780621011
tag=TAG20120414T231009
channelprmy4:datafilecopycomplete,elapsedtime:00:00:08
outputfilename=+DATA1/stbydv1/datafile/undotbs1.261.780621011
tag=TAG20120414T231009
channelprmy3:datafilecopycomplete,elapsedtime:00:01:47
outputfilename=+DATA1/stbydv1/datafile/system.258.780621011
tag=TAG20120414T231009
channelprmy1:datafilecopycomplete,elapsedtime:00:02:28
outputfilename=+DATA1/stbydv1/datafile/sysaux.259.780621011
tag=TAG20120414T231009
channelprmy2:datafilecopycomplete,elapsedtime:00:02:27
Finishedbackupat14APR12

sqlstatement:altersystemarchivelogcurrent

contentsofMemoryScript:
{
switchclonedatafileall
}
executingMemoryScript

datafile1switchedtodatafilecopy
inputdatafilecopyRECID=1STAMP=780621158file
name=+DATA1/stbydv1/datafile/system.258.780621011
datafile2switchedtodatafilecopy
inputdatafilecopyRECID=2STAMP=780621158file
name=+DATA1/stbydv1/datafile/sysaux.259.780621011
datafile3switchedtodatafilecopy
inputdatafilecopyRECID=3STAMP=780621158file
name=+DATA1/stbydv1/datafile/undotbs1.261.780621011
datafile4switchedtodatafilecopy
inputdatafilecopyRECID=4STAMP=780621158file
name=+DATA1/stbydv1/datafile/users.260.780621011
FinishedDuplicateDbat14APR12
releasedchannel:prmy1
releasedchannel:prmy2
releasedchannel:prmy3
releasedchannel:prmy4
releasedchannel:stby

RMAN>**endoffile**
Performalogswitchontheprimarydatabaseandredowillstartbeingsenttothestandby.
dgprim0001:/u01/app/oracle/wkdir>sqlplus/assysdba

SQL*Plus:Release11.2.0.3.0ProductiononSatApr1423:14:572012

Copyright(c)1982,2011,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase11gEnterpriseEditionRelease11.2.0.3.064bitProduction
WiththePartitioning,AutomaticStorageManagement,OLAP,DataMining
andRealApplicationTestingoptions

SQL>altersystemswitchlogfile

Systemaltered.

dgstby0001:/u01/app/oracle/product/11.2.0.3/db_1/network/admin>sqlplus/assysdba

SQL*Plus:Release11.2.0.3.0ProductiononSatApr1423:15:502012
Copyright(c)1982,2011,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase11gEnterpriseEditionRelease11.2.0.3.064bitProduction
WiththePartitioning,AutomaticStorageManagement,OLAP,DataMining
andRealApplicationTestingoptions

SQL>alterdatabaserecovermanagedstandbydatabase
2usingcurrentlogfiledisconnect

Databasealtered.

NowVerifythatthePhysicalStandbyDatabaseisPerformingCorrectly

SELECTsequence#,first_time,next_time,applied
FROMv$archived_log
ORDERBYsequence#
/

SQL>SELECTsequence#,first_time,next_time,applied
FROMv$archived_log
ORDERBYsequence#
/
234
SEQUENCE#FIRST_TIMNEXT_TIMEAPPLIED

3114APR1214APR12YES
3214APR1214APR12YES
3314APR1214APR12YES
3414APR1214APR12YES
3514APR1214APR12YES
3614APR1214APR12INMEMORY

6rowsselected.

Abouttheseads

Sharethis:

Twitter LinkedIn

Like
Like
Bethefirsttolikethis.

Related

StepByStepGuideOn StepstoConfiguredatabasein oracledataguardsetupusing


CreatingPhysicalStandby archivelogmode enterprisemanagergrid
UsingRMAN(NonASM) In"oracleinstall" control11g
In"Dataguard" In"Dataguard"

Categories:Dataguard
Comments(0)Trackbacks(0)LeaveacommentTrackback

1.Nocommentsyet.

1.Notrackbacksyet.

LeaveaReply

Enteryourcommenthere...

ImportantOracleDBATipsHowtoinstalloracleTimesTen11gonRedHat
EnterpriseLinux
RSSfeed

RecentPosts

ImportantOracleDBATips
StepByStepGuideOnCreatingPhysical
StandbyUsingRMAN(ASM)
HowtoinstalloracleTimesTen11gon
RedHatEnterpriseLinux
UDEVrulesfordevicepersistency
ownershipsinREDHAT6.1forASM
ora01653unabletoextendtable
intablespace
oracledataguardsetupusingenterprise
managergridcontrol11g
RawDeviceSetuponlinuxoracle10gr2
and11gr1forocrandvotingdisks
RemovinganodefromOracleRAC11gR2
oracledataintegrator11ginstallation
linux
scripttostartupsingleinstance
oracledatabase

Categories
Dataguard
dba_scripts
EnterpriseManagerGridControl
Linux
ODI
OimOracleIdentityManager
oraerrors
oracleasm
oraclefunctions
oraclestreams
oracleinstall
oracle_11g_new_features
oracle_init_parameters
rman

Blogroll

Discuss
GetInspired
GetPolling
GetSupport
LearnWordPress.com
WordPressPlanet
WordPress.comNews

Archives
September2012
April2012
November2011
September2011
August2011
July2011
June2011
May2011
April2011
March2011
February2011

Meta

Register
Login
Top
CreateafreewebsiteorblogatWordPress.com.