You are on page 1of 7

RMAN and the Standby Database

Introduction: The relationship between RMAN and standby database is: Rman is used to create the standby database. There were two types of standby database from oracle version 9.2.Physical and o!ical "tandby #$. Physical "tandby db is nothin! more than a copy of Primary #$ that is always in state of media recovery. %t means Physical "tandby is in mount "tate always. &hen Primary #$ is accidentally down or under disaster recovery case' we start media recovery of "tandby db by applyin! archives and open the standby #$. %n the primary #$ we specify the archive lo! destination as o!(archive(dest(n: &e can specify multiple destinations. %f we are maintainin! standby' and then one of the archive lo! destinations must be "tandby #$ server. A o!ical standby #$ behaves by sli!htly different rules. %t is always in open state and applies archive lo!s from primary at the same time. %t uses o!ical ") *#M statements to apply archive lo!s. &e need +racle net services to transport archives from Primary to standby #$. o! transport services' o! apply service and other techni,ues need to be used to maintain "tandby #$. &ith +racle 9i we have #ata -uard technolo!y. A data !uard can have ma.imum of 9 "tandby #$ /includin! both o!ical and physical "tandby0. %n simple word a #ata !uard is !roup of standby maintained for #isaster recovery. &e can use #ata bro1er to mana!e #ata !uard. #ata bro1er is a command line utility. "tandby #$ is mainly used for disaster recovery. o!ical standby is also used to ta1e lon! runnin! reports. &e can also schedule bac1up strate!y for standby instead of schedulin! it in Primary #$. RMAN bac1up cannot be used to create a o!ical standby #$ .Please find the reason222 3ere all e.planations !iven for RMAN*Physical standby creation. This is the brief idea about "tandby. 3ere my intention is to !ive RMAN concepts for standby. % am ready to discuss standby in depth if time permits me ne.t time222 Requirements : 1. Ma1e all necessary chan!es in both the primary and "tandby #$ init.ora files.

