data guard broker

Upload: printesh-patel

Post on 02-Jun-2018

229 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/11/2019 Data Guard Broker

    1/14

    Data Guard Broker

    The broker is part of Oracle's Database Enterprise Manager and an integral part of Data Guard, it is themanagement framework. ou can of course use !"#$%lus to manage Data Guard but the broker when usedwith the Enterprise Manager becomes a powerful tool o&ering the following

    on(guration Monitoring

    )lerting

    %erformance )nal*sis

    Manual switcho+er's

    )utomatic switcho+er's

    Before discuss the integration of the broker into the Enterprise Manager lets (rst discuss the broker itself.The broker can make changes to a Data Guard setup -ph*sical or logical database, the t*pe of changesare con(guration, transport modes, appl* setup and role change ser+ices and the protection mode. oucan also monitor the health of an* con(guration, it is also responsible for implementing and managing theautomatic failo+er capabilit* also know as /ast0!tart /ailo+er -/!/O.

    The broker has three parts, a set of background processes on each database, a set of con(guration (lesand a commandline interface -# called DGMG1#.

    The broker has a number of processes running, the broker manages these processes automaticall* *ouha+e no control o+er them

    Data Guard Monitor (DMON)0 this is the main process and is responsible for coordinating allbroker actions as well as maintaining the con(guration (les, this process is enabled or disabled withthe DG2B1O3E12!T)1T parameter

    Broker Resource Manager (RSM)0 is responsible for handling an* !"# commands used b* thebroker that need to be e4ecuted on one of the databases in the con(guration. These !"#

    commands are made as a result of a change to the con(guration made through DGMG1# or are thecon(guration commands e4ecuted b* the broker during the database startup Data Guard Net Server (NSVn)0 from 5 to ncan e4ist, the* are responsible for making contact

    with the remote databases and sending across an* work items to the remote database. DRCn0 these network recei+er processes establish the connection from the source database 6!7n

    process, this is a similar connection to the #og8riter 6etwork !er+ice -#6! to a 1emote /ile !er+er-1/! connection for redo transport. 8hen the broker needs to send something -data or !"#between databases it uses this 6!7 to D1 connection, these connection are started as needed.

    Confguration fles0 the con(guration is stored in two binar* command (les. The (les contain thecomplete con(guration setup, the database states, how to connect to each one and whatparameters to setup when each database starts up.

    n a broker con(guration it is the Data Guard Monitor -DMO6 process on the primar* database that is the

    owner of the con(guration, all orders will come from the primar* e+en if use a DGMG1# # from anotherser+er, the standb* database will recei+e all con(guration changes +ia the primar*.

  • 8/11/2019 Data Guard Broker

    2/14

    8hen the DMO6 process communicates with the standb* database it uses one of the 6!7 processes to

    send the work to the standb*, this protects the DMO6 from a hang if the network should go down.8hene+er the DMO6 needs to e4ecute some !"# it will enlist the aid of the 1!M process on the primar*database, if the !"# is for the primar* database it will e4ecute it directl*, howe+er if the !"# is for astandb* database the 1!M process asks the 6!7 process to send it to the standb* database again thisprotects the 1!M from a network hang.

    Each 6!7 process has a D1 partner process on the standb* database, which will perform the work of the6!7 process, the D1 process on the standb* will return the results or status back to the 6!7 on theprimar*.

    On startup the DMO6 will communicate with each standb* +ia the 6!70D1 connection process pair toestablish communication and con(guration information so that the standb* can start the appl* ser+ices, ifthere are an* problems check the alert.log after the 67! section to see if the are an* T6! errors.

    8hen using a 1) en+ironment there are another set of process called the internode ser+ers -6!7 whichmaintain a connection between the nodes in the cluster to ensure that the broker on each node knows thestate of the cluster. ) 6!7 process will alwa*s be started on the primar* e+en if the primar* is not in a1).

    #astl* *ou ma* see one more process called the /ast0!tart0/ailo+er %rocess -/!/%, which is used onl* whenthe primar* database is under the control of Data Guard automatic failo+er feature /ast0!tart /ailo+er. 8ewill be discussing /!/% in another section switcho+er and failo+er.

    Confguration Files

    Each database has two copies of the con(guration, stored in the below parameter locations

    DG2B1O3E12O6/G2/#E5

    DG2B1O3E12O6/G2/#E9

    B* default the* are stored in :O1)#E2;OME6">E26)ME?.dat and dr9=DB2>6">E26)ME?.dat, if using a 1) these should be keep on ashared location as onl* one set of copies can be e4ist for the entire 1).

    http://www.datadisk.co.uk/html_docs/oracle_dg/switchover_failover.htmhttp://www.datadisk.co.uk/html_docs/oracle_dg/switchover_failover.htm
  • 8/11/2019 Data Guard Broker

    3/14

    The primar* has the master copies of the con(guration (les, all changes to these (les are done b* theprimar*, e+en if *ou are on the standb* ser+er the con(guration changes will be passed to the primar* +ia6!70D1 processes and the DMO6 process will make the change which is then propagated back to thestandb* databases. The reason for the multiple copies of the con(guration (le is if the primar* has aproblem then each standb* database has a cop*, when a failo+er occurs the standb* that becomes theprimar* will then become the master of those con(guration (les.

    Broker

    ou ha+e two choices to interact with Data Guard either Enterprise Manager -EM or the broker #DGMG1# *ou can swap between the two with a few simple con(guration changes. To gain full fullfunctionalit* of Data Guard through Grid ontrol *ou must use the broker.

    Broker # DGMG1# comes with Enterprise Manager, *ou can run the broker on an* platform *ou wish itdoes not need to be the same platform as the primar* or standb* databases.

    ou can access the DGMG1# command line using the below

    DGMG1# #@primarg*dgA5 ? dgmgrl s*s

  • 8/11/2019 Data Guard Broker

    4/14

    Once the director* has been created *ou are read* to startup the broker, do this on all databases -primar*and standb*

    !tart the Broker alter s*stem set DG2B1O3E12!T)1TT1>E !O%EBOT;F

    8hen *ou start the broker it does not con(gure an* (les *et because *ou ha+e to use the DGMG1#command, all it does is start the necessar* processes we mentioned earlier. f *ou need to change thelocation of the (les the steps are below

    5. stop the broker using the DG2B1O3E12!T)1T parameter b* setting this to false -on all nodes in thecluster

    9. change the DG (le destination parametersI. cop* the (les to the new locationJ. then re0start the broker, again set the DG2B1O3E12!T)1T parameter to true -on all nodes in the

    cluster

    The broker uses the Oracle 6et !er+ices to make connections to the databases, setup both redo transportand archi+e gap resolution and perform role transitions. 8e need to create a special static entr* in the

    listener.ora (le for each database in the broker con(guration, this entr* makes it possible for the broker toconnect to an idle instance using a remote !!DB) connection and perform the necessar* startup. ;ere isan e4ample

    Broker listener.orastatic entr*

    %rimar* and all standb* databases

    !D2#!T2#!TE6E1 -!D2#!T -!D2DE! -G#OB)#2DB6)ME %1OD5D12DGMG1#-O1)#E2;OME

  • 8/11/2019 Data Guard Broker

    5/14

    There are four main area's to DGMG1# #

    onnection and ;elp 0 connect, help and e4it

    reation and Editing 0 create, add, enable, edit and con+ert

    Monitoring 0 show

    1ole Transition 0 switcho+er, failo+er and reinstate

    f *ou used the Enterprise Managerser Methodthen *ou need to followthe ne4t steps to con(gure the broker.

    The (rst step is to create the base con(guration

    reate base

    con(guration

    %rimar* Database ser+er

    DGMG1#? connect s*s

  • 8/11/2019 Data Guard Broker

    6/14

    DatabasesHprod5 0 %rimar* databaseprod5dr 0 %h*sical standb* databaseprod5lr 0 #ogical standb* database

    /ast0!tart /ailo+erH D!)B#E

    on(guration !tatusH!>E!!

    6e4t we add the standb* database to the con(guration, if *ou recei+e an error stating that the propertiescould not be imported from the database, *ou need to check DB2>6">E26)ME also the T6!6)ME and thetransport parameter -#OG2)1;7E2DE!T2n, so what is the proper setup, *ou must ha+e *our redotransport parameter de(ned using the DB2>6">E26)ME method, meaning that each redo transportparameter must contain the DB2>6">E26)ME=name? attribute. The broker will search all of *our#OG2)1;7E2DE!T2n parameters looking for a database with a uniLue name that matches the databasename *ou entered for the command. f *ou ha+e not done this then *ou need to use the full set of

    arguments to add the database

    )dd the standb*database

    %rimar* Database ser+er 0 if *ou ha+e setup db2uniLue2name, tnsname andlog2archi+e2dest2n

    DGMG1#? connect s*s

  • 8/11/2019 Data Guard Broker

    7/14

    on(guration 0 prod5

    %rotection ModeH Ma4%erformanceDatabasesHprod5 0 %rimar* databaseprod5dr 0 %h*sical standb* database

    /ast0!tart /ailo+erH D!)B#ED

    on(guration !tatusHD!)B#ED

    Because we ha+e not setup an* parameters for Broker all parameters defaults will bepresumed, some parameters are set b* e4amining the database others are Broker default +alues.

    DGMGRL s'o$ data%ase ver%ose #rod&

    Database 0 prod5

    1oleH %1M)1ntended !tateH O//#6Enstance-sH%1OD5

    %ropertiesHDGonnectdenti(er 'prod5'Obser+eronnectdenti(er ''#ogptMode ')!6'Dela*Mins 'A'

    Binding 'optional'Ma4/ailure 'A'Ma4onnections '5'1eopen!ecs 'IAA'6etTimeout 'IA'1edoompression 'D!)B#E'#og!hipping 'O6'%referred)ppl*nstance '')ppl*nstanceTimeout 'A')ppl*%arallel ')>TO'!tandb*/ileManagement ')>TO')rchi+e#agTarget 'A'#og)rchi+eMa4%rocesses 'J'

    #og)rchi+eMin!ucceedDest '5'Db/ile6ameon+ert ''#og/ile6ameon+ert ''/ast!tart/ailo+erTarget ''!tatus1eport '-monitor'nconsistent%roperties '-monitor'nconsistent#ogpt%rops '-monitor'!end"Entries '-monitor'#ogpt!tatus '-monitor'

  • 8/11/2019 Data Guard Broker

    8/14

    1ec+"Entries '-monitor';ost6ame 'primar*dgA5'!id6ame '%1OD5'!taticonnectdenti(er '-DE!1%TO6-)DD1E!!-%1OTOO#tcp-;O!Tprimar*dgA5-%O1T5N95-O66ET2D)T)-!E17E26)ME%1OD52DGMG1#-6!T)6E26)ME%1OD5

    -!E17E1DED)TED'!tandb*)rchi+e#ocation '>!E2DB21EO7E12/#E2DE!T')lternate#ocation ''#og)rchi+eTrace 'A'#og)rchi+e/ormat 't2s2r.dbf'

    Top8aitE+ents '-monitor'

    Database !tatusHD!)B#ED

    DGMGRL s'o$ data%ase ver%ose #rod&dr

    Database 0 prod5dr

    1oleH %;!)# !T)6DBntended !tateH O//#6E

    Transport #agH -unknown)ppl* #agH -unknown1eal Time "uer*H O//nstance-sH%1OD5D1

    %ropertiesHDGonnectdenti(er 'prod5dr'Obser+eronnectdenti(er ''

    #ogptMode ')!6'Dela*Mins 'A'Binding 'O%TO6)#'Ma4/ailure 'A'Ma4onnections '5'1eopen!ecs 'IAA'6etTimeout 'IA'1edoompression 'D!)B#E'#og!hipping 'O6'%referred)ppl*nstance '')ppl*nstanceTimeout 'A')ppl*%arallel ')>TO'!tandb*/ileManagement ')>TO'

    )rchi+e#agTarget 'A'#og)rchi+eMa4%rocesses 'J'#og)rchi+eMin!ucceedDest '5'Db/ile6ameon+ert ''#og/ile6ameon+ert ''/ast!tart/ailo+erTarget ''!tatus1eport '-monitor'nconsistent%roperties '-monitor'nconsistent#ogpt%rops '-monitor'

  • 8/11/2019 Data Guard Broker

    9/14

    !end"Entries '-monitor'#ogpt!tatus '-monitor'1ec+"Entries '-monitor';ost6ame 'ph*sicaldgA5'!id6ame '%1OD5D1'

    !taticonnectdenti(er '-DE!1%TO6-)DD1E!!-%1OTOO#tcp-;O!Tph*sicaldgA5-%O1T5N95-O66ET2D)T)-!E17E26)ME%1OD5D12DGMG1#-6!T)6E26)ME%1OD5D1-!E17E1DED)TED'!tandb*)rchi+e#ocation '>!E2DB21EO7E12/#E2DE!T')lternate#ocation ''#og)rchi+eTrace 'A'#og)rchi+e/ormat 't2s2r.dbf'

    Top8aitE+ents '-monitor'

    Database !tatusHD!)B#ED

    One parameter to watch for is the local archi+ing parameter on the primar* and standb* databases, thebroker will modif* this parameter and if necessar* add the 7)#D2/O1 attribute in preparation for thearchi+al of *our standb* redo log (les.

    One area to watch is if *ou add an additional standb* database, the broker could presume the wrongparameter +alues, for instance *ou ma* want one standb* to use !6 and another to use )!6, but if*ou con(gure the second standb* database using the short method it ma* default to !6, so when *oudo add an* additional standb* databases alwa*s double check the parameters are set correctl* for thet*pe of con(guration that *ou want, an* changes should be done before enabling the additional standb*database.

    Once we are happ* that all standb* databases ha+e been added and their parameters ha+e been check weare read* to enable the con(guration, the command will issue alter systemcommands on both the primar*

    and standb* databases, start the redo transport to the standb* databases and the appl* ser+ices, beforee4amining the con(guration gi+e it sometime to complete as it does take a while, otherwise *ou see someO1)05PP5A errors.

    Enabling thecon(guration

    %rimar* Database ser+er

    DGMG1#? connect s*s

  • 8/11/2019 Data Guard Broker

    10/14

    on(guration 0 prod5

    %rotection ModeH Ma4%erformanceDatabasesHprod5 0 %rimar* databaseprod5dr 0 %h*sical standb* database

    /ast0!tart /ailo+erH D!)B#ED

    on(guration !tatusH!>E!!

    !tandb* database 0 check the #G81 0 1/! connection process and theM1%A is in the appl*ing state

    sLl? select client2process, process, thread, seLuence, status from+:managed2standb*F

    Broker ro#erties

    )s mentioned abo+e the broker has a number of properties which can be changed, to change thepropert* we use the EDT command in the DGMG1# #

    Edit con(gurationEDT O6/G>1)TO6 !ET %1O%E1T =name?=+alue?EDT D)T)B)!E =db2name? !ET %1O%E1T =name?=+alue?EDT 6!T)6E =in2name? !ET %1O%E1T =name?+alue?

    Confguration ro#erties

    B!standersFollo$RoleC'ang

    eFastStartFailover*utoReinstate

    FastStartFailoverLagLi+it

    FastStartFailover+!S'utdo$n

    FastStartFailover,'res'old

    Co++unication,i+eoutthe amount of time the broker will wait for a response before gi+ing up-default 5QA seconds, *ou can remo+e an* timeout b* setting this to A

    Data%ase ro#erties

    FastStartFailover,arget

    O%serverConnect-dentifer

    *##l!-nstance,i+eoutde(nes how long the broker should wait until mo+ing the appl* process toanother instance in a standb* 1), default is A when means immediatel*

    re.erred*##l!-nstanceallows *ou to tell the broker where *ou would like the appl* to run when*ou ha+e a 1), b* default it is empt* which means it can choose an*instance

    *rc'iveLag,arget alters database parameterH )1;7E2#)G2T)1GET

  • 8/11/2019 Data Guard Broker

    11/14

    D%FileNa+eConvert alters database parameterH DB2/#E26)ME2O67E1T

    Log*rc'iveMa/rocesses alters database parameterH #OG2)1;7E2M)2%1OE!!E!

    Log*rc'iveMinSuccessDest alters database parameterH #OG2)1;7E262!>EED2DE!T

    LogFileNa+eConvert alters database parameterH #OG2/#E26)ME2O67E1T

    LogS'i##ing(stand%! role onl!)

    enables or defers redo transport to that standb* database.

    alters database parameterH #OG2)1;7E2DE!T2!T)TE2n

    Stand%!FileManage+ent(stand%! role onl!)

    alters database parameterH !T)6DB2/#E2M)6)GEME6T

    -nstance ro#erties

    0ostNa+e 6o e4plaination needed here

    SidNa+e 6o e4plaination needed here

    Log*rc'ive,race alters database parameterH #OG2)1;7E2T1)E

    Log*rc'iveFor+at alters database parameterH #OG2)1;7E2/O1M)T

    Stand%!*rc'iveLocation alters database parameterH #OG2)1;7E2DE!T2n

    *lternateLocation alters database parameterH #OG2)1;7E2DE!T2n

    Ls%!Ma/Sga alters database parameterH M)2!G)

    Ls%!Ma/Servers alters database parameterH M)2!E17E1!

    Broker State and Monitoring

    There are a number of commands that *ou can use to change the state of the database

    turn o&

  • 8/11/2019 Data Guard Broker

    12/14

    database

    DGMG1#? show database prod5FDGMG1#? show database prod5drF

    There are a number of speci(c information commands, here are the most usedDGMG1#? show database prod5 statusreportFDGMG1#? show database prod5 inconsistent%ropertiesF

    DGMG1#? show database prod5 inconsistentlog4pt%ropsFDGMG1#? show database prod5 log4ptstatusFDGMG1#? show database prod5 latestlogF

    #og(les

    change the instance name to reSect the one *ou ha+e choosen

    prod5 -alert logH

  • 8/11/2019 Data Guard Broker

    13/14

    IA. Generate s*nta4 to duplicate standb* database from acti+e database 4. E4it 0000000000000000000000000000000000000000000000000000000000000000000000000 Enter Task 6umberH

    0000000000000000000000000000000000000000000000000000000000000000000000000 #ogical !tandb* Data Guard heck #ist 0 primar*dgA5 5. heck #ogical %rogress 0 7iew O+erall %rogress Of !"# )ppl* 9. heck #ogical E+ents 0 ;istor* on #ogical !tandb* )ppl* )cti+it* I. heck #ogical E+ents 0 Detailed 7iew J. heck #ogical !tats 0 #ogical !tandb* !tats N. heck #ogical %arameters 0 #ogical !tandb* %arameters P. #ook )t 8hat The #ogical !tandb* %rocesses )re Doing oordinator, 1eader, Builder, %reparer, )nal*Rer, )pplier ... . #ook )t The !tatus odes /or The #ogical !tandb* %rocesses Q. #ook )t E+ents The )pplier %rocess s !tuck On

    0000000000000000000000000000000000000000000000000000000000000000000000000 5A. heck the #1 0 #ook )t B*tes %aged Out 55. Generate !*nta4 To !kip Transactions Based On M)-E7E6T2TME /1OM DB)2#OG!TDB2E7E6T! DO 6OT !3% DM# !T)TEME6T! 59. Diagnostic !cript %er Metalink 6ote DH 9J5N59.5 #ook for output in logical2diag2@O1)#E2!D2MO6DD2;;MM.out format 0000000000000000000000000000000000000000000000000000000000000000000000000 9A. 1e+iew 8hat s 6OT !upported n our #ogical !tandb* Database 95. 1e+iew Tables That Do 6OT ha+e >niLue denti(ers 99. heck %rimar* Database /or !upplemental #ogging 0000000000000000000000000000000000000000000000000000000000000000000000000

    IA. !tart #ogical !tandb* Database JA. !top #ogical !tandb* Database 0 %#E)!E BE )1E/># WWWWW T;! 8## !TO% T;E #OG)# !T)6DB )%%# %1OE!! 0000000000000000000000000000000000000000000000000000000000000000000000000 4. E4it 0000000000000000000000000000000000000000000000000000000000000000000000000 Enter Task 6umberH

    Re+oving t'e Broker

    /inall* if *ou wish remo+e the broker follow the steps below

    1emo+e the broker 5. onnect to the primar* database using DGMG1#9. run in dgmgrl Kremo+e con(guration perser+e destinationsKI. onnect to the primar* using !"#%#>!J. using !"# set the parameter Kdg2broker2startfalseKN. then run Kalter s*stem set dg2broker2startfalseKP. repeat steps J and N for all the standb* databases. repeat step 9 for all the standb* databases

  • 8/11/2019 Data Guard Broker

    14/14

    Q. remo+e the two broker con(guration (les for all databases