Upload
somen-dey
View
215
Download
0
Embed Size (px)
Citation preview
8/2/2019 Journal Ing 1
1/9
Theinsandoutsofjournaling
--PartI
Whatjournalingisandhowitworks
Journaling,generallyspeaking,isaprocessofrecordingactivity.
Inaccounting,itistheprocessofrecordingfinancialactivity--moniesinandmoniesout.
OntheiSeries,journalingreferstotheprocessofrecordingobjectactivity.
JournalingontheiSeriestypicallyinvolvestherecordingoftheactivityrelatedtofiles,namely,physicalfiles.
Whenafileisbeingjournaled,activitysuchasfile-opens,file-closesanddataupdatesarerecorded.
Forexample,whenaprogramwritesoutanewrecordorupdatesanexistingone,
thesystemmakesanentryintheassociatedjournal.Theentrycontainssuchinformationasthejobnameandprogramnamethatmadethechange(s)tothefile,aswellasacopyoftherecordthatwaschanged.
(Note:Journalingcanbeconfiguredtorecordacopyoftherecordbeforeitischangedand/ortorecordacopyoftherecordafteritischanged.)
Howtosetupjournalinginthreeeasy
steps
1.
Createoneormorejournalreceivers.UsetheCreateJournalReceiver(CRTJRNRCV)commandtocreateajournalreceiver.
Thinkofthejournalasanotebookbinderandthejournalreceiverasthepages(i.e.,thenotebookpaperwhereinformationiswritten).
Thejournalreceiveriswherethejournalentriesareactuallyrecorded.
Thejournal"connects"thereceivertothefile.It'sagoodhabittonamethejournalreceiverthesameasthejournal,plusanumericsuffixsuchas0or1.(Seethenextsteponwhattonamethejournal.)Also,youshouldputjournalreceiversinthesamelibraryasthefile.(Thisisveryimportantinordertosimplifyrecoveryprocedures,whichwewilldiscussinPartIII.)Formaximumprotection,considerstoringthejournalreceiverinadifferentASPthanthefilesothattheirstoragewillnotbeonthesamediskunit.
8/2/2019 Journal Ing 1
2/9
Steps2.
Createajournal.UsetheCreateJournal(CRTJRN)commandtocreateajournalandspecifythereceivercreatedinstep1.Althoughyoucanjournalmultiplefilestothesamejournal(and,insomecases,thatisactuallypreferable),youwillgenerallywanttohaveajournal"serving"asinglefile.
Agoodpracticeistonamethejournalthesameasthefileandputitinthesamelibraryasthefile,butstoreitinthesameASPasthejournalreceiver.
Steps3.
Startjournalingthefile.
ThisisdonebyusingtheStartJournalPhysicalFile(STRJRNPF)command.Thisishowyouassociateafiletoajournal.Oncetheassociationismade,thesystemwillrecordinthejournalreceiveracopyofanyrecordadded,updatedordeletedfromthefile.Otheractivity,suchaswhenthefileisopenedandclosed,canalsoberecordedinthejournalreceiverifyouchoosebyselectingtheappropriateoptionsontheSTRJRNPFcommand.
===========================================
Formoreinformationonthejournalcommandsmentionedaboveandotherjournal-relatedcommands,pleaseseethesubsequentsection"Quickreferencetojournalingcommands.
"
Fourbasicjournalentrycategories
Themostcommonjournalentriesfallintofourbasiccategories.Eachcategoryisrepresentedbyaone-charactercode(showninparenthesisinthefollowinglist).Withineachcategoryareanumberofdifferentjournalentrytypes.
Eachjournalentrytypeisrepresentedbyatwo-characterentrycode(alsoshowninparenthesiswithinthecategorydescriptionsbelow).
1.Journalandjournalreceiveroperations(J).Theseincludesuchthingsasreferencestothepreviousreceiver(PR)orthenextreceiver(NR)inachain.Also,atIPL-time,anentryismade(e.g.,anINentryforIPLafternormalend)
8/2/2019 Journal Ing 1
3/9
markingacriticalchronologicalboundaryinthefileactivity.
2.Fileoperations(F).Thiscategoryincludesfileopens(OP)andfilecloses(CL).
3.Recordoperations(R).Recordupdates(UP),deletes(DL),andnewrecordswritten(PTandPX)allfallintothiscategory.
4.Commitmentcontrol(C).Anythingrelatedtocommitmentcontrolfallsintothiscategory.Someexamplesarebegincommitmentcontrol(BC),startacommitcycle(SC),commitoperation(CM)androllbackoperation(RB).
===========================================
Thereareothercategoriesandentrytypesinadditiontothoselistedabove.However,thosearewhatyouwillcomeacrossmostoften.Foracompletelisting,seethedocumentationoronlinehelp.
Quickreferencetojournalingcommands
APYJRNCHG.Usesthejournalentriestoapplychangesthathaveoccurredsincea
databasefilewassavedorsomeotherspecifiedtime.
CHGJRN.Usethiscommandtochangetheattributesofajournalortoattachnewjournalreceiverstoajournal.
CMPJRNIMG.Thiscommandcomparesandliststhedifferencebetweenthebefore-imageandafter-imageofarecord,orbetweenthecurrentafter-imageofarecordandthepreviousafter-imageoftherecord.
CRTJRN.Usethiscommandtocreateajournal.
CRTJRNRCV.Usethiscommandtocreateajournalreceiver.
8/2/2019 Journal Ing 1
4/9
DLTJRN.Usethiscommandtodeleteajournal.
DLTJRNRCV.Usethiscommandtodeleteajournalreceiver.
DSPJRN.Thiscommanddisplaysorprintsthejournalentriesthatareinthejournalreceiversassociatedwiththespecifiedjournal.Thiscommandhasoutfilesupportsoyoucanlistthejournalentriestoadatabaseoutputfileforfurtherprocessingoranalysis.
DSPJRNRCVA.Usethiscommandtodisplaytheattributesofajournalreceiver.
ENDJRNPF.Thiscommandendsjournalingforthespecifiedphysicalfile.
RCVJRNE.Thiscommandallowsaspecifieduserprogramtocontinuouslyreceivejournalentriesoneatatimeastheyarewrittentothejournal.Thebehaviorissimilartoanexitprogram.
RMVJRNCHG.Usethiscommandtoremovechangesthathaveoccurredtoadatabasefilefromaspecifiedpointintimetosomepreviouspointintime(allowedonlyifbefore-imageswererecordedduringthetime).
RTVJRNE.UsethiscommandtoretrieveajournalentryandplaceitinCLprogramvariables.
SNDJRNE.Usethiscommandtowriteuser-definedentriestoajournal(i.e.,journalreceiver).
STRJRNPF.Usethiscommandtostartjournalingforthephysicalfile.
WRKJRN.Thiscommanddisplaysamenufromwhichyoucanperformmanyjournal-relatedfunctions,suchassystem-assistedrecoveryofjournaledfiles.
WRKJRNA.Thiscommanddisplaystheattributesofajournalandtheassociatedreceivers.
8/2/2019 Journal Ing 1
5/9
========================================================================================================
Theinsandoutsofjournaling--
PartIII
Howtouseajournalfordisasterrecovery
Journals,likemirroring,canbeusedasprotectionagainstlossofdatafromadiskcrash.Thetrade-offisthis:Journalingusesalotlessdiskspacethanmirroring,sinceitisonlyprotectingfiles(whichiswheremostofthesystemactivity,i.e.datachanges,takesplace).However,thisisalsoadisadvantagebecause,again,onlyfilesareprotected.
Inaddition,set-upandrecoveryrequireafewmoremanualsteps.Formaximumprotection,usethefollowingsteps.
Journalset-upandsaveprocess
Everycriticalfile(whichismostfiles)shouldbejournaled.Youcanjournalmultiplefilestothesamejournal,butusecautionwhendoingsobecausethiswillintroduceanotherlevelofcomplexity(orconfusion,asthecasemaybe).Thefollowingdescribesthesteps...
requiredtosetupjournalingforasinglefile:
Setupjournal(s)asdescribedinPartIandPartII.PutjournalandjournalreceiversinadifferentASPthanthefiletheyareprotecting.IfyouhaveneverusedASPsbefore,nowisagoodtimetostart.YoucankeepitsimpleandjustdedicateasmallASPforjournalingonly.Thatwayyouensurethatthefileanditsassociatedjournalarestoredondifferentdiskunits.Asanaddedbonus,usingaseparateASPforjournalswillimproveperformance,comparedwithputtingjournalsandfileinthesameASP.
Savethefileeachnight.Youcanstretchthisouttoeveryothernightoronceaweek,buttokeepjournalreceiversfromgettingtoobig,itisbesttosavethefileeachnight.
Createandattachanewjournalreceiver.Thisgivesthejournalafreshstartthenextday.
8/2/2019 Journal Ing 1
6/9
Savetheprevious(nowdetached)journalreceiver.Thisstepisoptional.Itgivesyouanextralayerofprotection.Shouldanythinghappentothefileonthesavedmedia,youcouldreconstructthefilefromthepreviousnight'ssaveandthesavedjournalreceiver.
Deletethepreviousjournalreceiver.Thisistheonlywayto"clear"theentriesinthereceiver.
MoreInformation
MovingalibraryfromoneASPtoanother
Wanttospeedupyournightlybackup?Usesavefiles
[IMAGE]
Recoveryprocedure
Afteradiskcrashorotherfailurethatrendersafileunusable,
usethefollowingstepstorecoverthatfile:
Restorethesavedfile.Usethemostrecentsavemedia.
Applyjournaledchangestotherestoredfile.UsetheApplyJournalChanges(APYJRNCHG)commandtoperformthisstep.
Aftercompletion,thefilewillbeinthesamestatethatitwaswhenthediskcrashed.Thisassumes,ofcourse,thatthejournalandthejournalreceiverwerestoredinadifferentASP.Note:TheparameterdefaultsoftheAPYJRNCHGcommandaresetupfordisasterrecovery,soyouprobablywon'tneedtochangethem.
RestoreobjectsinthecorrectorderSimilartowhenyouusetriggersorreferentialintegrity,whenyouusejournalingandperformarestoreyoumustensurethatcertainobjectsarerestoredintheproperorder
sothatjournalingcanbere-establishedautomatically.Whenyouneedtorestoreafilethatisjournaled,alongwithitsassociatedobjects(i.e.,logicalfiles,journalandjournalreceivers),
usethefollowingorder:
Restorethejournalobjectfirst(butnotthereceivers)
8/2/2019 Journal Ing 1
7/9
Restorethephysicalfileorfiles
Restoretheanyassociatedlogicalfiles
Restorethejournalreceivers
Tomakethingssimple,putthejournalandreceiversinthesamelibraryasthefiles.Whenconfiguredthisway,thesystemwillautomaticallyrestorethemintheproperorderifyourestoretheentirelibrary(usingtheRSTLIBcommand).Iftheyareindifferentlibrariesandyoudonotrestoretheobjectsintheaboveorder,youwillhavetore-establishjournalingmanually,whichmayincludere-attachingreceiversand/orrestartingjournalingforfiles.
Note:Therestoreprocedurejustdiscussedisonlyforwhenyouneedtorestoreafileanditsassociatedjournalandreceivers.
Intherecoveryprocedurediscussedearlier,weassumedthatthejournalsandreceiversdidnothavetoberestoredbecausetheywereinanotherASPandwerenotaffectedbythediskcrash.
====================================================================================
Theinsandoutsofjournaling--
PartIV
Fourtipsforreducingjournalsize
Inthefirstthreepartsofthisseriesonjournalingwediscussedhowtomanageandusejournalstomaintaindataintegrity,butwedidn'tgivemuchthoughttothephysicalsizeoftheobjectsinvolvedinjournaling.Let'snowtakeaquicklookathowyoucanhelpminimizejournalandjournalreceiversizes.
8/2/2019 Journal Ing 1
8/9
Journalobjectsareonlydefinitionalobjects;thatis,theycontainonlyadefinitionandnotexpandingamountsofdata.Therefore,journalobjectsmaintainaconstantandveryminimalsize.
Whatcanwedoaboutobjectsizes?Plenty.Ifyourecall,journalentriesarewrittentojournalreceivers,sojournalreceiversarealwaysexpanding.Thereareseveralwaystoreducethesizeofyourjournalreceivers.Mosthavetodowithomittingcertaintypesofentriesoreliminatingsome...oftheinformationintheentries.
IfDASDistightonyoursystem,herearesomethingsyoucandotocutdownonspacerequirementsforjournalsandjournalreceivers:
MoreInformation
Howtouseajournalfordisasterrecovery
Managingjournalreceivers
Theinsandoutsofjournaling--PartI
SpecifyOMTJRNE(*OPNCLO)ontheSTRJRNPFcommandwhenyoustartthejournalingforafile.
Bydefault,eachtimeaprogramopensandclosesajournaledfile,thesystemrecords"OP"and"CL"entries.
ByspecifyingOMTJRNE(*OPNCLO),youwillblockthesystemfromrecordingthoseentries(whichareusuallyusedonlyforsecurityauditingpurposes).
SpecifyIMAGES(*AFTER)ontheSTRJRNPFcommandtorecordonlyafterimages.
Youcanconfigurejournalingtorecordbothabeforeimageandanafterimageofanyrecordthatisupdated.Thatis,thejournalrecordsacopyoftheoriginalrecordbeforeitisactuallyupdatedinthefile(beforeimage)andacopyoftherecordasitappearsaftertheupdate(afterimage).
Thedefaultisafterimagesonly,andthatiswhatyoushoulduseunlessyouhaveaspecificneedforthebeforeimages.
ForthedisasterrecoveryprocesswediscussedinPartIIIofthisseries,onlyafterimagesarenecessary.Commitmentcontrolrequiresbeforeimages,butthesystemwillstartrecordingthemautomaticallywhencommitmentcontrolisstartedandwillceaserecordingthemwhencommitment
8/2/2019 Journal Ing 1
9/9
controlisended.YoucanuseIMAGES(*BOTH)tomanuallyrecordbothbeforeimagesandafterimages.
UseRCVSIZOPT(*RMVINTENT)ontheCHGJRNorCRTJRNcommands.
Thiscausesthesystemtoautomaticallyremoveinternalentriesoncetheyarenolongerneeded.Forexample,duringIPLthesystemlogsanentrytoeachjournal,indicatingwhetherthesystemisIPL-ingafteranormalorabnormalend.
AfterthenextIPL,theentriesassociatedwiththepreviousIPLarenolongerneeded,andthesystemwillautomaticallydeletethemifyouspecifyRCVSIZOPT(*RMVINTENT)ontheCHGJRNcommandwhenyoucreatethejournal.(YoucanalsousetheCHGJRNcommandtochangeanexistingjournal.)Note:Don'tlookforanymiracleshere.Theseinternalentriesrepresentatinyfractionofalltheentriesofannormalactivejournal.
UseRCVSIZOPT(*MINFIXLEN)ontheCHGJRNorCRTJRNcommands.
When*MINFIXLENisused,thesystemshortensjournalentriesbynotwritingoutthejob,programanduserprofileinformationthatnormallyaccompanieseachjournalentry.ThistrickcanadduptobigDASDsavings,since46byteswillbeshavedoffofeachentry.Note:Thejob,programanduserprofileinformationisusedforsecurityauditingpurposes,
soyoudonotsacrificeanydata-recoveryabilitiesbynothavingtheminthejournalentries.
Onafinalnote,rememberthatthesetechniquesarenotmutuallyexclusive.Youcanuseanycombinationofthemtofityourneeds.