napdci28_PST1

Embed Size (px)

Citation preview

  • 8/12/2019 napdci28_PST1

    1/14

    NOTE

    Script

    prodcopy_refresh_PST1_napdci28

    Description

    #!/usr/bin/ksh This indicates that the script is for K shell

    ORASID=PST1 ORASID is a variable that this assigned witha string PST1

    . /opt/oracle/local/bin/orasidORASID

    This coand will r!n the env file and

    passing the SID threw the variableecho Prod"op $or ORASID onnapdci%& started

    This will displa" the #!oted string in the logfile

    Touch/'ar/orasta(e/prodcop/$la(s/)1*Prod"op*$or*PST1*on*napdci%&*started

    A $ero b"te file is created in the above

    location

    LoopStarted

    until + ,date -0, 2(t %3)) 2o2$/'ar/orasta(e/prodcop/$la(s/)%*4O5Ds*backup*co6pleted*success$ull 7

    %ntil is a condition based loop it will &eep onchec&ing the specified condition in braces' if

    an" of the condition is satisfied it will enter

    into the bod" of the loop

    `date +'%%!'` "#t 2$ ( )ere fro date

    we are ta&ing )o!rs and *in!tes andconcatenating the and chec&ing that it is

    grate than+,gt- ./00 hrs or not

    "o &or

    "f& it will chec& for the flag

    +0.2O3Dsbac&!pcopleteds!ccessf!ll"- is there or not in the specified location

    Note&Tr" !ntil 11p +./00 ho!rs-4 If

    2O3D5s bac&!p isn5t done b" then' we won5tbe refreshing tonight444

    do In the above two conditions if an" of the

    condition is satisfied it will enter into the

    bod" of the loop

    s8lplus 2sr6an*6onitorin(/r6an*6onitorin(9R))19/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl 4O5D S:"";SS

    connecting as ranonitoring to the s#l forR001 database+now R116S- and e7ec!ting th

    ch_d(1)s* script which need twoparaeters as inp!t

    SID and STAT%S

    The script will create a file ch_d()st

  • 8/12/2019 napdci28_PST1

    2/14

    cp/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl.lst/'ar/orasta(e/prodcop/r6an*scripts

    /chk*dbl*R))1.lst

    8ow we are cop"ing the ch_d()stfile to

    ch_d(1_,1)st

    s8lplus 2sr6an*6onitorin(/r6an*6onitorin(94O5D9/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl 4O5D D;

    connecting as ranonitoring to the s#l for

    2O3D database and e7ec!ting the

    ch_d(1)s* script which need twoparaeters as inp!t

    SID and STAT%Scp/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl.lst/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl*4O5D.lst

    8ow we are cop"ing the ch_d()stfile to

    ch_d(1_-OLD)st

    .1/ ifopen

    i$ + ,(rep START/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl*R))1.lst, = START 2a,(rep START/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl*4O5D.lst, = START 7

    )ere it is chec&ing for the word ST0,T inboth ch&db1R0014lst' ch&db12O3D4lst

    and coparing if both are e#!al to ST0,Tthen the if condition is tr!e below steps are

    e7ec!ted

    then if condition is Tr!eecho 4O5Ds backup co6pletedsuccess$ull? @e can start no@...

    Dispal"s the #!oted string into the log file

    touch/'ar/orasta(e/prodcop/$la(s/)%*4O5

    Ds*backup*co6pleted*success$ull

    A $ero b"te file created in the abovelocation+2_-OLDs_(ac3p_co4peted_s3

    ccessf3y-cat/de'/null/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl*R))1.lst

    cat/de'/null/'ar/orasta(e/prodcop/r6an*scripts/chk*dbl*4O5D.lst

    The two stateents will n!llifies the

    ch&dblR0014lst' ch&dbl2O3D4lst+the tw

    files are ept" now-

    .2/ if

    open

    i$ + ,ps 2e$ B (rep ORASID B (rep2' (rep B (rep tnslsnr B (rep1).%.), != 7

    chec&ing weather the listener is !p or not'

    then if condition is Tr!eecho ORASIDs Database listener

    @as up 'eri$iedDispal"s the #!oted string in the log file

    touch/'ar/orasta(e/prodcop/$la(s/)3*Database*listener*@as*up*'eri$ied

    A $ero b"te file is created in the above

    location+$_Data(ase_istener_5as_3p_6erified-

  • 8/12/2019 napdci28_PST1

    3/14

    ;lseif condition is 9alse

    echo ORASIDs Database listener@as not up. ORASID @as notre$reshed

    Dispal"s the #!oted string in the log file

    touch/'ar/orasta(e/prodcop/$la(s/)C*Database*listener*@as*>OT*up

    A $ero b"te file is created in the abovelocation

    echo . B 6ail 2s Prod"opEORASIDs Database listener @as >OTup. ORASID @as not re$resheddba*6id196attel.co6Fdba*6id%96attel.co6

    It will send ail to dbaid1' dbaid.

    sa"ing that the database listener of PST1 isnot !p

    PST1 was not refreshed

    ;it :oes o!t of the refresh script

    .2/ if

    END

    $i 6nd of the if condition

    Note

  • 8/12/2019 napdci28_PST1

    4/14

    .$/ if End

    /'ar/orasta(e/prodcop/$la(s/)J*Apps*ser'ices*on*the*Ad6in*"onc*tier*ha'e*been*shutdo@n

    i

    _0pps_ser6ices_on_the_0d4in_9onc_ier_ha6e_(een_sh3tdo5n

    6nd of the if condition

    Note

  • 8/12/2019 napdci28_PST1

    5/14

    NOTE

    t%*o$*the*r6an*duplicate*co66and*created

  • 8/12/2019 napdci28_PST1

    6/14

    run*r6an ORASID 9irst it chec&s weather the database is !p or

    down'if it is !p the it will e7it the rand!plicate4

    If it is confirs the db is down oves to ne7t

    step

    8ow it will e7ec!te the clearfiles"ste4shscript to reove all previo!s data

    After clearing it will bring the database !p innoo!nt state

    Then it will prepare the rand!plicate script

    b" ta&ing the inforation fro different files

    And invo&es the raan to r!n it

    8ow it chec&s weather the ran d!plicate wa

    s!ccessf!l or notIf s!ccess we get a ail as R*A8d!plicate

    was s!ccess

    If failed we get a ail as R*A8 d!plicate

    was 8OT s!ccessf!l

    Then reoves ran log files ore than /0

    da"s and also ranconnect file4as this file

    contains all gold and a!7iliar" connection

    strings

    ./ if

    Open

    i$ + ! 2$/'ar/orasta(e/prodcop/$la(s/)L*RA

    >*duplicate*@as*success$ul 7

    :hec&ing for the file

    ?_,!0N_d3picate_5as_s3ccessf3

    ThenIf the file is not there then proceed +here weare confired that rand!plicate was not

    s!ccessf!l-

    NOTE I$ it @asnt success$ul the $irstti6eF @ait 3) 6inutes G1&))secondsH and tr a(ain

    echo Maitin( 3) 6inutes be$oretrin( the RA> duplicate a(ain

    Displa"s the #!oted string in the log file

    echo . B 6ail 2s Prod"opEMaitin( 3) 6inutes be$ore trin(the RA> duplicate a(ain

    dba*6id196attel.co6Fdba*6id%96attel.co6

    dbaid1' dbaid. will get a ail that 5aitin# $ 4in3tes (efore tryin# the

    ,!0N d3picate a#ain

    sleep 1&))8ow the script will not ove for the ne7t

    steps till 1

  • 8/12/2019 napdci28_PST1

    7/14

    Note

    >*duplicate*@as*>OT*success$ul

    duplicate a(ain

    echo Retrin( the RA> duplicate Displa"es the #!oted string in the log file

    touch/'ar/orasta(e/prodcop/$la(s/11*Retrin(*the*RA>*duplicate

    A $ero b"te file is created at the location as11_,etryin#_the_,!0N_d3picate

    /'ar/orasta(e/prodcop/r6an*scripts/run*r6an ORASID

    Again r!nning the script r4an_r3n e7plained

    above

    NoteMere @e an6ore success$ul thesecond ti6e aroundN

    Cf.7/ open i$ + ! 2$/'ar/orasta(e/prodcop/$la(s/)L*RA

    >*duplicate*@as*success$ul 7

    If the file?_,!0N_d3picate_5as_s3ccessf3 there

    in the flags Director"

    Then If "es

    Note RA> duplicate didnt @ork a(ain solets tr the last success$ul

    backupecho RA> duplicate $ailed a(ain.Trin( the last success$ul backup

    Displa"es the #!oted string in the log file

    echo . B 6ail 2s Prod"opE RA>duplicate $ailed a(ain. Trin( thelast success$ul backupdba*6id196attel.co6Fdba*6id%96attel.co6

    Send a ail to D=A*ID1' D=A*ID.

    Prodcop"( R*A8 d!plicate failed again4Tr"ing the last s!ssessf!l bac&!p

    Note

  • 8/12/2019 napdci28_PST1

    8/14

    /'ar/orasta(e/prodcop/db*scripts/shutdo@n*i66ediate ORASID

    This will e7ec!te the scriptsh3tdo5n_i44ediate and we provide sid asinp!t and then it will sh!t down the database

    as sh3t i44ediateecho Database brou(ht do@n... eta(ain

    Displa"es the #!oted string in the log file

    touch/'ar/orasta(e/prodcop/$la(s/)&*Database*brou(ht*do@n

    A file 8_Data(ase_(ro3#ht_do5n is

    created in flags director"

    Note Tr the RA> duplicate one lastti6e

    echo Retrin( the RA> duplicateone last ti6e

    Displa"es the #!oted string in the log file

    touch/'ar/orasta(e/prodcop/$la(s/1%*Ret

    rin(*the*RA>*duplicate*one*last*ti6e

    A $ero b"te file is created at the location as12_,etryin#_the_,!0N_d3picate_one_

    ast_ti4e

    /'ar/orasta(e/prodcop/r6an*scripts/run*r6an*last*run ORASID

    Again r!nning the script r4an_r3n e7plained

    above

    Note I$ this one didnt @ork...

    Cf.F/ open i$ + ! 2$/'ar/orasta(e/prodcop/$la(s/13*RA

    >*duplicate*o$*the*last*run*@as*success$ul 7

    :hec&ing If the file

    1$_,!0N_d3picate_of_the_ast_r3n_5as

    _s3ccessf3there in the flags Director"

    then

    /usr/bin/6'/'ar/orasta(e/prodcop/$la(s//'ar/orasta(e/prodcop/$la(s*$ro6*last*run

    )ere it is oving the all files fro fa#s

    director" to fa#s_fro4_ast_r3n

    Cf.8/ open i$ + ,ls/'ar/orasta(e/prodcop/$la(sB@c 2l,2ne ) 7

    :hec&ing if there are an" ore files in the

    fa#s director" is left

    then If "es+if an" files in flag dir-echo Mas not able to clean up the$la(s director Displa">s the #!oted string in log fileecho . B 6ail 2s Prod"opE Masnot able to clean up the $la(sdirectordba*6id196attel.co6Fdba*6id%96attel.co6

    Send the #!oted string as ail to

    D=A*ID1'D=A*ID.

    Cf.8/ cose $i 6nd of the if

    Note # Me 8uit

  • 8/12/2019 napdci28_PST1

    9/14

    eit %ntil loop closed

    Cf.F/cose $i 6nd of the if

    Cf.7/cose $i 6nd of the if

    Cf./ cos $i 6nd of the if

    NOTE Restart the database innoarchi'elo( 6ode

    /'ar/orasta(e/prodcop/db*scripts/startup*noarchi'elo( ORASID

    The script first start the database in 4o3ntstate and p!t he database in noarchi6eo#

    ode then &eeping the database in openod

    and a&ing the pass5ord 6erify para4eter

    to n!ll

    NOTE Run the Database cleanup scripts

    /'ar/orasta(e/prodcop/db*scripts/cleanup ORASID

    9irst it will r!n the password

    reset_orace_pass5ds)s*

    +s"s's"ste'ar&view'#v'sabri7- then in

    create the teporar" table spaceNOTE Reset the Apps pass@ords

    APP54R=,/opt/oracle/local/bin/db*check ORASID ATOP,

    Dbchec& script is provided with sid and atop

    as inp!t +ORASID;PST1- res!lts in apppstas o!tp!t for 0PPL!-,

    ssh 2l APP54R ,hostna6e,/'ar/orasta(e/prodcop/$ndcpass/reset*apps*pass@ds ORASID

    ,eset_apps_pass5dswill change all the app

    passwords which covers all the apps

    passwords

    NOTE I$ rsnc is runnin(F @e need to@ait $or it to co6plete Gbut not6ore than C hours = 1CC)) secondsH

    inte(er ti6er=) Initiali$ing the ti4er variable to 0

    HNTCL

    Loop

    start

    until + ti6er 2(t 1CC)) 2o 2$/'ar/orasta(e/prodcop/$la(s/C1*Ad6in*"onc*ser'ices*started 7

    Starting the !ntil loop

    6nter the bod" of the loop onl" if the ti4ergrate than 1??00 or if the we find the file

    @1_0d4in_9onc_ser6ices_started in flag

    location

    Do If above condition is tr!e

    C;.1/ i$ + 2$/'ar/orasta(e/prodcop/$la(s/)*Rsnc*o$*the*PST1*APP5*TOP*on*napdci%&

    *has*started 2a ! 2$/'ar/orasta(e/prodcop/$la(s/1*Rsnc*o$*the*PST1*APP5*TOP*on*napdci%&

    *has*co6pleted 7

    It is chec&ing for two conditions if both are

    satisfied then onl" enters the bod"

    :hec&ing for the file

    7_,sync_of_the_PST1_0PPL_TOP_on_n

    apdci28_has_started to be in flag locationand chec&ing for the file

    71_,sync_of_the_PST1_0PPL_TOP_on_n

    apdci28_has_co4peted not to be in the

    location

  • 8/12/2019 napdci28_PST1

    10/14

    then If above condition is tr!eecho Rsnc is still runnin(... Thecurrent ti6e is ,date,

    Displa" the #!oted string in log file along

    with date

    NOTE Mait a 6inute G) secondsH be$orecheckin( a(ain

    sleep )ti6er=ti6er-) Sleep @0 ; it will wait for @0 seconds+dosentperfor an" thing-

    Tier;variable is added with a val!e @0

    8ow after this coand again the control

    oves to !ntil loop and chec&s for the tierval!e enters the bod"+as !ntil has . condition

    if an" one is tr!e enters the bod"- see C;.1/

    chec&s the sae thing the loop will contin!e

    !ntil the ti4er val!e is 1??00 or if the C;.1/

    condition fails+it fails when it will find the

    flag

    71_,sync_of_the_PST1_0PPL_TOP_on_napdci28_has_co4peted-

    ;lse If the conditions is failed

    NOTE Run the Apps Ad6in/"onc tiercleanup scripts/'ar/orasta(e/prodcop/apps*scripts/cleanup*apps*ad6in*conc ORASID

    The script cean3p_apps_ad4in_concdosethe below things

    Terinate all phanto r!nning obs and

    cancel all pending obs

    %pdate the 98D Service :oponent

    Paraeter Bal!es

    %pdate iPa"ent %R3s

    %pdate *ar&view preferences

    %pdate Cor&flow eail addresses

    %pdate the 98D profile option val!es

    %pdate Bista environent settings

    Tr!ncate the 98D3O2I8S and

    98D%8S%::6SS9%33O2I8S tables

    %pdate the distrib!tion eail addresses for

    10 #!eries

  • 8/12/2019 napdci28_PST1

    11/14

    %pdate the Distrib!tion point addresses for*attel Organi$ation Roles

    %pdate the :onc!rrent E!e!e Si$e ini!

    processes

    Restart the SE3F9low *anager D=*S ob

    Point sabri7 data so!rce to proper location

    :hec& the SE3FPl!s o!tp!t files +F4lst- forGORA,G errors

    2A2$ to $7 a 4entioned n34(er ran#e

    fa#s are created in fa# ocation

    NOTE 5et the Meb/or6s tier kno@ it canstart its Apps ser'icesecho Ad6in/"onc tier cleanupco6pleted

    Displa"s the #!oted string in log file

    touch/'ar/orasta(e/prodcop/$la(s/C)*Ad6in*"onc*tier*cleanup*co6pleted

    A $ero b"te

    file+@_0d4in_9onc_tier_cean3p_co4pe

    ed-is created at flag location

    NOTE Startup the Apps ser'ices on theAd6in/"onc tierAPP54R=,/opt/oracle/local/bin/db*c

    heck ORASID ATOP,2ets the app4#r!ser+apppst1-

    ssh 2l APP54R ,hostna6e,/'ar/orasta(e/prodcop/apps*scripts/startup*apps*ad6in*conc ORASID

    :onnecting as applpst1 !ser to the napdci.