Oracle 11g Dataguard on VWware Using Rman

download Oracle 11g Dataguard on VWware Using Rman

of 47

Transcript of Oracle 11g Dataguard on VWware Using Rman

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    1/47

    Creating an Oracle 11g Dataguard on VWware

    using rman "duplicate target database for standby

    from active database"

    I created a VMware Linux Redhat 5.3 server using the Unbreakable Linix distribution provided by racle.In this exercise I will use the server ha! as "aster and the server ha# as standby 

    $he beauty of this exercise is that I a" going to use the new 11g command %duplicate target database &orstandby &ro" active database%. $his co""and creates a standby database &ro" an active database on the &ly.

    In previous releases the '() had to take a backup o& the "aster* copy it over onto the standby site and restoreit. (y using %duplicate target database &or standby &ro" active database% no ad interi" backup is needed* thedata&iles are directly copied over.

    Create an 11g database to start with

    $o start with* the racle !!g so&tware will be installed choosing only the re+uired co"ponents and a databasecreated &ro" the ,UI

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    2/47

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    3/47

    I will leave out co"ponents that are not necessary

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    4/47

    -aving "oved the VMware nodes around* I &orgot to check the status o& the network and a result the errorR)!#!5/ occurred.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    5/47

    $he reason &or the error R)!#!5/ was that the network was down0 it is better &or everybody that it is up.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    6/47

    Configuring the database as a master

    $he &irst re+uire"ent is that the database is put in %1R2 L,,I4,% "ode.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    7/47

    I& you decide to run the data guard in "axi"u" protection or "axi"u" availability* the transaction are copiedover to the standby site by the log writer and are written to the standby log&iles0 this is why we create standbylog&iles that will be used not locally* but by the standby.

    $he view V6$)4'(78L, contains in&or"ation about the standby redo logs.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    8/47

    9hen standby redologs are created* they are listed in vlog&ile* but their groups are listed inV6$)4'(78L,SQL> alter database add standby logfile '/opt/oracle/oradata/MASTERF/sb_redo0!log' si"e#0M$

    SQL> SELE%T & FRM ()standby_log$

     ,RU:; '(I' $-R)'; 6 > 5#=#??>> 5!# 76 U4)66I,4' ...

    In&act the view V6$)4'(78L,1IL does not exist.

    $he standby redo logs are instead in vlog&ileSQL> select & fro* +)STA,-._Lfile$select & fro* +)STA,-._Lfile  &ERRR at line 1RA2003451 table or (ie6 does not e7ist

    SQL> select *e*ber fro* ()logfile$

    MEM.ER22222222222222222222222222222222222222222222222222222222222222222222222222222222

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    9/47

    /opt/oracle/oradata/MASTERF/redo08!log/opt/oracle/oradata/MASTERF/redo05!log/opt/oracle/oradata/MASTERF/redo0!log/opt/oracle/oradata/MASTERF/sb_redo01.log

    $he racle docu"entation reco""ends creating standby redo logs in nu"ber e+ual to the nu"ber o& redologsgroups plus one* to avoid delays on the standby site when a switch occurs.SQL> alter database add standby logfile '/opt/oracle/oradata/MASTERF/sb_redo05!log' si"e#0M$SQL> alter database add standby logfile '/opt/oracle/oradata/MASTERF/sb_redo08!log' si"e#0M$

    SQL> alter database add standby logfile '/opt/oracle/oradata/MASTERF/sb_redo04!log' si"e#0M$

    $he instance on the "aster ha! will be called M)6$R1 and the instance on the standby side ha#* 6(1!MASTERF 9  :-ES%R;

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    10/47

    cat initS.F!ora

    db_na*e9S.F

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    11/47

    In doubt* I created so&t links on the standby server ha# to "ake sure that @oradata@M)6$R1 is available.$he listener has to be started on ha#* &or the whole process to work?a2> tnsping S.F

    Csed T,S,AMES adapter to resol(e t?e aliasAtte*pting to contact :-ES%R;

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    12/47

      set control_files9'/opt/oracle/oradata/S.F/cntrlS.F!ctl'  set log_arc?i(e_*a7_processes9'5'  set fal_client9'S.F'  set fal_ser(er9'MASTERF'  set standby_file_*anage*ent9'ACT'  set log_arc?i(e_config9'dg_config9:[email protected]='  set log_arc?i(e_dest_9'SER+;%E9MASTERF AS,%

    (alid_for9:,L;,E_LF;LE@ (alid_for9:,L;,E_LF;LE@

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    13/47

    e7ecting Me*ory Script

    Starting bacp at H2MA203Finis?ed bacp at H2MA203

    sBl state*ent1 alter syste* set spfile9''/opt/oracle/prodct/g/db_/dbs/spfileS.F!ora''

    contents of Me*ory Script1

      sBl clone alter syste* set adit_file_dest 9''/opt/oracle/ad*in/S.F/ad*p'' co**ent9 '''' scope9spfile$  sBl clone alter syste* set dispatc?ers 9'':

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    14/47

    sBl state*ent1 alter syste* set fal_client 9 ''S.F'' co**ent9 '''' scope9spfilesBl state*ent1 alter syste* set fal_ser(er 9 ''MASTERF'' co**ent9 '''' scope9spfilesBl state*ent1 alter syste* set standby_file_*anage*ent 9 ''ACT'' co**ent9 ''''scope9spfilesBl state*ent1 alter syste* set log_arc?i(e_config 9 ''dg_config9:[email protected]=''co**ent9 '''' scope9spfilesBl state*ent1 alter syste* set log_arc?i(e_dest_ 9 ''SER+;%E9MASTERF AS,%(alid_for9:,L;,E_LF;LE@ s?o6 para*eter db_reco(ery

    ,AME T

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    15/47

    allocated c?annel1 c?5c?annel c?51 S;-985 de(ice type9-;SD

    allocated c?annel1 c?sbc?annel c?sb1 S;-933 de(ice type9-;SD

    Starting -plicate -b at H2MA203

    contents of Me*ory Script1

      bacp as copy rese  file '/opt/oracle/prodct/g/db_/dbs/orap6MASTERF' a7iliary for*at'/opt/oracle/prodct/g/db_/dbs/orap6S.F' file'/opt/oracle/prodct/g/db_/dbs/spfileMASTERF!ora' a7iliary for*at'/opt/oracle/prodct/g/db_/dbs/spfileS.F!ora' $  sBl clone alter syste* set spfile9''/opt/oracle/prodct/g/db_/dbs/spfileS.F!ora''$Ke7ecting Me*ory Script

    Starting bacp at H2MA203Finis?ed bacp at H2MA203

    sBl state*ent1 alter syste* set spfile9''/opt/oracle/prodct/g/db_/dbs/spfileS.F!ora''

    contents of Me*ory Script1  sBl clone alter syste* set adit_file_dest 9''/opt/oracle/ad*in/S.F/ad*p'' co**ent9 '''' scope9spfile$  sBl clone alter syste* set dispatc?ers 9'':

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    16/47

     ''SER+;%E9MASTERF AS,% (alid_for9:,L;,E_LF;LE@

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    17/47

      s6itc? clone te*pfile all$  set ne6na*e for datafile to/opt/oracle/oradata/S.F/syste*0!dbf$  set ne6na*e for datafile 5 to/opt/oracle/oradata/S.F/sysa70!dbf$  set ne6na*e for datafile 8 to/opt/oracle/oradata/S.F/ndotbs0!dbf$  set ne6na*e for datafile 4 to/opt/oracle/oradata/S.F/sers0!dbf$  set ne6na*e for datafile # to

    /opt/oracle/oradata/S.F/e7a*ple0!dbf$  bacp as copy rese  datafile a7iliary for*at/opt/oracle/oradata/S.F/syste*0!dbf datafile5 a7iliary for*at/opt/oracle/oradata/S.F/sysa70!dbf datafile8 a7iliary for*at/opt/oracle/oradata/S.F/ndotbs0!dbf datafile4 a7iliary for*at/opt/oracle/oradata/S.F/sers0!dbf datafile# a7iliary for*at/opt/oracle/oradata/S.F/e7a*ple0!dbf $  sBl 'alter syste* arc?i(e log crrent'$K

    e7ecting Me*ory Script

    e7ecting co**and1 SET ,EN,AME

    rena*ed te*pfile to /opt/oracle/oradata/S.F/te*p0!dbf in control filee7ecting co**and1 SET ,EN,AMEe7ecting co**and1 SET ,EN,AMEe7ecting co**and1 SET ,EN,AMEe7ecting co**and1 SET ,EN,AMEe7ecting co**and1 SET ,EN,AME

    In the &ollowing with see that the datafiles are copied onto the other server directly * with no te"poraryspace re+uiredStarting bacp at H2MA203

    c?annel c?1 starting datafile copyinpt datafile file n*ber90000 na*e9/opt/oracle/oradata/MASTERF/syste*0!dbfc?annel c?51 starting datafile copyinpt datafile file n*ber900005 na"e%/opt/oracle/oradata/MASTERF/sysaux01.db$otpt file na"e%/opt/oracle/oradata/SF1/sysaux01.db$ tag9TA50030#HT50405 RE%;-90STAM

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    18/47

    sBl state*ent1 alter syste* arc?i(e log crrent

    contents of Me*ory Script1  s6itc? clone datafile all$Ke7ecting Me*ory Script

    datafile s6itc?ed to datafile copyinpt datafile copy RE%;-95 STAM

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    19/47

    )s a conse+uence o& the above state"ent* an racle process ora8dbr" is started

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    20/47

    $he alert.log on both sides give details about the log trans"ission and in&or" us o& any errors.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    21/47

    In the alert.log on the standy site the error %R)!A=>! archivelog reBected by R16% was detected0 it see"s itwas nothing to be worried about

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    22/47

    RA2G401 arc?i(elog reOected by RFS

    %ase1 An atte*pt 6as *ade to re2arc?i(e an e7isting arc?i(elog! T?is sally ?appensbecase eit?er a *ltiple pri*ary database or standby database:s= or bot? are trying toarc?i(e to t?is standby database!

    Action1 See alert log and trace file for *ore details! ,o action is necessary$ t?is is aninfor*ational state*ent pro(ided to record t?e e(ent for diagnostic prposes!

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    23/47

    ) very use&ul view on both sides is VM)4),'86$)4'(70 on ha# it in&or"s us that the process MR:> is

    doing its workC

    6

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    24/47

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    25/47

    )nother way o& checking the progress is* o& course* to create a user LL on the "aster database and his tablet8a* populate it and "ake sure that it gets propragated onto the standby.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    26/47

    )t this point we have a working data guard0 as the grid control is beco"ing "ore and "ore popular* I will

    investigate how to "anage the data guard &ro" the console* as shown in next pages

    F)'G 

    !anage a Data uard configuration with the rid

    Control

    1or this exercise I will be using the VMware Linux serversC grid!>g* which hosts the ,rid 2ontrol "anage"ent

    server* ha!* where the "aster database in a data guard couple is running* and ha#* where the standby databasehas benn created. (oth ha! and ha# are con&igured with the grid control* both having a "anage"ent agent.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    27/47

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    28/47

    ur purpose is to couple the "aster database M)6$R1 on ha! with the standby database 6(1! on ha#

    9e start setting up the data guard broker con&iguration using the grid control

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    29/47

    9e expect that we will be able to choose 6(1!* and the screenshot o&&ers indeed this option

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    30/47

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    31/47

    9e were able to connectH $he next screen is about %)dd 6tandby 'atabaseC 2on&iguration%

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    32/47

    $his was about con&iguring the dataguard broker* see the next pages &or the installation nterprise ManagerRepository.

    F)'G 

    #nstalling rid Control 1$g on Unbrea%able &inux

    '() *V!ware+

    6ee libp.so.A to resolve the depency on libp.so.A

    $his is an installation on a VMware Redhat 5.3 guest syste"0 the purpose o& this &ull exercise is using the gridcontrole to "anage the !!g 'ata ,uard con&iguration on two other VMware guest operating syste"s.

    )s there is no grid repository available* I will choose to create a database* install the M6 and install the agenton "y virtual node grid1$g.

    ven i& the M6 is local* an agent is needed. I will use the version !>.#.>.!.! to "ake "y li&e di&&icultJso"eti"es in our pro&ession as '() we are &aced by co"plex environe"entsK* and then upgrade to !>.#.>.5

    http://www.askrenzo.com/oracle/grid/installing_grid_10g.htmlhttp://www.askrenzo.com/oracle/grid/libXp_missing.htmlhttp://www.askrenzo.com/oracle/grid/libXp_missing.htmlhttp://www.askrenzo.com/oracle/grid/installing_grid_10g.html

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    33/47

    In this case* three O,-C&./0O!. will be created by the installerC one &or the database* one &or the

    "anage"ent server and one &or the agent.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    34/47

    $he database na"e and the passwords &or the privileged users are re+uired.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    35/47

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    36/47

    )s shown in the screenshot* the so&tware &or the racle nterprise Manger Repository 'atabase is &irstinstalled.

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    37/47

    6econd co"es the so&tware &or the grid console* and third the racle Manage"ent 6erver

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    38/47

    $he database is cloned using the &iles that co"e with the 2's

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    39/47

    9hile linking and con&uring the assistants* the web cache assistant gives the error libdbso(2 missing 

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    40/47

    $here is no point in continuing0 in "y case the solution was installing the rp" db11(3'3(i)34(rpm* that can bedownloaded &ro" here ProotIgrid0g t*p rp* 2i( db2!H#2H!i8HG!rp*6arning1 db2!H#2H!i8HG!rp*1 eader +8 -SA signatre1 ,DE@ ey ;- db45aG0e

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    41/47

    $he installation has co"pleted and a su""ary is o&&eredT?is infor*ation is also a(ailable at1

    /0/app/oracle/racleo*es/agent0g/sys*an/setpinfo!t7t

    See belo6 for infor*ation pertaining to yor Enterprise Manager installation1

    ! Cse t?e follo6ing CRL to access t?e Enterprise Manager 'rid (ontrol)

    *ttp)//grid10g)+,,-/e" 

    5! T?e Enterprise Manager installation incldes an racle Application Ser(er instance@6?ic? is ad*inistered sing a special ias_ad*in ser accont! T?e follo6ing infor*ation6as defalted for t?e e*bedded Application Ser(er instance1

    ;nstance ,a*e1 EnterpriseManager0!grid0gias_ad*in pass6ord1 T?is pass6ord is t?e sa*e t?e SSMA, accont!

    8! T?e connection details for t?e Enterprise Manager Repository are1

    ost1 grid0g

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    42/47

    I& everything has gone well* the console will already be available on httpC@@grid!>gC=??@e"

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    43/47

    5o start6stop the Oracle rid Console

    ,o to the o"s R)2L8-M) p6d/0/app/oracle/racleo*es/o*s0g/bin ./e"ctl stop o"sracle Enterprise Manager 0g Release 0!5!0!!0%opyrig?t :c= 33G@ 500# racle %orporation! All rig?ts reser(ed!racle Manage*ent Ser(er is -o6n! ./e"ctl start o"s

    racle Enterprise Manager 0g Release 0!5!0!!0%opyrig?t :c= 33G@ 500# racle %orporation! All rig?ts reser(ed!op*nctl1 op*n is already rnningStarting TT< Ser(er !!!Starting racle Manage*ent Ser(er !!!%?ecing racle Manage*ent Ser(er Stats !!!racle Manage*ent Ser(er is Cp!

    )s we deal with three di&&erent R)2L8-Ms* we o&ten have to switch between the three environ"entsand rede&ine the :)$-.It is there&ore an excellent idea to de&ine aliases in .pro&ile* "aking sure that the original :)$- be preserved in()68:)$-* since :)$- will be overwritten when switching environ"ents.e7port RA%LE_.ASE9/0/app/oracle

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    44/47

    e7port RA%LE_ME9/0/app/oracle/racleo*es/db0ge7port -.S_ME9/0/app/oracle/racleo*es/db0ge7port MS_ME9/0/app/oracle/racleo*es/o*s0ge7port AE,T_ME9/0/app/oracle/racleo*es/agent0ge7port RA%LE_S;-9RE

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    45/47

    7 lsnrctl statusLS,R%TL for Lin71 +ersion 0!!0!4!0 2

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    46/47

    Lets check the agentC!>ag e"ctl status agent!!! !!! !!!Agent is Rnning and Ready

    $his was about con&iguring the nterprise Manager Repository0 the agent on the data guard nodes will have to be installed* see installation o& the grid agent on a "onitored node

    F)'G.

    http://www.askrenzo.com/oracle/grid/intalling_grid_agent.htmlhttp://www.askrenzo.com/oracle/grid/intalling_grid_agent.html

  • 8/19/2019 Oracle 11g Dataguard on VWware Using Rman

    47/47