2. 4omplete all net confi!urations. 3. "tart the standby in Nomount phase. %n the RMAN clonin! class % e.plained the main steps for clonin! and e.plained the chan!es we need to perform in init.ora file of #uplicate #$. 5ust recall once a!ain please6. &e need to create specific 1ind of control file bac1up for standby db. A re!ular 47 bac1up is not used when we create standby #$'because a standby 47 is different from Re!ular 47. A standby 47 also not allow a standby #$ to open with alter database open command. &e must activate a standby #$/thus ma1e it the primary #$0 usin! alter database acti ate standby database command. To create a standby 4ontrol file' ") 8alter database create standby controlfile as 9:u;<:bac1up:stby(cont(ctl=> %f we create standby 47 li1e this' then we need to catalo! it with RMAN. RMAN8catalo! controlfilecopy 9u;<:bac1up:stby(cont(ctl= +therwise we can use RMAN to create standby 47 li1e this. RMAN!bac"up current contro#ile #or standby$ Memory %onsiderations: %n case of 4loned #$' #$(NAM? parameter of the Primary and 4loned /au.iliary0 are different. $ut in "tandby they are same2... #b(name parameter in standby db must match db(name parameter of Primary #$.This is mar!inally interestin! news if you are creatin! standby #$ on different server' but has interestin! implications if we build standby #$ on same server as the primary #$. +racle uses db(name to loc1 memory se!ments at the +" level' so if we try to mount two instances with same db on same server' we will !et an error: +RA*;<<;2: 4annot mount database in e.clusive mode To !et around this we need to add one of the important parameter in init.ora file of standby #$. +4@(NAM?("PA4? is the parameter.

&e need to set this parameter different from db(name parameter. Then +racle uses this parameter to loc1 memory se!ments without chan!in! db(name. &oc"'name'space()stby1) The command to create "tandby loo1s li1e this RMAN!duplicate tar*et database #or standby$ &o* +ile considerations: &e cannot use the lo! file clause when creatin! the standby. %t means we cannot specify lo!file 1eyword while writin! script. %nstead' we need to specify parameter lo!(file(name(convert in init.ora file of standby db. $ut we can do this in 4lonin!. Please refer clonin! document. Data#ile %onsideration %f we are creatin! the standby #$ in different server than primary server #$ then we do not have to chan!e anythin! about datafile location' so lon! as standby db mount point and directory structures are same as Primary #$. As with re!ular duplication' if you are usin! the same datafile location on the standby that e.ists on the primary' then we need to use the no#ilenamechec" 1ey word in duplicate command. RMAN8duplicate database for standby nofilenamechec1> %f we are creatin! standby on the same server as primary' we need to chan!e the location for standby datafiles. &e can do this by three methods: Asin! confi!ure au.name Asin! set newname in run bloc1 Asin! db(file(name(convert parameter in standby init.ora file of standby #$ Media Reco ery %onsiderations: "tandby #$ is never opened for read write activity. %t is mounted and placed in state of media recovery or it is opened in read only mode and users can issue select statements. RMAN #uplicate for standby command does not recreate 4ontrol file as in 4lonin! method. "tandby command will restore bac1up controlfile. #uplicate for standby will not perform media recovery by default. %t will not perform reset #$%# and doesn=t open "tandby #$ with reset lo!s.

"o after completion of duplicate... for standby' standby #$ is mounted but not open. %f we li1e RMAN to perform initial media recovery and apply archive lo!s' then we need to use the 1ey word doreco er with duplicate command. Then command loo1s li1e this: RMAN!duplicate tar*et database #or standby doreco er$ &e can also specify set until time' "et until scn for media recovery in the above command. %reate standby Database usin* RMAN: Step by step procedure %n this e.ample the standby #$ is on the same server as Primary #$ server. +RA4 ?("%# for standby is stby' but db(name is same as the Primary: sun92 .&e will use d$*file(name(convert and lo!(file(name(convert parameters and we will perform media recovery. Step 1: ,se -racle to create standby control #ile. ?.port +RA4 ?("%#Bsun92 Rman Rman8connect tar!et : Rman8connect catalo! rman:rman /if usin! 4atalo!0 Rman8bac1up current controlfile for standby formatB=:u;2:bac1up:stby(cfile. CA=> &e will need to specify point in time after we created standby controlfile /Dust for media recovery purpose0. "o perform some lo! switches. ",l8alter system switch lo!file> ",l8alter system switch lo!file> ",l8select se,uenceE from FGarchived(lo!> Step 2: .uild standby database directory structure: M1dir :u;2:oracle(user:+ra3ome<:oradata:stby M1dir :u;2:oracle(user:+ra3ome<:oradata:stby:arch 4d :u;2:oracle(user:+ra3ome<:admin M1dir stby 4d stby M1dir pfile bdump udump cdump s

Step 3: %opy the tar!et init.ora file to au.iliary location /standby location0. %f primary #b usin! spfile' then we need to create pfile li1e this. ",l8connect :Hsun92 as sysdba ",l8 create pfile B=:u;2:oracle(user:+ra3ome<:admin:au.<:pfile:init.ora= from spfile> %f we use pfile' then 4p :uo2:oracle(user:ora3ome<:admin:sun92:pfile:init.ora :u;2:oracle(user:+ra3ome<:admin:stby:pfile:init.ora Step /: Ma"e all necessary chan*es to stby init.ora #ile 4ontrol(fileB=:u;2:oracle(user:+ra3ome<:oradata:stby:control<.dbf=> $ac1!round(dump(destB=Path(name= Aser(dump(destB=path(name= &o*'archi e'dest'1B=locationB:A;<:oracle(user:+ra3ome<:oradata:stby :arch= standby'archi e'destB=locationB:A;<:oracle(user:+ra3ome<:oradata:stby :arch= loc1(name(spaceB=stby= remote(lo!in(passwordfileBe.clusive db(file(name(convertB /9sun92='=stby=0 lo!(file(name(convertB /9sun92='=stby=0 Step 0: %reate pass1ord #ile #or standby D. Step 2: Start the stby instance in nomount mode: -RA%&3'SID(stby 34port -RA%&3'SID Sqlplus 5nolo* Sql!connect 5 as sysdba Sql!startup nomount p#ile(:u;2:oracle(user:+ra3ome<:admin:au.<:pfile:init.ora= Step 6: %on#i*ure Net1or" #iles7 both tnsnames.ora and listener.ora #iles. 8hese #iles should ha e an entry #or standby SID. 9see -racle net con#i*uration o# #unda 2:

Step ;: +rom RMAN7 connect to tar*et and au4iliary 9standby: instance and run the duplicate command -RA%&3'SID(sun<2 34port -RA%&3'SID Rman Rman!connect tar*et 5 Rman!connect au4iliary sys5pass1ord=stby Rman!run > Set until sequence(102 thread(1$ Duplicate tar*et database #or standby doreco er$ ? @e can use RMAN to create Ahysical standby not lo*ical standby Db. Reason is 8o create lo*ical standby D.7 1e need to ta"e bac"up o# primary D. under quiesced state. Buiesced re#ers to a database that is open7 but all acti ity is #roCen. RMAN cannot quiesce a database. DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD EArise7a1a"e and stop not till the *oal is reachedF 8han"s Madhua"ara Mithota