•
TableofContents
Oracle®DBAAutomationQuick
Reference
ByCharlieRussel,RobertCordingley
Publisher :PrenticeHallPTR
PubDate :April23,2004
ISBN :0-13-140301-X
Pages :320
Thefast,practicalOracle9i/10gautomation
referenceforeveryDBA!
AutomateOracleandsaveyourtimeformore
importanttasks!ThisistheOracle
automationreferenceeveryworkingOracle
DBAneeds...concise,straightforward,and
incrediblyeasytouse.Discoverproven
solutionsforautomatinginstallation,
databasecreation,management,monitoring,
tuning,backup/recovery,andmore.Keepthis
bookbyyourdesk,nearyour
server...whereveryouneedfast,reliable
automationsolutionsrightnow!
MasterscriptingforbothOracle9iand
Oracle10g!
UseOracleUniversalInstallertocreate
responsefilesforautomatingany
installation
UseOracleNetworkConfiguration
Assistant(NetCA)toconfigurenetwork
componentsduringinstallation
UseOracleDatabaseConfiguration
Assistant(DBCA)tocreateandclone
databases,andtoreverseengineerthem
intotemplatesandscripts
Managefilesandtablespaces,tune
memory,performbackup/recovery,
scheduleautomatedadministrationtasks,
andmore
Extendandcustomizeanyscripttoyour
ownneeds
IncludesconcisereferencetoPerlDBIand
itsOracle-specificcomponentswithrealworldexamplesandsyntax
•
TableofContents
Oracle®DBAAutomationQuick
Reference
ByCharlieRussel,RobertCordingley
Publisher :PrenticeHallPTR
PubDate :April23,2004
ISBN :0-13-140301-X
Pages :320
Copyright
PrenticeHallOracleDBASQLQuickReferenceSeries
Introduction
WhyAutomate?
ImprovedProductivity
ImprovedQuality
UseWhat'sAlreadyThere
What'sInThisBook?
Acknowledgements
TestEverythingFirst
TalkToUs
ChapterOne.OracleUniversalInstaller
AutomatedInstallation
Reference
SampleFiles
ChapterTwo.NetworkConfiguration
AutomatedNetworkConfiguration
CommandLineParameters
Oracle'sSampleResponseFiles
ResponseFileSyntax
ExampleNetCAResponseFile
ChapterThree.DatabaseCreation
UsingtheDBCA
AutomatingDatabaseCreationwithouttheDBCA
AutomatingDatabaseDeletionwithouttheDBCA
SampleDBCAResponseFile
BasicInitialization(init.ora)Parameters
Reference
SampleDatabaseTemplate
oradimCommandLineParameters
ChapterFour.Day-to-DayAdministration
UseWhat'sAlreadyThere
TestEverythingFirst
FileandTablespaceManagement
Scheduling
AutomaticMemoryTuning
SchedulingReference
Copyright
LibraryofCongressCataloging-in-PublicationDatais
available.
Russel,Charlie.
OracleDBAautomationquickreference/CharlieRussel,RobertCordingle
p.cm.-(PrenticeHallOracleDBASQLquickreferenceseries)
Includesindex.
ISBN0-13-140301-X(pbk.)
1.Relationaldatabases.2.Oracle(Computerfile).I.Cordingley,Robert.
QA76.9.D3R8652004
005.75'6--dc222004043673
Editorial/ProductionSupervision:PattiGuerrieri
InteriorDesign:GailCocker-Bogusz
CoverDesignDirector:JerryVotta
CoverDesign:NinaScuderi
TechnicalReviewers:LorraineJuzwick,KevinOwens,
ThomasHatzigeorgiou,BertScalzo
AcquisitionsEditor:JeffreyPepper
EditorialAssistant:LindaRamagnano
ManufacturingManager:AlexisR.Heydt-Long
MarketingManager:DanDePasquale
©2004PearsonEducation,Inc.
PublishingasPrenticeHallProfessionalTechnicalReference
UpperSaddleRiver,NJ07458
PrenticeHallPTRoffersexcellentdiscountsonthisbookwhen
orderedinquantityforbulkpurchasesorspecialsales.For
moreinformation,pleasecontact:U.S.Corporateand
GovernmentSales,1-800-382-3419,
ForsalesoutsideoftheU.S.,
pleasecontact:InternationalSales,1-317-581-3793,
Allcompanyandproductnamesmentionedhereinarethe
trademarksorregisteredtrademarksoftheirrespectiveowners.
Allrightsreserved.Nopartofthisbookmaybereproduced,in
anyformorbyanymeans,withoutpermissioninwritingfrom
thepublisher.
PrintedintheUnitedStatesofAmerica
FirstPrinting
PearsonEducationLtd.
PearsonEducationAustraliaPty.Limited
PearsonEducationSingapore,Pte.Ltd.
PearsonEducationNorthAsiaLtd.
PearsonEducationCanada,Ltd.
PearsonEducacióndeMexico,S.A.deC.V.
PearsonEducationJapan
PearsonEducationMalaysia,Pte.Ltd.
Dedication
CharliewouldliketodedicatethisbooktoRobert,Ross,Quin,
Prashant,Mahesh,Maggie,Opal,Donna,Jen,Luisa,andHarold.
PrenticeHall
OracleDBASQLQuickReferenceSeries
OracleDBASQLQuickReference
Russel•Cordingley
OracleDBABackupandRecoveryQuickReference
Russel•Cordingley
OracleDBAAutomationQuickReference
Russel•Cordingley
Introduction
TheOracledatabaseisacomplexandever-changingproduct
thathasgrownincreasinglycomplexandpowerfuloverthe
years.Inthebadolddays,theworkingOracledatabase
administrator(DBA)hadalimitedsetoftoolstoautomatethe
day-to-daytasksofmaintainingthehealthandintegrityof
Oracledatabases.Thankfully,thathaschangedovertime,and
nowwithOracle9i,andespeciallyOracle10g,nearlyeverything
associatedwiththedatabasecanbeautomated.Unfortunately,
Oraclehasprovidedlittledocumentationonexactlyhowbestto
accomplishthis.Wehopethisbookwillhelpyouonyourroad
todiscoveringthemanywaysthatOraclecanbeautomated.
WhyAutomate?
VeryfewDBAsareallowedtheluxuryofmanagingasingle
database,oreventwo,orthree.Inthesedaysofincreasing
workloads,manyofusaremanaging20,30,ormore
databases,andthey'refrequentlyscatteredallovertheworld.
Withthenumberofdatabasesinuseontherise,it'simportant
tostreamlineeverystepoftheprocessasmuchaspossible.
Automationimprovesyourproductivityintwoveryimportant
ways:Itreducesthetimeyouneedtospendwaitingforthe
databasetodosomething,anditimprovestheoverallquality
andrepeatabilityofwhatyoudo.
ImprovedProductivity
Thefirstadvantagetoautomationisimprovingtheoverall
productivityoftheOracleDBA.WhentheDBAperformsatask
manually,thereis,inevitably,asubstantialamountoftime
spentwaitingforthedatabasetodoitsthing.There'salsoa
gooddealoftimeusuallyspentbythedatabasewaitingonyou
totellitwhattodonext.Inbothcases,timeiswastedandthe
overallproductivityoftheDBAisseriouslyaffected.Besides,
let'sfaceit,thestuffyoucanautomateisusuallytheboring
stuffyoudon'treallywanttobedoinganyway!SoletOracledo
theworkforyou.
ImprovedQuality
Thehiddenbenefittoautomationisasignificantimprovement
inthequalityoftheDBA'swork.Anautomatedtaskisa
predictableandrepeatabletask.Whenyoudoataskmanually,
especiallyoneyoudorepeatedly,youwilleventuallymake
mistakes.Sometimesthey'resmallmistakes,sometimesbig
ones.Butifyouautomatethetask,itwillalwaysbeperformed
thesameway,timeaftertimeaftertime.
UseWhat'sAlreadyThere
Rightfromtheverybeginning,withtheinitialsoftware
installation,Oracleallowsyoutoreduceoreliminatetheneed
foraDBAtowatchandwait.OnceOraclehasbeeninstalled,
youcanconfigurethenetworkandcreateoneormore
databasesautomatically,withnohumanintervention.
Afterthesoftwareisinstalledandthedatabasecreated,the
DBAfinallyreachestherealmeatofthejob.Forthe
experiencedDBA,there'saveryrealtendencytokeepusingthe
toolsheorshehasalwaysused,evenifthetoolswere
originallycreatedforusewithOracle7.ThefledglingDBAcan
runintosimilarproblems,sinceit'sdifficulttodiscoverallthe
differentautomationopportunitiesincludedwithOraclewhile
simultaneouslydealingwithdemandsfromusers,developers,
andmanagement.
Inspiteofthesechallenges,orevenbecauseofthem,it's
vitallyimportanttoautomateasmuchasispossible.It's
equallyimportanttoavoidrecreatingacapabilitythat'salready
available.ThetwomostrecentversionsofOraclehaveadded
analmostunbelievablewealthofoptionsfortheoverworked
DBAtoautomatehisorherwaytoaquieterpager.
TestEverythingFirst
Withthemultitudeofnewcapabilitiesinrecentversions,there's
atemptationtoimplementeverythingthatthedocumentation
sayswillhelpimproveoperationsorperformance.Resistthe
temptationatleastlongenoughtoallowtimefortestingofeach
andeverynewfeaturepriortoimplementation.Someofthe
newfeatureswillhelpinallsituations,somewillhelpinallbut
afewsituations,andafewmightcreateproblemsincertain
circumstances.Testingpriortoimplementationisessential.
What'sInThisBook?
Chapter1willintroducetheOracleUniversalInstaller(OUI),
andexplaintheuseandcreationofresponsefiles,whichare
filesthatprovideyourresponsestotheinstaller.Responsefiles
allowahighlyautomatedinstallationsessiontoproceedwith
littleornouserintervention.Youcanevenusethesefilesas
templatesformanualinstalls,whenyouneedtodeviateslightly
fromtheresponsefile'sintendedcourse.
InChapter2,OracleNetworkConfigurationAssistant(NetCA)
willreceivesimilartreatment.Whilenotasautomation-friendly
astheOUI,NetCAdoeshaveareasonableamountofflexibility,
usingresponsefilessimilartothoseusedbyOUI.
Chapter3isallabouttheOracleDatabaseConfiguration
Assistant(DBCA).TheDBCAisoneofthemostversatileparts
ofaDBA'stoolkit,andextremelyeasytoautomate.Youcan
useDBCA-specificresponsefiles,buttherealstrengthofthe
toolliesinitsuniqueuseoftemplatefiles.TheDBCAcancreate
databases,clonethem,andeven"reverse-engineer"anexisting
databaseintoatemplate,orevenasetofscripts.
Finally,Chapter4canberegardedasa"surveycourse"of
Oraclefeaturesthatcanbeusedtoautomatesomeofthetasks
thatconsumeaDBA'stimedayinanddayout.
TalkToUs
Wehavemadeeveryattemptinthisshortvolumetoprovideas
completeareferenceaswecould,alwayswiththegoalof
keepingitbriefandeasytofindtheinformationyouneed.Our
goalwastogivetheworkingOracleDBAatooltomakehimor
hermoreproductive,andwesincerelyhopeyoufindituseful.
Everyefforthasbeenmadetobebothcompleteandaccurate.
Ifyoudofindanerrororomission,orhaveacommentonthe
book,weverymuchwanttohearfromyou.Pleasewriteusat:
Wedon'tpromisetoanswer
everyquestionorcomment,butwedoreadthemandvery
muchappreciatethem.
Acknowledgements
Thisbookisnottheworkofoneortwopeople,butanentire
team,manyofwhomweasauthorsnevergettomeetin
person,buttowhomweareindebted.First,we'dliketothank
ouragentforthisbook,NeilJ.Salkind,ofStudioB.It'sdueto
hispersistenceandadvocacythatthisbookcameabout.
FromPrenticeHall,atrulyexceptionalteamdidanamazingjob
onthisbook,goingwaybeyondthenorm.JeffreyPepperwas
hisever-persistentandpatientself.Jeff,wetoldyouwe'dmake
thedeadline!PattiGuerrieriwasoureditoragain,andwe
couldn'thavebeenhappier.LindaRamagnanoworkswithJeff
andkeepseverythinghappeningquietlybehindthescenes,
wherewebarelynotice.Andforthat,weareeternallygrateful!
ThereareothersatPrenticeHallwhosenameswe'llnever
know,andwe'resorryaboutthat.Theyarecriticaltothe
successofthisprojectandwearenolessindebtedtothemfor
notknowingthempersonally.You'reagreatteamandwereally
appreciateallyoudo.
Ourreviewers,BertScalzoandLorraineJuzwick,didan
excellentjob,makinggoodsuggestionsandgivingusgreater
confidenceasweworkedonbetasoftwaretomakesurewe
coveredallthenewfeaturesinOracle10g.Ifwemissed
anything,it'snottheirfault.SheilaCepero,ourOracle
PublishersProgrambetacontact,providedtimelyassistance
andaccessaswestruggledtomeetourdeadlines.Thankyou,
Sheila,ithasreallybeenapleasure.
Overtheyears,wehavebeenhonoredtoworkwithsometruly
outstandingOracleDBAs,especiallyQuinBligh,MaggieVerdier,
MaheshChengaReddy,PrashantDangash,andRossWoody.
Eachhadapositiveimpactonthisbookandbeyond.Wetruly
appreciatetheirprofessionalabilitiesandtheirfriendship.
Andfinally,Charlie'swife,SharonCrawford,whoprovided
support,assistance,advice,andmostimportantly,love,
throughoutthisbook.Withouther,itwouldnothavehappened.
ChapterOne.OracleUniversalInstaller
OneofthebeautiesoftheOracledatabaseisthatnearly
everythingassociatedwithitcanbeautomated.Oracle
installationisoneoftheeasiesttaskstohandlewithlittleorno
humanintervention.Sadly,OracleCorporationhashistorically
providedlittledocumentationonexactlyhowtoaccomplishthis.
ThischapterwilldiscussthemainstepsinautomatinganOracle
installation.Someplatformsmayrequirespecificpreparation
beforetheinstallercanrun.Thispreparationisusually
straightforwardandsimple,butconsulttheinstallationguidefor
yourspecificplatformbeforeproceeding.
AutomatedInstallation
Whenperforminganautomatedinstall,youmustprovidethe
installerwithatextfilecontainingallthenecessaryinstructions.
OraclecallstheseOracleUniversalInstaller(OUI)response
files.Aresponsefileisaplaintextfile,whichmustfollow
Oracle'ssyntaxexactly.
TousearesponsefileduringaninstallationonWindowsor
UNIX,usethefollowingcommands(where"custom.rsp"isthe
nameyou'vegivenyourresponsefile):
Windows setup.exe[-silent]-responseFileC:\OraInst\custom.rsp
UNIX
./runInstaller[-silent]-responseFile/u01/OraInst/custom.rsp
The-silentqualifierisoptional.Whenasilentinstallis
indicated,theinstallerwillnotopenanygraphicaluserinterface
(GUI)windowsunderanycircumstances.Allneededinformation
mustbeprovidedintheresponsefileforasilentinstall.Ifany
informationismissing,theinstallerwillexit,returninganerror
andthenameofthelogfiletoexaminefordetails.
Ifthe-silentqualifierisomitted,theinstallerwillopen
normallyandwaitfortheusertomovethroughtheinstallsteps
manually.Eachpagewillbefilledinwithanswersfromthe
responsefile,buttheinstallationwillnotproceedautomatically.
Thisisveryusefulifyouwantaninstallation"template"rather
thanafullyautomatedinstall.
InadditiontotheOracle-providedsampleresponsefiles,the
installercanrecordasessiontocreatearesponsefileforusein
laterinstallations.Torecordasession,usethe-recordanddestinationFilequalifiers.ForWindowsandUNIX,for
example:
Windows setup.exe-record-destinationFileC:\OraInst\rec.rsp
UNIX
./runInstaller-record-destinationFile/u01/OraInst/rec.rsp
Theinstallerwillstartandrunnormally.Choicesmadeduring
theinstallationsessionwillberecordedtothedesignated
responsefile.Afterallselectionshavebeenmade,asummary
pagewillbepresented.Atthispoint,youcancontinuewiththe
installorclicktheCancelbuttontoendit.Evenifthe
installationiscancelled,therecordedresponsefileiscreated.
Reference
CommandLineParameters
TheOUIsupportsthecommandlineparametersdescribedin
Table1-1:
Table1-1.InstallationCommandLineParameters
Additional
Comments
Parameter
Purpose
-silent
Instructs
Whenthis
theinstaller parameteris
toruna
specified,thesilent
responseFile
install.
parametermust
alsobeprovided.
-reponseFile<filename>
Tellsthe
Theresponse
installer
filenameshould
which
befullyqualified.
response
filetouse.
-nowelcome
Disables
the
installer's
opening
splash
screen.
-record
Tellsthe
Whenthis
installerto parameteris
recorda
specified,you
new
mustalsousethe
response
fileduring destinationFile
thesession. parameter.
-destinationFile
Tellsthe
installer
Redundantwhen
usedwiththesilentqualifier.
Usefulonlywith
the-record
session_variable_name=<value>
whereto
writea
recorded
install
session.
parameter.
Setsa
session
variable.
Overridesthe
valuesetinthe
responsefile,if
any.
<component_name>_<component_version>_<variable_name>= Setsa
Overridesthe
<value>
component- valuesetinthe
specific
responsefile,if
variable.
any.
ResponseFiles
Oracleshipswithsampleresponsefiles.Theseresponsefiles
aredifferentforOracle9iandOracle10g.Table1-2liststhe
sampleresponsefilesforOracle10g,andTable1-3liststhe
sampleresponsefilesforOracle9i:
Table1-2.Oracle10gSampleResponseFiles
Oracle10gResponseFile
Purpose
oracle.client.Administrator.rsp Installsclient-onlyversionofOracle,includingall
clientadmin.rsp
administrativetools.
oracle.client.Custom.rsp
clientcustom.rsp
Customfileforclient-onlyinstalls.Mustbeeditedextensively
beforeuse.
oracle.client.Runtime.rsp
runtime.rsp
Runtime-onlyinstallationofOracleclient.Generallyused
onlyfor"embedded"installations.
oracle.server.Custom.rsp
Customfileforserverinstalls.Mustbeeditedextensively
custom.rsp
beforeuse.
oracle.server.EE.rsp
enterprise.rsp
FullEnterpriseEdition(EE)installation.Needsminoredits
beforeuse.
oracle.server.PE.rsp
FullPersonalEdition(PE)installation.Needsminoredits
beforeuse.
oracle.server.SE.rsp
FullStandardEdition(SE)installation.Needsminoredits
beforeuse.
dbca.rsp
RunstheDatabaseCreationAssistant(DBCA)tocreatea
databasenon-interactively.Requiresanassociateddatabase
template,andneedsextensiveeditingbeforeuse.
netca.rsp
RunstheNetworkConfigurationAssistantnon-interactively.
Needsminoreditsbeforeuse.
Table1-3.Oracle9iSampleResponseFiles
Oracle9i
Purpose
ResponseFile
clientadmin.rsp Installsclient-onlyversionofOracle,includingalladministrativetools.
clientcustom.rsp Customfileforclient-onlyinstalls.Mustbeeditedextensivelybeforeuse.
clientruntime.rsp Runtime-onlyinstallationofOracleclient.Generallyusedonlyfor
"embedded"installations.
custom.rsp
Customfileforserverinstalls.Mustbeeditedextensivelybeforeuse.
enterprise.rsp
Fullenterpriseeditioninstallation.Needsminoreditsbeforeuse.
standard.rsp
Fullstandardeditioninstallation.Needsminoreditsbeforeuse.
dbca.rsp
RunstheDatabaseCreationAssistanttocreateadatabasenoninteractively.Requiresanassociateddatabasetemplate,andneeds
extensiveeditingbeforeuse.
netca.rsp
RunstheNetworkConfigurationAssistant(NetCA)non-interactively.
Needsminoreditsbeforeuse.
emca.rsp
RunstheEnterpriseManagerConfigurationAssistantnon-interactively.
Needsminoreditsbeforeuse.
omicustom.rsp
RunstheOracleManagementandIntegrationConfigurationAssistant
non-interactively.Needsminoreditsbeforeuse.
oid.rsp
RunstheOracleInternetDirectoryConfigurationAssistantnoninteractively.Needsminoreditsbeforeuse.
Syntax
OUIresponsefilesareplaintextfiles.Installersettingsare
specifiedasname/valuepairs,inthefollowingform:
<name>=[<recommended>:]<value>
<name>isalwaysasinglestring,withnospaces,andiscaseinsensitive.
The<recommended>portionisaliteral,whichifpresent,must
beeitherDEFAULTorFORCEDfollowedbyacolon.IfDEFAULTis
specified,thevaluewillbepresentedasachangeabledefault
duringanon-silentinstallation.AFORCEDvaluemaynotbe
changedbytheuser.Ifunspecified,theDEFAULTsettingis
assumed.