Vous êtes sur la page 1sur 98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning

TechnologyLearning
Learningisnotaspectatorsport..Let'splay

SachinThapa19:31onNovember20,2014
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/)

Tags:apps(19),best,core,DBA(22),interview,oracle(63),question

EssentialDBAInterviewQuestions
DBAINTERVIEWQUESTIONS&ANSWERS
1.WHATARETHERESPONSIBILITIESOFADATABASEADMINISTRATOR?

INSTALLINGANDUPGRADINGTHEORACLESERVERANDAPPLICATIONTOOLS.ALLOCATINGSYSTEMSTORAGEAND
PLANNINGFUTURESTORAGEREQUIREMENTSFORTHEDATABASESYSTEM.MANAGINGPRIMARYDATABASE
STRUCTURES(TABLESPACES)MANAGINGPRIMARYOBJECTS(TABLE,VIEWS,INDEXES)ENROLLINGUSERSAND
MAINTAININGSYSTEMSECURITY.ENSURINGCOMPLIANCEWITHORALCELICENSEAGREEMENTCONTROLLINGAND
MONITORINGUSERACCESSTOTHEDATABASE.MONITORINGANDOPTIMIZINGTHEPERFORMANCEOFTHEDATABASE.
PLANNINGFORBACKUPANDRECOVERYOFDATABASEINFORMATION.MAINTAINARCHIVEDDATAONTAPEBACKINGUP
ANDRESTORINGTHEDATABASE.CONTACTINGORACLECORPORATIONFORTECHNICALSUPPORT.
2.EXPLAINTHEDIFFERENCEBETWEENAHOTBACKUPANDACOLDBACKUPANDTHEBENEFITSASSOCIATEDWITH
EACH?
AHOTBACKUPISBASICALLYTAKINGABACKUPOFTHEDATABASEWHILEITISSTILLUPANDRUNNINGANDITMUSTBEIN
ARCHIVELOGMODE.ACOLDBACKUPISTAKINGABACKUPOFTHEDATABASEWHILEITISSHUTDOWNANDDOESNOT
REQUIREBEINGINARCHIVELOGMODE.THEBENEFITOFTAKINGAHOTBACKUPISTHATTHEDATABASEISSTILL
AVAILABLEFORUSEWHILETHEBACKUPISOCCURRINGANDYOUCANRECOVERTHEDATABASETOANYPOINTINTIME.
THEBENEFITOFTAKINGACOLDBACKUPISTHATITISTYPICALLYEASIERTOADMINISTERTHEBACKUPANDRECOVERY
PROCESS.INADDITION,SINCEYOUARETAKINGCOLDBACKUPSTHEDATABASEDOESNOTREQUIREBEINGINARCHIVE
LOGMODEANDTHUSTHEREWILLBEASLIGHTPERFORMANCEGAINASTHEDATABASEISNOTCUTTINGARCHIVELOGS
TODISK.
3.EXPLAINTHEDIFFERENCEBETWEENADATABLOCK,ANEXTENTANDASEGMENT?
ADATABLOCKISTHESMALLESTUNITOFLOGICALSTORAGEFORADATABASEOBJECT.ASOBJECTSGROWTHEYTAKE
CHUNKSOFADDITIONALSTORAGETHATARECOMPOSEDOFCONTIGUOUSDATABLOCKS.THESEGROUPINGSOF
CONTIGUOUSDATABLOCKSARECALLEDEXTENTS.ALLTHEEXTENTSTHATANOBJECTTAKESWHENGROUPED
TOGETHERARECONSIDEREDTHESEGMENTOFTHEDATABASEOBJECT.
4.COMPAREANDCONTRASTTRUNCATEANDDELETEFORATABLE?
BOTHTHETRUNCATEANDDELETECOMMANDHAVETHEDESIREDOUTCOMEOFGETTINGRIDOFALLTHEROWSINA
TABLE.THEDIFFERENCEBETWEENTHETWOISTHATTHETRUNCATECOMMANDISADDLOPERATIONANDJUSTMOVES
THEHIGHWATERMARKANDPRODUCESANOWROLLBACK.THEDELETECOMMAND,ONTHEOTHERHAND,ISADML
OPERATION,WHICHWILLPRODUCEAROLLBACKANDTHUSTAKELONGERTOCOMPLETE.
5. WHATCOMMANDWOULDYOUUSETOCREATEABACKUPCONTROLFILE?

ALTERDATABASEBACKUPCONTROLFILETOTRACE.
6.HOWWOULDYOUGOABOUTINCREASINGTHEBUFFERCACHEHITRATIO?
USETHEBUFFERCACHEADVISORYOVERAGIVENWORKLOADANDTHENQUERYTHEV$DB_CACHE_ADVICETABLE.IFA
CHANGEWASNECESSARYTHENIWOULDUSETHEALTERSYSTEMSETDB_CACHE_SIZECOMMAND.
7.EXPLAINTHEDIFFERENCEBETWEEN$ORACLE_HOMEAND$ORACLE_BASE?
ORACLE_BASEISTHEROOTDIRECTORYFORORACLE.ORACLE_HOMELOCATEDBENEATHORACLE_BASEISWHERETHE
ORACLEPRODUCTSRESIDE.
8. WHENAUSERPROCESSFAILS,WHATBACKGROUNDPROCESSCLEANSUPAFTERIT?

PMON
9. WHATBACKGROUNDPROCESSREFRESHESMATERIALIZEDVIEWS?

THEJOBQUEUEPROCESSES.
10. HOWWOULDYOUDETERMINEWHATSESSIONSARECONNECTEDANDWHATRESOURCESTHEYAREWAITINGFOR?

USEOFV$SESSIONANDV$SESSION_WAIT

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

1/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
11. DESCRIBEWHATREDOLOGSARE?

REDOLOGSARELOGICALANDPHYSICALSTRUCTURESTHATAREDESIGNEDTOHOLDALLTHECHANGESMADETOA
DATABASEANDAREINTENDEDTOAIDINTHERECOVERYOFADATABASE.
12. HOWWOULDYOUFORCEALOGSWITCH?

ALTERSYSTEMSWITCHLOGFILE
13.NAMEATABLESPACEAUTOMATICALLYCREATEDWHENYOUCREATEADATABASE?
THESYSTEMTABLESPACE.
14.WHATARETHEMINIMUMPARAMETERSSHOULDEXISTINTHEPARAMETERFILE( INIT.ORA )?
DBNAMEMUSTSETTOATEXTSTRINGOFNOMORETHAN8CHARACTERSANDITWILLBESTOREDINSIDETHE
DATAFILES,REDOLOGFILESANDCONTROLFILESANDCONTROLFILEWHILEDATABASECREATION.
DB_DOMAINITISSTRINGTHATSPECIFIESTHENETWORKDOMAINWHERETHEDATABASEISCREATED.THEGLOBAL
DATABASENAMEISIDENTIFIEDBYSETTINGTHESEPARAMETERS
(DB_NAME&DB_DOMAIN)CONTORLFILESLISTOFCONTROLFILENAMESOFTHEDATABASE.IFNAMEISNOT
MENTIONEDTHENDEFAULTNAMEWILLBEUSED.
DB_BLOCK_BUFFERSTODETERMINETHENOOFBUFFERSINTHEBUFFERCACHEINSGA.
PROCESSESTODETERMINENUMBEROFOPERATINGSYSTEMPROCESSESTHATCANBECONNECTEDTOORACLE
CONCURRENTLY.THEVALUESHOULDBE5(BACKGROUNDPROCESS)ANDADDITIONAL1FOREACHUSER.
ROLLBACK_SEGMENTSLISTOFROLLBACKSEGMENTSANORACLEINSTANCEACQUIRESATDATABASESTARTUP.ALSO
OPTIONALLYLICENSE_MAX_SESSIONS,LICENSE_SESSION_WARNINGANDLICENSE_MAX_USERS.
15. CANONERENAMEATABLESPACE?

NO,THISISLISTEDASENHANCEMENTREQUEST148742.WORKAROUND:
EXPORTALLOFTHEOBJECTSFROMTHETABLESPACE
DROPTHETABLESPACEINCLUDINGCONTENTS
RECREATETHETABLESPACE
IMPORTTHEOBJECTS
16. CANONERESIZETABLESPACESANDDATAFILES?

ONECANMANUALLYINCREASEORDECREASETHESIZEOFADATAFILEFROMORACLE7.2USINGTHECOMMAND.
ALTERDATABASEDATAFILEFILENAME2RESIZE100M
BECAUSEYOUCANCHANGETHESIZESOFDATAFILES,YOUCANADDMORESPACETOYOURDATABASEWITHOUT
ADDINGMOREDATAFILES.THISISBENEFICIALIFYOUARECONCERNEDABOUTREACHINGTHEMAXIMUMNUMBEROF
DATAFILESALLOWEDINYOURDATABASE.
MANUALLYREDUCINGTHESIZESOFDATAFILESALLOWSYOUTORECLAIMUNUSEDSPACEINTHEDATABASE.THISIS
USEFULFORCORRECTINGERRORSINESTIMATIONSOFSPACEREQUIREMENTS.
ALSO,DATAFILESCANBEALLOWEDTOAUTOMATICALLYEXTENDIFMORESPACEISREQUIRED.LOOKATTHE
FOLLOWINGCOMMAND:
CREATETABLESPACEPCS_DATA_TS
DATAFILEC:\ORA_APPS\PCS\PCSDATA1.DBFSIZE3M
AUTOEXTENDONNEXT1MMAXSIZEUNLIMITED
DEFAULTSTORAGE(INITIAL10240
NEXT10240
MINEXTENTS1
MAXEXTENTSUNLIMITED
PCTINCREASE0)
ONLINE
PERMANENT
17. WHYANDWHENSHOULDIBACKUPMYDATABASE?

BACKUPANDRECOVERYISONEOFTHEMOSTIMPORTANTASPECTSOFADBASJOB.IFYOULOSEYOURCOMPANYS
DATA,YOUCOULDVERYWELLLOSEYOURJOB.HARDWAREANDSOFTWARECANALWAYSBEREPLACED,BUTYOUR
DATAMAYBEIRREPLACEABLE!
NORMALLYONEWOULDSCHEDULEAHIERARCHYOFDAILY,WEEKLYANDMONTHLYBACKUPS,HOWEVERCONSULTWITH
YOURUSERSBEFOREDECIDINGONABACKUPSCHEDULE.BACKUPFREQUENCYNORMALLYDEPENDSONTHE
FOLLOWINGFACTORS:
.RATEOFDATACHANGE/TRANSACTIONRATE
.DATABASEAVAILABILITY/CANYOUSHUTDOWNFORCOLDBACKUPS?
.CRITICALITYOFTHEDATA/VALUEOFTHEDATATOTHECOMPANY
.READONLYTABLESPACENEEDSBACKINGUPJUSTONCERIGHTAFTERYOUMAKEITREADONLY
.IFYOUARERUNNINGINARCHIVELOGMODEYOUCANBACKUPPARTSOFADATABASEOVERANEXTENDEDCYCLEOF
DAYS
.IFARCHIVELOGGINGISENABLEDONENEEDSTOBACKUPARCHIVEDLOGFILESTIMEOUSLYTOPREVENTDATABASE
FREEZES
.ETC.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

2/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
CAREFULLYPLANBACKUPRETENTIONPERIODS.ENSUREENOUGHBACKUPMEDIA(TAPES)AREAVAILABLEANDTHAT
OLDBACKUPSAREEXPIREDINTIMETOMAKEMEDIAAVAILABLEFORNEWBACKUPS.OFFSITEVAULTINGISALSOHIGHLY
RECOMMENDED.
FREQUENTLYTESTYOURABILITYTORECOVERANDDOCUMENTALLPOSSIBLESCENARIOS.REMEMBER,ITSTHELITTLE
THINGSTHATWILLGETYOU.MOSTFAILEDRECOVERIESAREARESULTOFORGANIZATIONALERRORSAND
MISCOMMUNICATIONS.
18.WHATISTHEDIFFERENCEBETWEENRESTORINGANDRECOVERING?
RESTORINGINVOLVESCOPYINGBACKUPFILESFROMSECONDARYSTORAGE(BACKUPMEDIA)TODISK.THISCANBE
DONETOREPLACEDAMAGEDFILESORTOCOPY/MOVEADATABASETOANEWLOCATION.
RECOVERYISTHEPROCESSOFAPPLYINGREDOLOGSTOTHEDATABASETOROLLITFORWARD.ONECANROLL
FORWARDUNTILASPECIFICPOINTINTIME(BEFORETHEDISASTEROCCURRED),ORROLLFORWARDUNTILTHELAST
TRANSACTIONRECORDEDINTHELOGFILES.SQL>CONNECTSYSASSYSDBA
SQL>RECOVERDATABASEUNTILTIME20010306:16:00:00USINGBACKUPCONTROLFILE
19.WHENCREATINGAUSER,WHATPERMISSIONSMUSTYOUGRANTTOALLOWTHEMTOCONNECTTOTHEDATABASE?
GRANTTHECONNECTTOTHEUSER.
20.WHATISSTATSPACKANDHOWDOESONEUSEIT?
STATSPACKISASETOFPERFORMANCEMONITORINGANDREPORTINGUTILITIESPROVIDEDBYORACLEFROMORACLE8I
ANDABOVE.STATSPACKPROVIDESIMPROVEDBSTAT/ESTATFUNCTIONALITY,THOUGHTHEOLDBSTAT/ESTATSCRIPTS
ARESTILLAVAILABLE.FORMOREINFORMATIONABOUTSTATSPACK,READTHEDOCUMENTATIONINFILE
$ORACLE_HOME/RDBMS/ADMIN/SPDOC.TXT.
INSTALLSTATSPACK:
CD$ORACLE_HOME/RDBMS/ADMIN
SQLPLUS/ASSYSDBA@SPDROP.SQL INSTALLSTATSPACK
SQLPLUS/ASSYSDBA@SPCREATE.SQL ENTERTABLESPACENAMESWHENPROMPTED
USESTATSPACK:
SQLPLUSPERFSTAT/PERFSTAT
EXECSTATSPACK.SNAPTAKEAPERFORMANCESNAPSHOTS
EXECSTATSPACK.SNAP
OGETALISTOFSNAPSHOTS
SELECTSNAP_ID,SNAP_TIMEFROMSTATS$SNAPSHOT
@SPREPORT.SQL ENTERTWOSNAPSHOTIDSFORDIFFERENCEREPORT
OTHERSTATSPACKSCRIPTS:
.SPPURGE.SQL PURGEARANGEOFSNAPSHOTIDSBETWEENTHESPECIFIEDBEGINANDENDSNAPIDS
.SPAUTO.SQL SCHEDULEADBMS_JOBTOAUTOMATETHECOLLECTIONOFSTATPACKSTATISTICS
.SPCREATE.SQL INSTALLSTHESTATSPACKUSER,TABLESANDPACKAGEONADATABASE(RUNASSYS).
.SPDROP.SQL DEINSTALLSTATSPACKFROMDATABASE(RUNASSYS)
.SPPURGE.SQL DELETEARANGEOFSNAPSHOTIDSFROMTHEDATABASE
.SPREPORT.SQL REPORTONDIFFERENCESBETWEENVALUESRECORDEDINTWOSNAPSHOTS
.SPTRUNC.SQL TRUNCATESALLDATAINSTATSPACKTABLES
21. HOWDOYOUADDADATAFILETOATABLESPACE?

ALTERTABLESPACE<TABLESPACE_NAME>ADDDATAFILE<DATAFILE_NAME>SIZE
22. WHATISSAVEPOINT?

FORLONGTRANSACTIONSTHATCONTAINMANYSQLSTATEMENTS,INTERMEDIATEMARKERSORSAVEPOINTSCANBE
DECLAREDWHICHCANBEUSEDTODIVIDEATRANSACTIONINTOSMALLERPARTS.THISALLOWSTHEOPTIONOFLATER
ROLLINGBACKALLWORKPERFORMEDFROMTHECURRENTPOINTINTHETRANSACTIONTOADECLAREDSAVEPOINT
WITHINTHETRANSACTION.
23.WHATISMEANBYPROGRAMGLOBALAREA(PGA)?
ITISAREAINMEMORYTHATISUSEDBYASINGLEORACLEUSERPROCESS.
24. HOWDOESONEMANAGEORACLEDATABASEUSERS?

ORACLEUSERACCOUNTSCANBELOCKED,UNLOCKED,FORCEDTOCHOOSENEWPASSWORDS,ETC.FOREXAMPLE,ALL
ACCOUNTSEXCEPTSYSANDSYSTEMWILLBELOCKEDAFTERCREATINGANORACLE9IDBDATABASEUSINGTHEDB
CONFIGURATIONASSISTANT(DBCA).DBASMUSTUNLOCKTHESEACCOUNTSTOMAKETHEMAVAILABLETOUSERS.
LOOKATTHESEEXAMPLES:
ALTERUSERSCOTTACCOUNTLOCKLOCKAUSERACCOUNT
ALTERUSERSCOTTACCOUNTUNLOCKUNLOCKSALOCKEDUSERSACCOUNT
ALTERUSERSCOTTPASSWORDEXPIREFORCEUSERTOCHOOSEANEWPASSWORD
25. HOWDOESONETUNEORACLEWAITEVENTS?

SOMEWAITEVENTSFROMV$SESSION_WAITANDV$SYSTEM_EVENTVIEWS:
EVENTNAME:

TUNINGRECOMMENDATION:

DBFILESEQUENTIAL
READ

TUNESQLTODOLESSI/O.MAKESUREALLOBJECTSAREANALYZED.REDISTRIBUTEI/OACROSS
DISKS.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

3/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
BUFFERBUSYWAITS

INCREASEDB_CACHE_SIZE(DB_BLOCK_BUFFERSPRIORTO9I)/ANALYZECONTENTIONFROM
SYS.V$BH

LOGBUFFERSPACES

INCREASELOG_BUFFERPARAMETERORMOVELOGFILESTOFASTERDISKS

26. CANONEMONITORHOWFASTATABLEISIMPORTED?

IFYOUNEEDTOMONITORHOWFASTROWSAREIMPORTEDFROMARUNNINGIMPORTJOB,TRYONEOFTHE
FOLLOWINGMETHODS:
METHOD1:
SELECTSUBSTR(SQL_TEXT,INSTR(SQL_TEXT,INTO),30)TABLE_NAME,
ROWS_PROCESSED,
ROUND((SYSDATETO_DATE(FIRST_LOAD_TIME,YYYYMMDDHH24:MI:SS))*24*60,1)MINUTES,
TRUNC(ROWS_PROCESSED/((SYSDATETO_DATE(FIRST_LOAD_TIME,YYYYMMDDHH24:MI:SS))*24*60))ROWS_PER_MIN
FROMSYS.V_$SQLAREA
WHERESQL_TEXTLIKEINSERT%INTO%
ANDCOMMAND_TYPE=2
ANDOPEN_VERSIONS>0
FORTHISTOWORKONENEEDSTOBEONORACLE7.3ORHIGHER(7.2MIGHTALSOBEOK).IFTHEIMPORTHASMORE
THANONETABLE,THISSTATEMENTWILLONLYSHOWINFORMATIONABOUTTHECURRENTTABLEBEINGIMPORTED.
CONTRIBUTEDBYOSVALDOANCAROLA,BS.AS.ARGENTINA.
METHOD2:
USETHEFEEDBACK=NIMPORTPARAMETER.THISCOMMANDWILLTELLIMPTODISPLAYADOTFOREVERYNROWS
IMPORTED.
27. CANONEIMPORTTABLESTOADIFFERENTTABLESPACE?

ORACLEOFFERSNOPARAMETERTOSPECIFYADIFFERENTTABLESPACETOIMPORTDATAINTO.OBJECTSWILLBERE
CREATEDINTHETABLESPACETHEYWEREORIGINALLYEXPORTEDFROM.ONECANALTERTHISBEHAVIOURBY
FOLLOWINGONEOFTHESEPROCEDURES:PRECREATETHETABLE(S)INTHECORRECTTABLESPACE:
.IMPORTTHEDUMPFILEUSINGTHEINDEXFILE=OPTION
.EDITTHEINDEXFILE.REMOVEREMARKSANDSPECIFYTHECORRECTTABLESPACES.
.RUNTHISINDEXFILEAGAINSTYOURDATABASE,THISWILLCREATETHEREQUIREDTABLESINTHEAPPROPRIATE
TABLESPACES
.IMPORTTHETABLE(S)WITHTHEIGNORE=YOPTION.
CHANGETHEDEFAULTTABLESPACEFORTHEUSER:
.REVOKETHEUNLIMITEDTABLESPACEPRIVILEGEFROMTHEUSER
.REVOKETHEUSERSQUOTAFROMTHETABLESPACEFROMWHERETHEOBJECTWASEXPORTED.THISFORCESTHE
IMPORTUTILITYTOCREATETABLESINTHEUSERSDEFAULTTABLESPACE.
.MAKETHETABLESPACETOWHICHYOUWANTTOIMPORTTHEDEFAULTTABLESPACEFORTHEUSER
.IMPORTTHETABLE.
28. WHATISSQL*LOADERANDWHATISITUSEDFOR?

SQL*LOADERISABULKLOADERUTILITYUSEDFORMOVINGDATAFROMEXTERNALFILESINTOTHEORACLEDATABASE.
ITSSYNTAXISSIMILARTOTHATOFTHEDB2LOADUTILITY,BUTCOMESWITHMOREOPTIONS.SQL*LOADERSUPPORTS
VARIOUSLOADFORMATS,SELECTIVELOADING,ANDMULTITABLELOADS.

29. WHATISRMAN?
RECOVERYMANAGERISATOOLTHAT:MANAGESTHEPROCESSOFCREATINGBACKUPSANDALSOMANAGESTHE
PROCESSOFRESTORINGANDRECOVERINGFROMTHEM.
30. WHATISHITRATIO?

ITISAMEASUREOFWELLTHEDATACACHEBUFFERISHANDLINGREQUESTSFORDATA.HITRATIO=(LOGICALREADS
PHYSICALREADSHITSMISSES)/LOGICALREADS.
31. WHYUSERMAN?
NOEXTRACOSTSITSAVAILABLEFREE
RMANINTRODUCEDINORACLE8ITHASBECOMESIMPLERWITHNEWERVERSIONSANDEASIERTHANUSERMANAGED
BACKUPS
PROPERSECURITY
YOUARE100%SUREYOURDATABASEHASBEENBACKEDUP.
ITSCONTAINSDETAILOFTHEBACKUPSTAKENETCINITSCENTRALREPOSITORY
FACILITYFORTESTINGVALIDITYOFBACKUPSALSOCOMMANDSLIKECROSSCHECKTOCHECKTHESTATUSOFBACKUP.
FASTERBACKUPSANDRESTORESCOMPAREDTOBACKUPSWITHOUTRMAN
RMANISTHEONLYBACKUPTOOLWHICHSUPPORTSINCREMENTALBACKUPS.
ORACLE10GHASGOTFURTHEROPTIMIZEDINCREMENTALBACKUPWHICHHASRESULTEDINIMPROVEMENTOF

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

4/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
PERFORMANCEDURINGBACKUPANDRECOVERYTIME
PARALLELOPERATIONSARESUPPORTED
BETTERQUERYINGFACILITYFORKNOWINGDIFFERENTDETAILSOFBACKUP
NOEXTRAREDOGENERATEDWHENBACKUPISTAKEN..COMPAREDTOONLINE
BACKUPWITHOUTRMANWHICHRESULTSINSAVINGOFSPACEINHARDDISK
RMANANINTELLIGENTTOOL
MAINTAINSREPOSITORYOFBACKUPMETADATA
REMEMBERSBACKUPSETLOCATION
KNOWSWHATNEEDTOBACKEDUP
KNOWSWHATISREQUIREDFORRECOVERY
KNOWSWHATBACKUPSAREREDUNDANT

UNDERSTANDINGTHERMANARCHITECTURE
ANORACLERMANCOMPRISESOFRMANEXECUTABLETHISCOULDBEPRESENTANDFIREDEVENTHROUGHCLIENTSIDE
TARGETDATABASETHISISTHEDATABASEWHICHNEEDSTOBEBACKEDUP.RECOVERYCATALOGRECOVERYCATALOG
ISOPTIONALOTHERWISEBACKUPDETAILSARESTOREDINTARGETDATABASECONTROLFILE.
ITISAREPOSITORYOFINFORMATIONQUERIEDANDUPDATEDBYRECOVERYMANAGER
ITISASCHEMAORUSERSTOREDINORACLEDATABASE.ONESCHEMACANSUPPORTMANYDATABASES
ITCONTAINSINFORMATIONABOUTPHYSICALSCHEMAOFTARGETDATABASEDATAFILEANDARCHIVELOG,BACKUP
SETSANDPIECESRECOVERYCATALOGISAMUSTINFOLLOWINGSCENARIOS
.INORDERTOSTORESCRIPTS.FORTABLESPACEPOINTINTIMERECOVERY
MEDIAMANAGEMENTSOFTWARE
MEDIAMANAGEMENTSOFTWAREISAMUSTIFYOUAREUSINGRMANFORSTORINGBACKUPINTAPEDRIVEDIRECTLY.
BACKUPSINRMAN
ORACLEBACKUPSINRMANAREOFTHEFOLLOWINGTYPE
RMANCOMPLETEBACKUPORRMANINCREMENTALBACKUP
THESEBACKUPSAREOFRMANPROPRIETARYNATURE
IMAGECOPY
THEADVANTAGEOFUINGIMAGECOPYISITSNOTINRMANPROPRIETARYFORMAT..
BACKUPFORMAT
RMANBACKUPISNOTINORACLEFORMATBUTINRMANFORMAT.ORACLEBACKUPCOMPRISESOFBACKUPSETSANDIT
CONSISTSOFBACKUPPIECES.BACKUPSETSARELOGICALENTITYINORACLE9IITGETSSTOREDINADEFAULT
LOCATIONTHEREARETWOTYPEOFBACKUPSETSDATAFILEBACKUPSETS,ARCHIVELOGBACKUPSETSONEMORE
IMPORTANTPOINTOFDATAFILEBACKUPSETSISITDONOTINCLUDEEMPTYBLOCKS.ABACKUPSETWOULDCONTAIN
MANYBACKUPPIECES.
ASINGLEBACKUPPIECECONSISTSOFPHYSICALFILESWHICHAREINRMANPROPRIETARYFORMAT.
EXAMPLEOFTAKINGBACKUPUSINGRMAN
TAKINGRMANBACKUP
INNONARCHIVEMODEINDOSPROMPTTYPERMAN
YOUGETTHERMANPROMPT
RMAN>CONNECTTARGET
CONNECTTOTARGETDATABASE:MAGIC
USINGTARGETDATABASECONTROLFILEINSTEADOFRECOVERYCATALOG
LETSTAKEASIMPLEBACKUPOFDATABASEINNONARCHIVEMODE
SHUTDOWNIMMEDIATESHUTDOWNSTHEDATABASE
STARTUPMOUNT
BACKUPDATABASEITSSTARTBACKINGTHEDATABASE
ALTERDATABASEOPEN
WECANFIRETHESAMECOMMANDINARCHIVELOGMODE
ANDWHOLEOFDATAFILESWILLBEBACKED
BACKUPDATABASEPLUSARCHIVELOG
RESTORINGDATABASE
RESTORINGDATABASEHASBEENMADEVERYSIMPLEIN9I.
ITISJUSTRESTOREDATABASE..
RMANHASBECOMEINTELLIGENTTOIDENTIFYWHICHDATAFILESHASTOBERESTORED
ANDTHELOCATIONOFBACKUPEDUPFILE.
ORACLEENHANCEMENTFORRMANIN10GFLASHRECOVERYAREA
RIGHTNOWTHEPRICEOFHARDDISKISFALLING.MANYDBAARETAKINGORACLEDATABASEBACKUPINSIDETHEHARD
DISKITSELFSINCEITRESULTSINLESSERMEANTIMEBETWEENRECOVERABILITY.
THENEWPARAMETERINTRODUCEDIS
DB_RECOVERY_FILE_DEST=/ORACLE/FLASH_RECOVERY_AREA
BYCONFIGURINGTHERMANRETENTIONPOLICYTHEFLASHRECOVERYAREAWILLAUTOMATICALLYDELETEOBSOLETE
BACKUPSANDARCHIVELOGSTHATARENOLONGERREQUIREDBASEDONTHATCONFIGURATIONORACLEHAS
INTRODUCEDNEWFEATURESININCREMENTALBACKUP

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

5/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
CHANGETRACKINGFILE
ORACLE10GHASTHEFACILITYTODELIVERFASTERINCREMENTALSWITHTHEIMPLEMENTATIONOFCHANGEDTRACKING
FILEFEATURE.THISWILLRESULTSINFASTERBACKUPSLESSERSPACECONSUMPTIONANDALSOREDUCESTHETIME
NEEDEDFORDAILYBACKUPS
INCREMENTALLYUPDATEDBACKUPS
ORACLEDATABASE10GINCREMENTALLYUPDATESBACKUPFEATURESMERGESTHEIMAGECOPYOFADATAFILEWITH
RMANINCREMENTALBACKUP.THERESULTINGIMAGECOPYISNOWUPDATEDWITHBLOCKCHANGESCAPTUREDBY
INCREMENTALBACKUPS.THEMERGINGOFTHEIMAGECOPYANDINCREMENTALBACKUPISINITIATEDWITHRMAN
RECOVERCOMMAND.THISRESULTSINFASTERRECOVERY.
BINARYCOMPRESSIONTECHNIQUEREDUCESBACKUPSPACEUSAGEBY5075%.

WITHTHENEWDURATIONOPTIONFORTHERMANBACKUPCOMMAND,DBASCANWEIGHBACKUPPERFORMANCE
AGAINSTSYSTEMSERVICELEVELREQUIREMENTS.BYSPECIFYINGADURATION,RMANWILLAUTOMATICALLY
CALCULATETHEAPPROPRIATEBACKUPRATEINADDITION,DBASCANOPTIONALLYSPECIFYWHETHERBACKUPS
SHOULDMINIMIZETIMEORSYSTEMLOAD.
NEWFEATURESINOEMTOIDENTIFYRMANRELATEDBACKUPLIKEBACKUPPIECES,BACKUPSETSANDIMAGECOPY
ORACLE9INEWFEATURESPERSISTENTRMANCONFIGURATION
ANEWCONFIGURECOMMANDHASBEENINTRODUCEDINORACLE9I,THATLETSYOUCONFIGUREVARIOUSFEATURES
INCLUDINGAUTOMATICCHANNELS,PARALLELISM,BACKUPOPTIONS,ETC.
THESEAUTOMATICALLOCATIONSANDOPTIONSCANBEOVERRIDDENBYCOMMANDSINARMANCOMMANDFILE.
CONTROLFILEAUTOBACKUPS
THROUGHTHISNEWFEATURERMANWILLAUTOMATICALLYPERFORMACONTROLFILEAUTOBACKUP.AFTEREVERY
BACKUPORCOPYCOMMAND.
BLOCKMEDIARECOVERY
IFWECANRESTOREAFEWBLOCKSRATHERTHANANENTIREFILEWEONLYNEEDFEWBLOCKS.
WEEVENDONTNEEDTOBRINGTHEDATAFILEOFFLINE.
SYNTAXFORITASFOLLOWS
BLOCKRECOVERDATAFILE8BLOCK22
CONFIGUREBACKUPOPTIMIZATION
PRIORTO9IWHENEVERWEBACKEDUPDATABASEUSINGRMANOURBACKUPALSOUSEDTAKEBACKUPOFREADONLY
TABLESPACESWHICHHADALREADYBEENBACKEDUPANDALSOTHESAMEWITHARCHIVELOGTOO.
NOWWITH9IBACKUPOPTIMIZATIONPARAMETERWECANPREVENTREPEATBACKUPOFREADONLYTABLESPACEAND
ARCHIVELOG.THECOMMANDFORTHISISASFOLLOWSCONFIGUREBACKUPOPTIMIZATIONON
ARCHIVELOGFAILOVER
IFRMANCANNOTREADABLOCKINANARCHIVEDLOGFROMADESTINATION.RMANAUTOMATICALLYATTEMPTSTO
READFROMANALTERNATELOCATIONTHISISCALLEDASARCHIVELOGFAILOVER

THEREAREADDITIONALCOMMANDSLIKE
BACKUPDATABASENOTBACKEDUPSINCETIME31JAN200214:00:00
DONOTBACKUPPREVIOUSLYBACKEDUPFILES
(SAYAPREVIOUSBACKUPFAILEDANDYOUWANTTORESTARTFROMWHEREITLEFTOFF).
SIMILARSYNTAXISSUPPORTEDFORRESTORES
BACKUPDEVICESBTBACKUPSETALLCOPYADISKBACKUPTOTAPE
(BACKINGUPABACKUP
ADDITIONALLYITSUPPORTS
.BACKUPOFSERVERPARAMETERFILE
.PARALLELOPERATIONSUPPORTED
.EXTENSIVEREPORTINGAVAILABLE
.SCRIPTING
.DUPLEXBACKUPSETS
.CORRUPTBLOCKDETECTION
.BACKUPARCHIVELOGS
PITFALLSOFUSINGRMAN
PREVIOUSTOVERSIONORACLE9IBACKUPSWERENOTTHATEASYWHICHMEANSYOUHADTOALLOCATEACHANNEL
COMPULSORILYTOTAKEBACKUPYOUHADTOGIVEARUNETC.THESYNTAXWASABITCOMPLEXRMANHASNOW
BECOMEVERYSIMPLEANDEASYTOUSE..
IFYOUCHANGEDTHELOCATIONOFBACKUPSETITISCOMPULSORYFORYOUTOREGISTERITUSINGRMANORWHILE
YOUARETRYINGTORESTOREBACKUPITRESULTEDINHANGINGSITUATIONS
THEREISNOMETHODTOKNOWWHETHERDURINGRECOVERYDATABASERESTOREISGOINGTOFAILBECAUSEOF
MISSINGARCHIVELOGFILE.COMPULSORYMEDIAMANAGEMENTONLYIFUSINGTAPEBACKUP
INCREMENTALBACKUPSTHOUGHUSEDTOCONSUMELESSSPACEUSEDTOBESLOWERSINCEITUSEDTOREADTHE
ENTIREDATABASETOFINDTHECHANGEDBLOCKSANDALSOTHEYHAVEDIFFICULTTIMESTREAMINGTHETAPEDEVICE.
.
CONSIDERABLEIMPROVEMENTHASBEENMADEIN10GTOOPTIMIZETHEALGORITHMTOHANDLECHANGEDBLOCK.
OBSERVATION:
INTRODUCEDINORACLE8ITHASBECOMEMOREPOWERFULANDSIMPLERWITHNEWERVERSIONOFORACLE9AND10
G.SOIFYOUREALLYDONTWANTTOMISSSOMETHINGCRITICALPLEASESTARTUSINGRMAN.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

6/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
1. WHATHAPPENSWHENYOURUNALTERDATABASEOPENRESETLOGS?
THECURRENTONLINEREDOLOGSAREARCHIVED,THELOGSEQUENCENUMBERISRESETTO1,NEWDATABASE
INCARNATIONISCREATED,ANDTHEONLINEREDOLOGSAREGIVENANEWTIMESTAMPANDSCN.2.INWHAT
SCENARIOSOPENRESETLOGSREQUIRED?ANALTERDATABASEOPENRESETLOGSSTATEMENTISREQUIREDAFTER
INCOMPLETERECOVERY(POINTINTIMERECOVERY)ORRECOVERYWITHABACKUPCONTROLFILE.3 .WHATISSCN
(SYSTEMCHANGENUMBER)?
THESYSTEMCHANGENUMBER(SCN)ISANEVERINCREASINGVALUETHATUNIQUELYIDENTIFIESACOMMITTED
VERSIONOFTHEDATABASEATAPOINTINTIME.EVERYTIMEAUSERCOMMITSATRANSACTIONORACLERECORDSA
NEWSCNINREDOLOGS.
ORACLEUSESSCNSINCONTROLFILESDATAFILEHEADERSANDREDORECORDS.EVERYREDOLOGFILEHASBOTHA
LOGSEQUENCENUMBERANDLOWANDHIGHSCN.THELOWSCNRECORDSTHELOWESTSCNRECORDEDINTHELOG
FILEWHILETHEHIGHSCNRECORDSTHEHIGHESTSCNINTHELOGFILE.
4.WHATISDATABASEINCARNATION?

DATABASEINCARNATIONISEFFECTIVELYANEWVERSIONOFTHEDATABASETHATHAPPENSWHENYOURESETTHE
ONLINEREDOLOGSUSINGALTERDATABASEOPENRESETLOGS.
DATABASEINCARNATIONFALLSINTOFOLLOWINGCATEGORYCURRENT,PARENT,ANCESTORANDSIBLING
I)CURRENTINCARNATION:THEDATABASEINCARNATIONINWHICHTHEDATABASEISCURRENTLYGENERATINGREDO.
II)PARENTINCARNATION:THEDATABASEINCARNATIONFROMWHICHTHECURRENTINCARNATIONBRANCHED
FOLLOWINGANOPENRESETLOGSOPERATION.
III)ANCESTORINCARNATION:THEPARENTOFTHEPARENTINCARNATIONISANANCESTORINCARNATION.ANYPARENT
OFANANCESTORINCARNATIONISALSOANANCESTORINCARNATION.
IV)SIBLINGINCARNATION:TWOINCARNATIONSTHATSHAREACOMMONANCESTORARESIBLINGINCARNATIONSIF
NEITHERONEISANANCESTOROFTHEOTHER.
5.HOWTOVIEWINCARNATIONHISTORYOFDATABASE?

USINGSQL>SELECT*FROMV$DATABASE_INCARNATION
USINGRMAN>LISTINCARNATION
HOWEVER,YOUCANUSETHERESETDATABASETOINCARNATIONCOMMANDTOSPECIFYTHATSCNSARETOBE
INTERPRETEDINTHEFRAMEOFREFERENCEOFANOTHERINCARNATION.
FOREXAMPLEMYCURRENTDATABASEINCARNATIONIS3ANDNOWIHAVEUSED
FLASHBACKDATABASETOSCN3000THENSCN3000WILLBESEARCHINCURRENTINCARNATIONWHICHIS3.HOWEVER
IFIWANTTOGETBACKTOSCN3000OFINCARNATION2THENIHAVETOUSE,
RMAN>RESETDATABASETOINCARNATION2
RMAN>RECOVERDATABASETOSCN3000

1. GIVEONEMETHODFORTRANSFERRINGATABLEFROMONESCHEMATOANOTHER?ANSWER:THEREARESEVERAL
POSSIBLEMETHODS,EXPORTIMPORT,CREATETABLEASSELECT,ORCOPY.
2.WHATISTHEPURPOSEOFTHEIMPORTOPTIONIGNORE?WHATISIT?SDEFAULTSETTING?
LEVEL:LOW
EXPECTEDANSWER:THEIMPORTIGNOREOPTIONTELLSIMPORTTOIGNOREALREADYEXISTSERRORS.IFITISNOT
SPECIFIEDTHETABLESTHATALREADYEXISTWILLBESKIPPED.IFITISSPECIFIED,THEERRORISIGNOREDANDTHE
TABLESDATAWILLBEINSERTED.THEDEFAULTVALUEISN.
3.YOUHAVEAROLLBACKSEGMENTINAVERSION7.2DATABASETHATHASEXPANDEDBEYONDOPTIMAL,HOWCAN
ITBERESTOREDTOOPTIMAL?
LEVEL:LOW
EXPECTEDANSWER:USETHEALTERTABLESPACE..SHRINKCOMMAND.
4.IFTHEDEFAULTANDTEMPORARYTABLESPACECLAUSESARELEFTOUTOFACREATEUSERCOMMANDWHAT
HAPPENS?ISTHISBADORGOOD?WHY?
LEVEL:LOW
EXPECTEDANSWER:THEUSERISASSIGNEDTHESYSTEMTABLESPACEASADEFAULTANDTEMPORARYTABLESPACE.
THISISBADBECAUSEITCAUSESUSEROBJECTSANDTEMPORARYSEGMENTSTOBEPLACEDINTOTHESYSTEM
TABLESPACERESULTINGINFRAGMENTATIONANDIMPROPERTABLEPLACEMENT(ONLYDATADICTIONARYOBJECTS
ANDTHESYSTEMROLLBACKSEGMENTSHOULDBEINSYSTEM).
5.WHATARESOMEOFTHEORACLEPROVIDEDPACKAGESTHATDBASSHOULDBEAWAREOF?
LEVEL:INTERMEDIATETOHIGH
EXPECTEDANSWER:ORACLEPROVIDESANUMBEROFPACKAGESINTHEFORMOFTHEDBMS_PACKAGESOWNEDBY
THESYSUSER.THEPACKAGESUSEDBYDBASMAYINCLUDE:DBMS_SHARED_POOL,DBMS_UTILITY,DBMS_SQL,
DBMS_DDL,DBMS_SESSION,DBMS_OUTPUTANDDBMS_SNAPSHOT.THEYMAYALSOTRYTOANSWERWITHTHE
UTL*.SQLORCAT*.SQLSERIESOFSQLPROCEDURES.THESECANBEVIEWEDASEXTRACREDITBUTAREN?TPARTOF
THEANSWER.
6.WHATHAPPENSIFTHECONSTRAINTNAMEISLEFTOUTOFACONSTRAINTCLAUSE?
LEVEL:LOW
EXPECTEDANSWER:THEORACLESYSTEMWILLUSETHEDEFAULTNAMEOFSYS_CXXXXWHEREXXXXISASYSTEM
GENERATEDNUMBER.THISISBADSINCEITMAKESTRACKINGWHICHTABLETHECONSTRAINTBELONGSTOORWHAT
THECONSTRAINTDOESHARDER.
7.WHATHAPPENSIFATABLESPACECLAUSEISLEFTOFFOFAPRIMARYKEYCONSTRAINTCLAUSE?
LEVEL:LOW
EXPECTEDANSWER:THISRESULTSINTHEINDEXTHATISAUTOMATICALLYGENERATEDBEINGPLACEDINTHEN

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

7/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
USERSDEFAULTTABLESPACE.SINCETHISWILLUSUALLYBETHESAMETABLESPACEASTHETABLEISBEING
CREATEDIN,THISCANCAUSESERIOUSPERFORMANCEPROBLEMS.
8.WHATISTHEPROPERMETHODFORDISABLINGANDREENABLINGAPRIMARYKEYCONSTRAINT?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:YOUUSETHEALTERTABLECOMMANDFORBOTH.HOWEVER,FORTHEENABLECLAUSEYOU
MUSTSPECIFYTHEUSINGINDEXANDTABLESPACECLAUSEFORPRIMARYKEYS.
9.WHATHAPPENSIFAPRIMARYKEYCONSTRAINTISDISABLEDANDTHENENABLEDWITHOUTFULLYSPECIFYINGTHE
INDEXCLAUSE?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:THEINDEXISCREATEDINTHEUSER?SDEFAULTTABLESPACEANDALLSIZINGINFORMATIONIS
LOST.ORACLEDOESN?TSTORETHISINFORMATIONASAPARTOFTHECONSTRAINTDEFINITION,BUTONLYASPART
OFTHEINDEXDEFINITION,WHENTHECONSTRAINTWASDISABLEDTHEINDEXWASDROPPEDANDTHEINFORMATION
ISGONE.
10.(ONUNIX)WHENSHOULDMORETHANONEDBWRITERPROCESSBEUSED?HOWMANYSHOULDBEUSED?
LEVEL:HIGH
EXPECTEDANSWER:IFTHEUNIXSYSTEMBEINGUSEDISCAPABLEOFASYNCHRONOUSIOTHENONLYONEIS
REQUIRED,IFTHESYSTEMISNOTCAPABLEOFASYNCHRONOUSIOTHENUPTOTWICETHENUMBEROFDISKSUSED
BYORACLENUMBEROFDBWRITERSSHOULDBESPECIFIEDBYUSEOFTHEDB_WRITERSINITIALIZATIONPARAMETER.
11.YOUAREUSINGHOTBACKUPWITHOUTBEINGINARCHIVELOGMODE,CANYOURECOVERINTHEEVENTOFA
FAILURE?WHYORWHYNOT?
LEVEL:HIGH
EXPECTEDANSWER:YOUCAN?TUSEHOTBACKUPWITHOUTBEINGINARCHIVELOGMODE.SONO,YOUCOULDN?T
RECOVER.
12.WHATCAUSESTHESNAPSHOTTOOOLDERROR?HOWCANTHISBEPREVENTEDORMITIGATED?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:THISISCAUSEDBYLARGEORLONGRUNNINGTRANSACTIONSTHATHAVEEITHERWRAPPED
ONTOTHEIROWNROLLBACKSPACEORHAVEHADANOTHERTRANSACTIONWRITEONPARTOFTHEIRROLLBACK
SPACE.THISCANBEPREVENTEDORMITIGATEDBYBREAKINGTHETRANSACTIONINTOASETOFSMALLER
TRANSACTIONSORINCREASINGTHESIZEOFTHEROLLBACKSEGMENTSANDTHEIREXTENTS.
13.HOWCANYOUTELLIFADATABASEOBJECTISINVALID?
LEVEL:LOW
EXPECTEDANSWER:BYCHECKINGTHESTATUSCOLUMNOFTHEDBA_,ALL_ORUSER_OBJECTSVIEWS,DEPENDING
UPONWHETHERYOUOWNORONLYHAVEPERMISSIONONTHEVIEWORAREUSINGADBAACCOUNT.
14.AUSERISGETTINGANORA00942ERRORYETYOUKNOWYOUHAVEGRANTEDTHEMPERMISSIONONTHETABLE,
WHATELSESHOULDYOUCHECK?
LEVEL:LOW
EXPECTEDANSWER:YOUNEEDTOCHECKTHATTHEUSERHASSPECIFIEDTHEFULLNAMEOFTHEOBJECT(SELECT
EMPIDFROMSCOTT.EMPINSTEADOFSELECTEMPIDFROMEMP)ORHASASYNONYMTHATPOINTSTOTHEOBJECT
(CREATESYNONYMEMPFORSCOTT.EMP)
15.ADEVELOPERISTRYINGTOCREATEAVIEWANDTHEDATABASEWON?TLETHIM.HEHASTHEDEVELOPERROLE
WHICHHASTHECREATEVIEWSYSTEMPRIVILEGEANDSELECTGRANTSONTHETABLESHEISUSING,WHATISTHE
PROBLEM?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:YOUNEEDTOVERIFYTHEDEVELOPERHASDIRECTGRANTSONALLTABLESUSEDINTHEVIEW.
YOUCAN?TCREATEASTOREDOBJECTWITHGRANTSGIVENTHROUGHVIEWS.
16.IFYOUHAVEANEXAMPLETABLE,WHATISTHEBESTWAYTOGETSIZINGDATAFORTHEPRODUCTIONTABLE
IMPLEMENTATION?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:THEBESTWAYISTOANALYZETHETABLEANDTHENUSETHEDATAPROVIDEDINTHE
DBA_TABLESVIEWTOGETTHEAVERAGEROWLENGTHANDOTHERPERTINENTDATAFORTHECALCULATION.THE
QUICKANDDIRTYWAYISTOLOOKATTHENUMBEROFBLOCKSTHETABLEISACTUALLYUSINGANDRATIOTHE
NUMBEROFROWSINTHETABLETOITSNUMBEROFBLOCKSAGAINSTTHENUMBEROFEXPECTEDROWS.
17.HOWCANYOUFINDOUTHOWMANYUSERSARECURRENTLYLOGGEDINTOTHEDATABASE?HOWCANYOUFIND
THEIROPERATINGSYSTEMID?
LEVEL:HIGH
EXPECTEDANSWER:THEREARESEVERALWAYS.ONEISTOLOOKATTHEV$SESSIONORV$PROCESSVIEWS.
ANOTHERWAYISTOCHECKTHECURRENT_LOGINSPARAMETERINTHEV$SYSSTATVIEW.ANOTHERIFYOUAREON
UNIXISTODOAPSEF|GREPORACLE|WCL?COMMAND,BUTTHISONLYWORKSAGAINSTASINGLEINSTANCE
INSTALLATION.
18.AUSERSELECTSFROMASEQUENCEANDGETSBACKTWOVALUES,HISSELECTIS:
SELECTPK_SEQ.NEXTVALFROMDUAL
WHATISTHEPROBLEM?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:SOMEHOWTWOVALUESHAVEBEENINSERTEDINTOTHEDUALTABLE.THISTABLEISASINGLE
ROW,SINGLECOLUMNTABLETHATSHOULDONLYHAVEONEVALUEINIT.
19.HOWCANYOUDETERMINEIFANINDEXNEEDSTOBEDROPPEDANDREBUILT?
LEVEL:INTERMEDIATE
EXPECTEDANSWER:RUNTHEANALYZEINDEXCOMMANDONTHEINDEXTOVALIDATEITSSTRUCTUREANDTHEN
CALCULATETHERATIOOFLF_BLK_LEN/LF_BLK_LEN+BR_BLK_LENANDIFITISN?TNEAR1.0(I.E.GREATERTHAN0.7
ORSO)THENTHEINDEXSHOULDBEREBUILT.ORIFTHERATIO
BR_BLK_LEN/LF_BLK_LEN+BR_BLK_LENISNEARING0.3.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

8/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning

TUNINGINTERVIEWQUESTIONS
1. Atablespacehasatablewith30extentsinit.Isthisbad?Whyorwhynot.
Level:Intermediate
Expectedanswer:Multipleextentsinandofthemselvesaren?tbad.Howeverifyoualsohavechainedrowsthiscanhurt
performance.
2. HowdoyousetuptablespacesduringanOracleinstallation?
Level:Low
Expectedanswer:YoushouldalwaysattempttousetheOracleFlexibleArchitecturestandardoranotherpartitioningschemeto
ensureproperseparationofSYSTEM,ROLLBACK,REDOLOG,DATA,TEMPORARYandINDEXsegments.
3. YouseemultiplefragmentsintheSYSTEMtablespace,whatshouldyoucheckfirst?
Level:Low
Expectedanswer:Ensurethatusersdon?thavetheSYSTEMtablespaceastheirTEMPORARYorDEFAULTtablespace
assignmentbycheckingtheDBA_USERSview.
4. WhataresomeindicationsthatyouneedtoincreasetheSHARED_POOL_SIZEparameter?
Level:Intermediate
Expectedanswer:Poordatadictionaryorlibrarycachehitratios,gettingerrorORA04031.Anotherindicationissteadily
decreasingperformancewithallothertuningparametersthesame.
5. Whatisthegeneralguidelineforsizingdb_block_sizeanddb_multi_block_readforanapplicationthatdoesmanyfulltable
scans?
Level:High
Expectedanswer:Oraclealmostalwaysreadsin64kchunks.Thetwoshouldhaveaproductequalto64oramultipleof64.
6. Whatisthefastestquerymethodforatable?
Level:Intermediate
Expectedanswer:Fetchbyrowid
7. ExplaintheuseofTKPROF?WhatinitializationparametershouldbeturnedontogetfullTKPROFoutput?
Level:High
Expectedanswer:ThetkproftoolisatuningtoolusedtodeterminecpuandexecutiontimesforSQLstatements.Youuseitby
firstsettingtimed_statisticstotrueintheinitializationfileandthenturningontracingforeithertheentiredatabaseviathe
sql_traceparameterorforthesessionusingtheALTERSESSIONcommand.Oncethetracefileisgeneratedyourunthetkprof
toolagainstthetracefileandthenlookattheoutputfromthetkproftool.Thiscanalsobeusedtogenerateexplainplanoutput.
8. Whenlookingatv$sysstatyouseethatsorts(disk)ishigh.Isthisbador
good?IfbadHowdoyoucorrectit?
Level:Intermediate
Expectedanswer:Ifyougetexcessivedisksortsthisisbad.Thisindicatesyouneedtotunethesortareaparametersinthe
initializationfiles.ThemajorsortareparameteristheSORT_AREA_SIZeparameter.
9. Whenshouldyouincreasecopylatches?Whatparameterscontrolcopylatches?
Level:high
Expectedanswer:Whenyougetexcessivecontentionforthecopylatchesasshownbytheredocopylatchhitratio.Youcan
increasecopylatchesviatheinitializationparameterLOG_SIMULTANEOUS_COPIEStotwicethenumberofCPUsonyour
system.
10. Wherecanyougetalistofallinitializationparametersforyourinstance?Howaboutanindicationiftheyaredefaultsettingsor
havebeenchanged?
Level:Low
Expectedanswer:Youcanlookintheinit.orafileforanindicationofmanuallysetparameters.Forallparameters,theirvalueand
whetherornotthecurrentvalueisthedefaultvalue,lookinthev$parameterview.
11. Describehitratioasitpertainstothedatabasebuffers.Whatisthedifferencebetweeninstantaneousandcumulativehitratioand
whichshouldbeusedfortuning?
Level:Intermediate
Expectedanswer:Thehitratioisameasureofhowmanytimesthedatabasewasabletoreadavaluefromthebuffersverses
howmanytimesithadtorereadadatavaluefromthedisks.Avaluegreaterthan8090%isgood,lesscouldindicateproblems.
Ifyousimplytaketheratioofexistingparametersthiswillbeacumulativevaluesincethedatabasestarted.Ifyoudoa
comparisonbetweenpairsofreadingsbasedonsomearbitrarytimespan,thisistheinstantaneousratioforthattimespan.
Generallyspeakinganinstantaneousreadinggivesmorevaluabledatasinceitwilltellyouwhatyourinstanceisdoingforthe
timeitwasgeneratedover.
12. Discussrowchaining,howdoesithappen?Howcanyoureduceit?Howdoyoucorrectit?
Level:high
Expectedanswer:RowchainingoccurswhenaVARCHAR2valueisupdatedandthelengthofthenewvalueislongerthanthe
oldvalueandwon?tfitintheremainingblockspace.Thisresultsintherowchainingtoanotherblock.Itcanbereducedby
settingthestorageparametersonthetabletoappropriatevalues.Itcanbecorrectedbyexportandimportoftheeffectedtable.
13. Whenlookingattheestateventsreportyouseethatyouaregettingbusybufferwaits.Isthisbad?Howcanyoufindwhatis
causingit?

Level:high
Expectedanswer:Bufferbusywaitscouldindicatecontentioninredo,rollbackordatablocks.Youneedtocheckthev$waitstatview
toseewhatareasarecausingtheproblem.Thevalueofthecountcolumntellswheretheproblemis,theclasscolumntellsyou

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

9/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
withwhat.UNDOisrollbacksegments,DATAisdatabasebuffers.
14. Ifyouseecontentionforlibrarycacheshowcanyoufixit?
Level:Intermediate
Expectedanswer:Increasethesizeofthesharedpool.
15. Ifyouseestatisticsthatdealwithundowhataretheyreallytalkingabout?
Level:Intermediate
Expectedanswer:Rollbacksegmentsandassociatedstructures.
16. Ifatablespacehasadefaultpctincreaseofzerowhatwillthiscause(inrelationshiptothesmonprocess)?
Level:High
Expectedanswer:TheSMONprocesswon?tautomaticallycoalesceitsfreespacefragments.
17. Ifatablespaceshowsexcessivefragmentationwhataresomemethodstodefragmentthetablespace?(7.1,7.2and7.3only)
Level:High
Expectedanswer:InOracle7.0to7.2Theuseofthealtersessionseteventsimmediatetracenamecoalescelevelts#'?
commandistheeasiestwaytodefragmentcontiguousfreespacefragmentation.Thets#parametercorrespondstothets#value
foundinthets$SYStable.Inversion7.3the?altertablespacecoalesce?isbest.Ifthefreespaceisn?tcontiguousthenexport,
dropandimportofthetablespacecontentsmaybetheonlywaytoreclaimnoncontiguousfreespace.
18. Howcanyoutellifatablespacehasexcessivefragmentation?
Level:Intermediate
Ifaselectagainstthedba_free_spacetableshowsthatthecountofatablespacesextentsisgreaterthanthecountofitsdata
files,thenitisfragmented.
19. Youseethefollowingonastatusreport:
redologspacerequests23
redologspacewaittime0
Isthissomethingtoworryabout?Whatifredologspacewaittimeishigh?Howcanyoufixthis?
Level:Intermediate
Expectedanswer:Sincethewaittimeiszero,no.Ifthewaittimewashighitmightindicateaneedformoreorlargerredologs.
20. Whatcancauseahighvalueforrecursivecalls?Howcanthisbefixed?
Level:High
Expectedanswer:Ahighvalueforrecursivecallsiscausebyimpropercursorusage,excessivedynamicspacemanagement
actions,andorexcessivestatementreparses.YouneedtodeterminethecauseandcorrectitByeitherrelinkingapplicationsto
holdcursors,useproperspacemanagementtechniques(properstorageandsizing)orensurerepeatqueriesareplacedin
packagesforproperreuse.
21. Ifyouseeapinhitratiooflessthan0.8intheestatlibrarycachereportisthisaproblem?Ifso,howdoyoufixit?
Level:Intermediate
Expectedanswer:Thisindicatethatthesharedpoolmaybetoosmall.Increasethesharedpoolsize.
22. Ifyouseethevalueforreloadsishighintheestatlibrarycachereportisthisamatterforconcern?
Level:Intermediate
Expectedanswer:Yes,youshouldstriveforzeroreloadsifpossible.Ifyouseeexcessivereloadsthenincreasethesizeofthe
sharedpool.
23. Youlookatthedba_rollback_segsviewandseethatthereisalargenumberofshrinksandtheyareofrelativelysmallsize,isthis
aproblem?Howcanitbefixedifitisaproblem?
Level:High
Expectedanswer:Alargenumberofsmallshrinksindicatesaneedtoincreasethesizeoftherollbacksegmentextents.Ideally
youshouldhavenoshrinksorasmallnumberoflargeshrinks.Tofixthisjustincreasethesizeoftheextentsandadjustoptimal
accordingly.
24. Youlookatthedba_rollback_segsviewandseethatyouhavealargenumberofwrapsisthisaproblem?
Level:High
Expectedanswer:Alargenumberofwrapsindicatesthatyourextentsizeforyourrollbacksegmentsareprobablytoosmall.
Increasethesizeofyourextentstoreducethenumberofwraps.Youcanlookattheaveragetransactionsizeinthesameview
togettheinformationontransactionsize.
25. Inasystemwithanaverageof40concurrentusersyougetthefollowingfromaqueryonrollbackextents:
ROLLBACKCUREXTENTS

R0111
R028
R0312
R049
SYSTEM4
Youhaveroomforeachtogrowby20moreextentseach.Isthereaproblem?Shouldyoutakeanyaction?
Level:Intermediate
Expectedanswer:Nothereisnotaproblem.Youhave40extentsshowingandanaverageof40concurrentusers.Sincethere
isplentyofroomtogrownoactionisneeded.
26. Youseemultipleextentsinthetemporarytablespace.Isthisaproblem?
Level:Intermediate
Expectedanswer:Aslongastheyareallthesamesizethisisn?taproblem.Infact,itcanevenimproveperformancesince
Oraclewon?thavetocreateanewextentwhenauserneedsone.

INSTALLATION/CONFIGURATIONINTERVIEWQUESTIONS

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

10/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
1. DefineOFA.
Level:Low
Expectedanswer:OFAstandsforOptimalFlexibleArchitecture.ItisamethodofplacingdirectoriesandfilesinanOraclesystem
sothatyougetthemaximumflexibilityforfuturetuningandfileplacement.
2. Howdoyousetupyourtablespaceoninstallation?
Level:Low
Expectedanswer:Theanswerhereshouldshowanunderstandingofseparationofredoandrollback,dataandindexesand
isolationosSYSTEMtablesfromothertables.Anexamplewouldbetospecifythatatleast7disksshouldbeusedforanOracle
installationsothatyoucanplaceSYSTEMtablespaceonone,redologsontwo(mirroredredologs)theTEMPORARY
tablespaceonanother,ROLLBACKtablespaceonanotherandstillhavetwoforDATAandINDEXES.Theyshouldindicatehow
theywillhandlearchivelogsandexportsaswell.Aslongastheyhavealogicalplanforcombiningorfurtherseparationmoreor
lessdiskscanbespecified.
3. WhatshouldbedonepriortoinstallingOracle(fortheOSandthedisks)?
Level:Low
ExpectedAnswer:adjustkernelparametersorOStuningparametersinaccordancewithinstallationguide.Besureenough
contiguousdiskspaceisavailable.
4. YouhaveinstalledOracleandyouarenowsettinguptheactualinstance.Youhavebeenwaitinganhourfortheinitialization
scripttofinish,whatshouldyoucheckfirsttodetermineifthereisaproblem?
Level:Intermediatetohigh
ExpectedAnswer:Checktomakesurethatthearchiverisn?tstuck.Ifarchiveloggingisturnedonduringinstallalargenumber
oflogswillbecreated.ThiscanfillupyourarchivelogdestinationcausingOracletostoptowaitformorespace.
5. WhenconfiguringSQLNETontheserverwhatfilesmustbesetup?
Level:Intermediate
Expectedanswer:INITIALIZATIONfile,TNSNAMES.ORAfile,SQLNET.ORAfile
6. WhenconfiguringSQLNETontheclientwhatfilesneedtobesetup?
Level:Intermediate
Expectedanswer:SQLNET.ORA,TNSNAMES.ORA
7. WhatmustbeinstalledwithODBContheclientinorderforittoworkwithOracle?
Level:Intermediate
Expectedanswer:SQLNETandPROTOCOL(forexample:TCPIPadapter)layersofthetransportprograms.
8. YouhavejuststartedanewinstancewithalargeSGAonabusyexistingserver.Performanceisterrible,whatshouldyoucheck
for?
Level:Intermediate
Expectedanswer:ThefirstthingtocheckwithalargeSGAisthatitisn?tbeingswappedout.
9. WhatOSusershouldbeusedforthefirstpartofanOracleinstallation(onUNIX)?
Level:low
Expectedanswer:Youmustuserootfirst.
10. WhenshouldthedefaultvaluesforOracleinitializationparametersbeusedasis?
Level:Low
Expectedanswer:Never
11. Howmanycontrolfilesshouldyouhave?Whereshouldtheybelocated?
Level:Low
Expectedanswer:Atleast2onseparatediskspindles.Besuretheysayonseparatedisks,notjustfilesystems.
12. Howmanyredologsshouldyouhaveandhowshouldtheybeconfiguredformaximumrecoverability?

Level:Intermediate
Expectedanswer:Youshouldhaveatleastthreegroupsoftworedologswiththetwologseachonaseparatediskspindle(mirrored
byOracle).TheredologsshouldnotbeonrawdevicesonUNIXifitcanbeavoided.
13. Youhaveasimpleapplicationwithnohottables(i.e.uniformIOandaccessrequirements).Howmanydisksshouldyouhave
assumingstandardlayoutforSYSTEM,USER,TEMPandROLLBACKtablespaces?
Expectedanswer:Atleast7,seediskconfigurationanswerabove.

DATAMODELERINTERVIEWQUESTIONS
1. Describethirdnormalform?

Level:Low
Expectedanswer:Somethinglike:Inthirdnormalformallattributesinanentityarerelatedtotheprimarykeyandonlytotheprimary
key
2. Isthefollowingstatementtrueorfalse:
Allrelationaldatabasesmustbeinthirdnormalform
Whyorwhynot?
Level:Intermediate
Expectedanswer:False.While3NFisgoodforlogicaldesignmostdatabases,iftheyhavemorethanjustafewtables,willnot
performwellusingfull3NF.Usuallysomeentitieswillbedenormalizedinthelogicaltophysicaltransferprocess.
3. WhatisanERD?
Level:Low

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

11/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Expectedanswer:AnERDisanEntityRelationshipDiagram.Itisusedtoshowtheentitiesandrelationshipsforadatabase
logicalmodel.
4. Whyarerecursiverelationshipsbad?Howdoyouresolvethem?
Level:Intermediate
Arecursiverelationship(onewhereatablerelatestoitself)isbadwhenitisahardrelationship(i.e.neithersideisamayboth
aremust)asthiscanresultinitnotbeingpossibletoputinatoporperhapsabottomofthetable(forexampleinthe
EMPLOYEEtableyoucouldn?tputinthePRESIDENTofthecompanybecausehehasnoboss,orthejuniorjanitorbecausehe
hasnosubordinates).Thesetypeofrelationshipsareusuallyresolvedbyaddingasmallintersectionentity.
5. Whatdoesahardonetoonerelationshipmean(onewheretherelationshiponbothendsismust)?
Level:Lowtointermediate
Expectedanswer:Thismeansthetwoentitiesshouldprobablybemadeintooneentity.
6. Howshouldamanytomanyrelationshipbehandled?
Level:Intermediate
Expectedanswer:Byaddinganintersectionentitytable
7. Whatisanartificial(derived)primarykey?Whenshouldanartificial(orderived)primarykeybeused?
Level:Intermediate
Expectedanswer:Aderivedkeycomesfromasequence.Usuallyitisusedwhenaconcatenatedkeybecomestoocumbersometo
useasaforeignkey.
8. Whenshouldyouconsiderdenormalization?
Level:Intermediate
Expectedanswer:Wheneverperformanceanalysisindicatesitwouldbebeneficialtodosowithoutcompromisingdataintegrity.

ORACLECONCEPTSANDARCHITECTUREDATABASESTRUCTURES
1. WhatarethecomponentsofphysicaldatabasestructureofOracledatabase?

Oracledatabaseiscomprisedofthreetypesoffiles.Oneormoredatafiles,twoaremoreredologfiles,andoneormorecontrolfiles.
2. WhatarethecomponentsoflogicaldatabasestructureofOracledatabase?

Therearetablespacesanddatabasesschemaobjects.
3. Whatisatablespace?

AdatabaseisdividedintoLogicalStorageUnitcalledtablespaces.Atablespaceisusedtogroupedrelatedlogicalstructures
together.
4. WhatisSYSTEMtablespaceandwhenisitcreated?

EveryOracledatabasecontainsatablespacenamedSYSTEM,whichisautomaticallycreatedwhenthedatabaseiscreated.The
SYSTEMtablespacealwayscontainsthedatadictionarytablesfortheentiredatabase.
7. WhatareSchemaObjects?

Schemaobjectsarethelogicalstructuresthatdirectlyrefertothedatabasesdata.Schemaobjectsincludetables,views,sequences,
synonyms,indexes,clusters,databasetriggers,procedures,functionspackagesanddatabaselinks.
8. Canobjectsofthesameschemaresideindifferenttablespaces?

Yes.
9. Canatablespaceholdobjectsfromdifferentschemes?

Yes.
10. WhatisOracletable?

AtableisthebasicunitofdatastorageinanOracledatabase.Thetablesofadatabaseholdalloftheuseraccessibledata.Table
dataisstoredinrowsandcolumns.
11. WhatisanOracleview?

Aviewisavirtualtable.Everyviewhasaqueryattachedtoit.(ThequeryisaSELECTstatementthatidentifiesthecolumnsandrows
ofthetable(s)theviewuses.)
12. Doaviewcontaindata?

Viewsdonotcontainorstoredata.
13. Canaviewbasedonanotherview?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

12/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Yes.
14. Whataretheadvantagesofviews?
Provideanadditionalleveloftablesecurity,byrestrictingaccesstoapredeterminedsetofrowsandcolumnsofatable.
Hidedatacomplexity.
Simplifycommandsfortheuser.
Presentthedatainadifferentperspectivefromthatofthebasetable.
Storecomplexqueries.
15. WhatisanOraclesequence?

Asequencegeneratesaseriallistofuniquenumbersfornumericalcolumnsofadatabasestables.
16. Whatisasynonym?

Asynonymisanaliasforatable,view,sequenceorprogramunit.
17. Whatarethetypesofsynonyms?

Therearetwotypesofsynonymsprivateandpublic.
18. Whatisaprivatesynonym?

Onlyitsownercanaccessaprivatesynonym.
19. Whatisapublicsynonym?

Anydatabaseusercanaccessapublicsynonym.
20. Whataresynonymsusedfor?

Masktherealnameandownerofanobject.
Providepublicaccesstoanobject
Providelocationtransparencyfortables,viewsorprogramunitsofaremotedatabase.
SimplifytheSQLstatementsfordatabaseusers.
21. WhatisanOracleindex?

Anindexisanoptionalstructureassociatedwithatabletohavedirectaccesstorows,whichcanbecreatedtoincreasethe
performanceofdataretrieval.Indexcanbecreatedononeormorecolumnsofatable.
22. Howaretheindexupdates?

IndexesareautomaticallymaintainedandusedbyOracle.Changestotabledataareautomaticallyincorporatedintoallrelevant
indexes.
Follow
23. Whatareclusters?

Follow
TechnologyLearning

Clustersaregroupsofoneormoretablesphysicallystorestogethertosharecommoncolumnsandareoftenusedtogether.
24. Whatisclusterkey?

Buildawebsitewith
WordPress.com

Therelatedcolumnsofthetablesinaclusterarecalledtheclusterkey.
25. Whatisindexcluster?

Aclusterwithanindexontheclusterkey.
26. Whatishashcluster?

Arowisstoredinahashclusterbasedontheresultofapplyingahashfunctiontotherowsclusterkeyvalue.Allrowswiththesame
hashkeyvaluearestorestogetherondisk.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

13/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
27. Whencanhashclusterused?

Hashclustersarebetterchoicewhenatableisoftenqueriedwithequalityqueries.Forsuchqueriesthespecifiedclusterkeyvalueis
hashed.Theresultinghashkeyvaluepointsdirectlytotheareaondiskthatstoresthespecifiedrows.
28. Whatisdatabaselink?

Adatabaselinkisanamedobjectthatdescribesapathfromonedatabasetoanother.
29. Whatarethetypesofdatabaselinks?

Privatedatabaselink,publicdatabaselink&networkdatabaselink.
30. Whatisprivatedatabaselink?

Privatedatabaselinkiscreatedonbehalfofaspecificuser.Aprivatedatabaselinkcanbeusedonlywhentheownerofthelink
specifiesaglobalobjectnameinaSQLstatementorinthedefinitionoftheownersviewsorprocedures.
31. Whatispublicdatabaselink?

PublicdatabaselinkiscreatedforthespecialusergroupPUBLIC.Apublicdatabaselinkcanbeusedwhenanyuserinthe
associateddatabasespecifiesaglobalobjectnameinaSQLstatementorobjectdefinition.
32. Whatisnetworkdatabaselink?

Networkdatabaselinkiscreatedandmanagedbyanetworkdomainservice.Anetworkdatabaselinkcanbeusedwhenanyuserof
anydatabaseinthenetworkspecifiesaglobalobjectnameinaSQLstatementorobjectdefinition.
33. Whatisdatablock?
Oracledatabasesdataisstoredindatablocks.Onedatablockcorrespondstoaspecificnumberofbytesofphysicaldatabase
spaceondisk.
34. Howtodefinedatablocksize?

AdatablocksizeisspecifiedforeachOracledatabasewhenthedatabaseiscreated.Adatabaseusersandallocatedfreedatabase
spaceinOracledatablocks.Blocksizeisspecifiedininit.ora fileandcannotbechangedlatter.
35. Whatisrowchaining?

Incircumstances,allofthedataforarowinatablemaynotbeabletofitinthesamedatablock.Whenthisoccurs,thedataforthe
rowisstoredinachainofdatablock(oneormore)reservedforthatsegment.
36. Whatisanextent?

Anextentisaspecificnumberofcontiguousdatablocks,obtainedinasingleallocationandusedtostoreaspecifictypeof
information.
37. Whatisasegment?

Asegmentisasetofextentsallocatedforacertainlogicalstructure.
38. Whatarethedifferenttypesofsegments?

Datasegment,indexsegment,rollbacksegmentandtemporarysegment.
39. Whatisadatasegment?

Eachnonclusteredtablehasadatasegment.Allofthetablesdataisstoredintheextentsofitsdatasegment.Eachclusterhasa
datasegment.Thedataofeverytableintheclusterisstoredintheclustersdatasegment.
40. Whatisanindexsegment?

Eachindexhasanindexsegmentthatstoresallofitsdata.
41. Whatisrollbacksegment?

Adatabasecontainsoneormorerollbacksegmentstotemporarilystoreundoinformation.
42. Whataretheusesofrollbacksegment?

Togeneratereadconsistentdatabaseinformationduringdatabaserecoveryandtorollbackuncommittedtransactionsbytheusers.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

14/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
43. Whatisatemporarysegment?

TemporarysegmentsarecreatedbyOraclewhenaSQLstatementneedsatemporaryworkareatocompleteexecution.Whenthe
statementfinishesexecution,thetemporarysegmentextentsarereleasedtothesystemforfutureuse.
44. Whatisadatafile?

EveryOracledatabasehasoneormorephysicaldatafiles.Adatabasesdatafilescontainallthedatabasedata.Thedataoflogical
databasestructuressuchastablesandindexesisphysicallystoredinthedatafilesallocatedforadatabase.
45. Whatarethecharacteristicsofdatafiles?

Adatafilecanbeassociatedwithonlyonedatabase.Oncecreatedadatafilecantchangesize.Oneormoredatafilesformalogical
unitofdatabasestoragecalledatablespace.
46. Whatisaredolog?

Thesetofredologfilesforadatabaseiscollectivelyknownasthedatabaseredolog.
47. Whatisthefunctionofredolog?

Theprimaryfunctionoftheredologistorecordallchangesmadetodata.
48. Whatistheuseofredologinformation?

Theinformationinaredologfileisusedonlytorecoverthedatabasefromasystemormediafailurepreventsdatabasedatafrom
beingwrittentoadatabasesdatafiles.
49. Whatdoesacontrolfilecontains?
Databasename
Namesandlocationsofadatabasesfilesandredologfiles.
Timestampofdatabasecreation.
50. Whatistheuseofcontrolfile?

WhenaninstanceofanOracledatabaseisstarted,itscontrolfileisusedtoidentifythedatabaseandredologfilesthatmustbe
openedfordatabaseoperationtoproceed.Itisalsousedindatabaserecovery.
RMANINTERVIEWQUESTIONS
1. WhatisRMAN?
RecoveryManager(RMAN)isautilitythatcanmanageyourentireOraclebackupandrecoveryactivities.
WhichFilesmustbebackedup?
DatabaseFiles(withRMAN)
ControlFiles(withRMAN)
OfflineRedologFiles(withRMAN)
INIT.ORA(manually)
PasswordFiles(manually)
2. WhenyoutakeahotbackupputtingTablespaceinbeginbackupmode,OraclerecordsSCN#fromheaderofadatabasefile.What
happenswhenyouissuehotbackupdatabaseinRMANatblocklevelbackup?HowdoesRMANmarktherecordthattheblock
hasbeenbackedup?HowdoesRMANknowwhatblockswerebackedupsothatitdoesnthavetoscanthemagain?

In11g,thereisOracleBlockChangeTrackingfeature.Onceenabledthisnew10gfeaturerecordsthemodifiedsincelastbackup
andstoresthelogofitinablockchangetrackingfile.DuringbackupsRMANusesthelogfiletoidentifythespecificblocksthatmust
bebackedup.ThisimprovesRMANsperformanceasitdoesnothavetoscanwholedatafilestodetectchangedblocks.
LoggingofchangedblocksisperformedbytheCTRWprocesswhichisalsoresponsibleforwritingdatatotheblockchangetracking
file.RMANusesSCNsontheblocklevelandthearchivedredologstoresolveanyinconsistenciesinthedatafilesfromahotbackup.
WhatRMANdoesnotrequireistoputthetablespaceinBACKUPmode,thusfreezingtheSCNintheheader.Rather,RMANkeeps
thisinformationineitheryourcontrolfilesorintheRMANrepository(i.e.,RecoveryCatalog).
3. WhataretheArchitecturalcomponentsofRMAN?

1.RMANexecutable
2.Serverprocesses
3.Channels

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

15/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
4.Targetdatabase
5.Recoverycatalogdatabase(optional)
6.Mediamanagementlayer(optional)
7.Backups,backupsets,andbackuppieces
4. WhatareChannels?

AchannelisanRMANserverprocessstartedwhenthereisaneedtocommunicatewithanI/Odevice,suchasadiskoratape.A
channeliswhatreadsandwritesRMANbackupfiles.ItisthroughtheallocationofchannelsthatyougovernI/Ocharacteristicssuch
as:
TypeofI/Odevicebeingreadorwrittento,eitheradiskoransbt_tape
NumberofprocessessimultaneouslyaccessinganI/Odevice
MaximumsizeoffilescreatedonI/Odevices
Maximumrateatwhichdatabasefilesareread
Maximumnumberoffilesopenatatime
5. Whyisthecatalogoptional?

BecauseRMANmanagesbackupandrecoveryoperations,itrequiresaplacetostorenecessaryinformationaboutthedatabase.
RMANalwaysstoresthisinformationinthetargetdatabasecontrolfile.YoucanalsostoreRMANmetadatainarecoverycatalog
schemacontainedinaseparatedatabase.Therecoverycatalog
schemamustbestoredinadatabaseotherthanthetargetdatabase.
6. WhatdoescompleteRMANbackupconsistof?
Abackupofallorpartofyourdatabase.ThisresultsfromissuinganRMANbackupcommand.Abackupconsistsofoneormore
backupsets.7.WhatisaBackupset?Alogicalgroupingofbackupfilesthebackuppiecesthatarecreatedwhenyouissue
anRMANbackupcommand.AbackupsetisRMANsnameforacollectionoffilesassociatedwithabackup.Abackupsetis
composedofoneormorebackuppieces.8.WhatisaBackuppiece?AphysicalbinaryfilecreatedbyRMANduringabackup.
Backuppiecesarewrittentoyourbackupmedium,whethertodiskortape.Theycontainblocksfromthetargetdatabases
datafiles,archivedredologfiles,andcontrolfiles.WhenRMANconstructsabackuppiecefromdatafiles,thereareaseveral
rulesthatitfollows:
Adatafilecannotspanbackupsets
Adatafilecanspanbackuppiecesaslongasitstayswithinonebackupset
Datafilesandcontrolfilescancoexistinthesamebackupsets
ArchivedredologfilesareneverinthesamebackupsetasdatafilesorcontrolfilesRMANistheonlytoolthatcanoperateon
backuppieces.IfyouneedtorestoreafilefromanRMANbackup,youmustuseRMANtodoit.Theresnowayforyouto
manuallyreconstructdatabasefilesfromthebackuppieces.YoumustuseRMANtorestorefilesfromabackuppiece.
9. WhatarethebenefitsofusingRMAN?
10. Incrementalbackupsthatonlycopydatablocksthathavechangedsincethelastbackup.
2.Tablespacesarenotputinbackupmode,thusthereisnoextraredologgenerationduringonlinebackups.
3.Detectionofcorruptblocksduringbackups.
4.ParallelizationofI/Ooperations.
5.Automaticloggingofallbackupandrecoveryoperations.
6.Builtinreportingandlistingcommands.
11.

GENERALBACKUPANDRECOVERYQUESTIONS

1. WhyandwhenshouldIbackupmydatabase?

BackupandrecoveryisoneofthemostimportantaspectsofaDBAsjob.Ifyouloseyourcompanysdata,youcouldverywelllose
yourjob.Hardwareandsoftwarecanalwaysbereplaced,butyourdatamaybeirreplaceable!
Normallyonewouldscheduleahierarchyofdaily,weeklyandmonthlybackups,howeverconsultwithyourusersbeforedecidingona
backupschedule.Backupfrequencynormallydependsonthefollowingfactors:
Rateofdatachange/transactionrate
Databaseavailability/Canyoushutdownforcoldbackups?
Criticalityofthedata/Valueofthedatatothecompany
Readonlytablespaceneedsbackingupjustoncerightafteryoumakeitreadonly

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

16/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Ifyouarerunninginarchivelogmodeyoucanbackuppartsofadatabaseoveranextendedcycleofdays
Ifarchiveloggingisenabledoneneedstobackuparchivedlogfilestimeouslytopreventdatabasefreezes
Etc.

Carefullyplanbackupretentionperiods.Ensureenoughbackupmedia(tapes)areavailableandthatoldbackupsareexpiredintime
tomakemediaavailablefornewbackups.Offsitevaultingisalsohighlyrecommended.
Frequentlytestyourabilitytorecoveranddocumentallpossiblescenarios.Remember,itsthelittlethingsthatwillgetyou.Most
failedrecoveriesarearesultoforganizationalerrorsandmiscommunication.
2. WhatstrategiesareavailableforbackingupanOracledatabase?

ThefollowingmethodsarevalidforbackingupanOracledatabase:
Export/ImportExportsarelogicaldatabasebackupsinthattheyextractlogicaldefinitionsanddatafromthedatabasetoafile.
SeetheImport/ExportFAQformoredetails.
ColdorOfflineBackupsshutthedatabasedownandbackupupALLdata,log,andcontrolfiles.
HotorOnlineBackupsIfthedatabaseisavailableandinARCHIVELOGmode,setthetablespacesintobackupmodeand
backuptheirfiles.Alsoremembertobackupthecontrolfilesandarchivedredologfiles.
RMANBackupswhilethedatabaseisofflineoronline,usethermanutilitytobackupthedatabase.

Itisadvisabletousemorethanoneofthesemethodstobackupyourdatabase.Forexample,ifyouchoosetodoonlinedatabase
backups,alsocoveryourselfbydoingdatabaseexports.AlsotestALLbackupandrecoveryscenarioscarefully.Itisbettertobesafe
thansorry.
Regardlessofyourstrategy,alsoremembertobackupallrequiredsoftwarelibraries,parameterfiles,passwordfiles,etc.Ifyour
databaseisinARCHIVELOGmode,youalsoneedtobackuparchivedlogfiles.
3. Whatisthedifferencebetweenonlineandofflinebackups?
Ahot(oronline)backupisabackupperformedwhilethedatabaseisopenandavailableforuse(readandwriteactivity).Exceptfor
Oracleexports,onecanonlydoonlinebackupswhenthedatabaseisARCHIVELOGmode.

Acold(oroffline)backupisabackupperformedwhilethedatabaseisofflineandunavailabletoitsusers.Coldbackupscanbe
takenregardlessifthedatabaseisinARCHIVELOGorNOARCHIVELOGmode.
Itiseasiertorestorefromofflinebackupsasnorecovery(fromarchivedlogs)wouldberequiredtomakethedatabaseconsistent.
Nevertheless,onlinebackupsarelessdisruptiveanddontrequiredatabasedowntime.
Pointintimerecovery(regardlessifyoudoonlineorofflinebackups)isonlyavailablewhenthedatabaseisinARCHIVELOGmode.
4.Whatisthedifferencebetweenrestoringandrecovering?

Restoringinvolvescopyingbackupfilesfromsecondarystorage(backupmedia)todisk.Thiscanbedonetoreplacedamagedfiles
ortocopy/moveadatabasetoanewlocation.
Recoveryistheprocessofapplyingredologstothedatabasetorollitforward.Onecanrollforwarduntilaspecificpointintime
(beforethedisasteroccurred),orrollforwarduntilthelasttransactionrecordedinthelogfiles.
SQL>connectSYSasSYSDBA
SQL>RECOVERDATABASEUNTILTIME20010306:16:00:00USINGBACKUPCONTROLFILE
RMAN>run{
setuntiltimeto_date(04Aug200400:00:00,DDMONYYYYHH24:MI:SS)
restoredatabase
recoverdatabase
}
5. MydatabaseisdownandIcannotrestore.Whatnow?

Thisisprobablynottheappropriatetimetobesarcastic,but,recoverywithoutbackupsarenotsupported.Youknowthatyoushould
havetestedyourrecoverystrategy,andthatyoushouldalwaysbackupacorrupteddatabasebeforeattemptingtorestore/recoverit.
Nevertheless,OracleConsultingcansometimesextractdatafromanofflinedatabaseusingautilitycalledDUL(DiskUnLoadLifeis
DULwithoutit!).ThisutilityreadsdatainthedatafilesandunloadsitintoSQL*Loaderorexportdumpfiles.Hopefullyyoullthenbe
abletoloadthedataintoaworkingdatabase.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

17/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
NotethatDULdoesnotcareaboutrollbacksegments,corruptedblocks,etc,andcanthusnotguaranteethatthedataisnotlogically
corrupt.Itisintendedasanabsolutelastresortandwillmostlikelycostyourcompanyalotofmoney!
DUDE(DatabaseUnloadingbyDataExtraction)isanothernonOracleutilitythatcanbeusedtoextractdatafromadeaddatabase.
6. Howdoesonebackupadatabaseusingtheexportutility?

Oracleexportsarelogicaldatabasebackups(notphysical)astheyextractdataandlogicaldefinitionsfromthedatabaseintoafile.
Otherbackupstrategiesnormallybackupthephysicaldatafiles.
Oneoftheadvantagesofexportsisthatonecanselectivelyreimporttables,howeveronecannotrollforwardfromanrestored
export.Tocompletelyrestoreadatabasefromanexportfileonepracticallyneedstorecreatetheentiredatabase.
Alwaysdofullsystemlevelexports(FULL=YES).Fullexportsincludemoreinformationaboutthedatabaseintheexportfilethanuser
levelexports.FormoreinformationabouttheOracleexportandimportutilities,seetheImport/ExportFAQ.
7. HowdoesoneputadatabaseintoARCHIVELOGmode?
Themainreasonforrunninginarchivelogmodeisthatonecanprovide24houravailabilityandguaranteecompletedata
recoverability.ItisalsonecessarytoenableARCHIVELOGmodebeforeonecanstarttouseonlinedatabasebackups.

IssuethefollowingcommandstoputadatabaseintoARCHIVELOGmode:
SQL>CONNECTsysASSYSDBA
SQL>STARTUPMOUNTEXCLUSIVE
SQL>ALTERDATABASEARCHIVELOG
SQL>ARCHIVELOGSTART
SQL>ALTERDATABASEOPEN
Alternatively,addtheabovecommandsintoyourdatabasesstartupcommandscript,andbouncethedatabase.
ThefollowingparametersneedstobesetfordatabasesinARCHIVELOGmode:
log_archive_start=TRUE
log_archive_dest_1=LOCATION=/arch_dir_name
log_archive_dest_state_1=ENABLE
log_archive_format=%d_%t_%s.arc
NOTE1:Remembertotakeabaselinedatabasebackuprightafterenablingarchivelogmode.Withoutitonewouldnotbeableto
recover.Also,implementanarchivelogbackuptopreventthearchivelogdirectoryfromfillingup.
NOTE2:ARCHIVELOGmodewasintroducedwithOracle6,andisessentialfordatabasepointintimerecovery.Archivingcanbe
usedincombinationwithonlineandofflinedatabasebackups.
NOTE3:YoumaywanttosetthefollowingINIT.ORAparameterswhenenablingARCHIVELOGmode:log_archive_start=TRUE,
log_archive_dest=,andlog_archive_format=
NOTE4:YoucanchangethearchivelogdestinationofadatabaseonlinewiththeARCHIVELOGSTARTTOdirectory'statement.
Thisstatementisoftenusedtoswitcharchivingbetweenasetofdirectories.
NOTE5:WhenrunningOracleRealApplicationClusters(RAC),youneedtoshutdownallnodesbeforechangingthedatabaseto
ARCHIVELOGmode.SeetheRACFAQformoredetails.
[edit]Ivelostanarchived/onlineREDOLOGfile,canIgetmyDBback?
ThefollowingINIT.ORA/SPFILEparametercanbeusedifyourcurrentredologsarecorruptedorblownaway.Itmayalsobehandyif
youdodatabaserecoveryandoneofthearchivedlogfilesaremissingandcannotberestored.
NOTE:Cautionisadvisedwhenenablingthisparameterasyoumightenduplosingyourentiredatabase.PleasecontactOracle
Supportbeforeusingit.
_allow_resetlogs_corruption=true
Thisshouldallowyoutoopenthedatabase.However,afterusingthisparameteryourdatabasewillbeinconsistent(somecommitted
transactionsmaybelostorpartiallyapplied).
Steps:
DoaSHUTDOWNNORMALofthedatabase
Settheaboveparameter
DoaSTARTUPMOUNTandALTERDATABASEOPENRESETLOGS
Ifthedatabaseasksforrecovery,useanUNTILCANCELtyperecoveryandapplyallavailablearchiveandonlineredologs,then
issueCANCELandreissuetheALTERDATABASEOPENRESETLOGScommand.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

18/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WaitacoupleofminutesforOracletosortitselfout
DoaSHUTDOWNNORMAL
Removetheaboveparameter!
DoadatabaseSTARTUPandcheckyourALERT.LOGfileforerrors.
Extractthedataandrebuildtheentiredatabase

USERMANAGEDBACKUPANDRECOVERY
Thissectiondealswithusermanaged,ornonRMANbackups.
1. Howdoesonedoofflinedatabasebackups?

Shutdownthedatabasefromsqlplusorservermanager.Backupallfilestosecondarystorage(eg.tapes).Ensurethatyoubackup
alldatafiles,allcontrolfilesandalllogfiles.Whencompleted,restartyourdatabase.
Dothefollowingqueriestogetalistofallfilesthatneedstobebackedup:
selectnamefromsys.v_$datafile
selectmemberfromsys.v_$logfile
selectnamefromsys.v_$controlfile
SometimesOracletakesforevertoshutdownwiththeimmediateoption.Asworkaroundtothisproblem,shutdownusingthese
commands:
altersystemcheckpoint
shutdownabort
startuprestrict
shutdownimmediate
NotethatifyourdatabaseisinARCHIVELOGmode,onecanstillusearchivedlogfilestorollforwardfromanofflinebackup.Ifyou
cannottakeyourdatabasedownforacold(offline)backupataconvenienttime,switchyourdatabaseintoARCHIVELOGmodeand
performhot(online)backups.
2.Howdoesonedoonlinedatabasebackups?

Eachtablespacethatneedstobebackedupmustbeswitchedintobackupmodebeforecopyingthefilesouttosecondarystorage
(tapes).Lookatthissimpleexample.
ALTERTABLESPACExyzBEGINBACKUP
!cpxyzFile1/backupDir/
ALTERTABLESPACExyzENDBACKUP
Itisbettertobackuptablespacefortablespacethantoputalltablespacesinbackupmode.Backingthemupseparatelyincursless
overhead.Whendone,remembertobackupyourcontrolfiles.Lookatthisexample:
ALTERSYSTEMSWITCHLOGFILEForcelogswitchtoupdatecontrolfileheaders
ALTERDATABASEBACKUPCONTROLFILETO/backupDir/control.dbf'
NOTE:Donotrunonlinebackupsduringpeakprocessingperiods.Oraclewillwritecompletedatabaseblocksinsteadofthenormal
deltastoredologfileswhileinbackupmode.Thiswillleadtoexcessivedatabasearchivingandevendatabasefreezes.
3. MydatabasewasterminatedwhileinBACKUPMODE,doIneedtorecover?

IfadatabasewasterminatedwhileoneofitstablespaceswasinBACKUPMODE(ALTERTABLESPACExyzBEGINBACKUP),itwill
tellyouthatmediarecoveryisrequiredwhenyoutrytorestartthedatabase.TheDBAisthenrequiredtorecoverthedatabaseand
applyallarchivedlogstothedatabase.However,fromOracle7.2,onecansimplytaketheindividualdatafilesoutofbackupmode
andrestartthedatabase.
ALTERDATABASEDATAFILE/path/filenameENDBACKUP
OnecanselectfromV$BACKUPtoseewhichdatafilesareinbackupmode.Thisnormallysavesasignificantamountofdatabase
downtime.Seescriptend_backup2.sqlintheScriptssectionofthissite.
FromOracle9ionwards,thefollowingcommandcanbeusedtotakeallofthedatafilesoutofhotbackupmode:
ALTERDATABASEENDBACKUP
Thiscommandmustbeissuedwhenthedatabaseismounted,butnotyetopened.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

19/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
4.DoesOraclewritetodatafilesinbegin/hotbackupmode?

Whenatablespaceisinbackupmode,Oraclewillstopupdatingitsfileheaders,butwillcontinuetowritetothedatafiles.
Wheninbackupmode,Oraclewillwritecompletechangedblockstotheredologfiles.Normallyonlydeltas(changevectors)are
loggedtotheredologs.Thisisdonetoenablereconstructionofablockifonlyhalfofitwasbackedup(splitblocks).Becauseofthis,
oneshouldnoticeincreasedlogactivityandarchivingduringonlinebackups.
Tosolvethisproblem,simplyswitchtoRMANbackups.
RMANBACKUPANDRECOVERY
ThissectiondealswithRMANbackups:
1. WhatisRMANandhowdoesoneuseit?

RecoveryManager(orRMAN)isanOracleprovidedutilityforbackingup,restoringandrecoveringOracleDatabases.RMANships
withthedatabaseserveranddoesntrequireaseparateinstallation.TheRMANexecutableislocatedinyourORACLE_HOME/bin
directory.
InfactRMAN,isjustaPro*CapplicationthattranslatescommandstoaPL/SQLinterface.ThePL/SQLcallsarestallicallylinkedinto
theOraclekernel,anddoesnotrequirethedatabasetobeopened(mappedfromthe?/rdbms/admin/recover.bsq file).
RMANcandoofflineandonlinedatabasebackups.Itcannot,however,writedirectlytotape,butvarious3rdpartytools(like
Veritas,Omiback,etc)canintegratewithRMANtohandletapelibrarymanagement.
RMANcanbeoperatedfromOracleEnterpriseManager,orfromcommandline.Herearethecommandlinearguments:
ArgumentValueDescription

targetquotedstringconnectstringfortargetdatabase
catalogquotedstringconnectstringforrecoverycatalog
nocatalognoneifspecified,thennorecoverycatalog
cmdfilequotedstringnameofinputcommandfile
logquotedstringnameofoutputmessagelogfile
tracequotedstringnameofoutputdebuggingmessagelogfile
appendnoneifspecified,logisopenedinappendmode
debugoptionalargsactivatedebugging
msgnononeshowRMANnnnnprefixforallmessages
sendquotedstringsendacommandtothemediamanager
pipestringbuildingblockforpipenames
timeoutintegernumberofsecondstowaitforpipeinput

Hereisanexample:
[oracle@localhostoracle]$rman
RecoveryManager:Release10.1.0.2.0Production
Copyright(c)1995,2004,Oracle.Allrightsreserved.
RMAN>connecttarget
connectedtotargetdatabase:ORCL(DBID=1058957020)
RMAN>backupdatabase

2. HowdoesonebackupandrestoreadatabaseusingRMAN?

ThebiggestadvantageofRMANisthatitonlybackupusedspaceinthedatabase.RMANdoesntputtablespacesinbackupmode,
savingonredogenerationoverhead.RMANwillrereaddatabaseblocksuntilitgetsaconsistentimageofit.Lookatthissimple
backupexample.
rmantargetsys/***nocatalog
run{
allocatechannelt1typedisk

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

20/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
backup
format/app/oracle/backup/%d_t%t_s%s_p%p
(database)
releasechannelt1
}
ExampleRMANrestore:
rmantargetsys/***nocatalog
run{
allocatechannelt1typedisk
1. setuntiltimeAug072000:51

restoretablespaceusers
recovertablespaceusers
releasechannelt1
}
Theexamplesaboveareextremelysimplisticandonlyusefulforillustratingbasicconcepts.BydefaultOracleusesthedatabase
controlfilestostoreinformationaboutbackups.NormallyonewouldrathersetupaRMANcatalogdatabasetostoreRMANmetadata
in.ReadtheOracleBackupandRecoveryGuidebeforeimplementinganyRMANbackups.
Note:RMANcannotwriteimagecopiesdirectlytotape.OneneedstouseathirdpartymediamanagerthatintegrateswithRMANto
backupdirectlytotape.Alternativelyonecanbackuptodiskandthenmanuallycopythebackupstotape.
3. Howdoesonebackupandrestorearchivedlogfiles?

OnecanbackuparchivedlogfilesusingRMANoranyoperatingsystembackuputility.Remembertodeletefilesafterbackingthem
uptopreventthearchivelogdirectoryfromfillingup.Ifthearchivelogdirectorybecomesfull,yourdatabasewillhang!Lookatthis
simpleRMANbackupscripts:
RMAN>run{
2>allocatechanneldev1typedisk
3>backup
4>format/app/oracle/archback/log_%t_%sp%p
5>(archivelogalldeleteinput)
6>releasechanneldev1
7>}
Thedeleteinputclausewilldeletethearchivedlogsastheyarebackedup.
Listallarchivelogbackupsforthepast24hours:
RMAN>LISTBACKUPOFARCHIVELOGFROMTIMEsysdate1
Hereisarestoreexample:
RMAN>run{
2>allocatechanneldev1typedisk
3>restore(archiveloglowlogseq78311highlogseq78340thread1all)
4>releasechanneldev1
5>}
4. HowdoesonecreateaRMANrecoverycatalog?

Startbycreatingadatabaseschema(usuallycalledrman).Assignanappropriatetablespacetoitandgrantitthe
recovery_catalog_ownerrole.Lookatthisexample:
sqlplussys
SQL>createuserrmanidentifiedbyrman
SQL>alteruserrmandefaulttablespacetoolstemporarytablespacetemp
SQL>alteruserrmanquotaunlimitedontools
SQL>grantconnect,resource,recovery_catalog_ownertorman

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

21/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
SQL>exit
Next,logintormanandcreatethecatalogschema.PriortoOracle8ithiswasdonebyrunningthecatrman.sqlscript.
rmancatalogrman/rman
RMAN>createcatalogtablespacetools
RMAN>exit
Youcannowcontinuebyregisteringyourdatabasesinthecatalog.Lookatthisexample:
rmancatalogrman/rmantargetbackdba/backdba
RMAN>registerdatabase
OnecanalsousetheupgradecatalogcommandtoupgradetoanewRMANrelease,orthedropcatalogcommandtoremove
anRMANcatalog.Thesecommandsneedtobeenteredtwicetoconfirmtheoperation.
5. HowdoesoneintegrateRMANwiththirdpartyMediaManagers?

ThefollowingMediaManagementSoftwareVendorshaveintegratedtheirmediamanagementsoftwarewithRMAN(OracleRecovery
Manager):
VeritasNetBackuphttp://www.veritas.com/
EMCDataManager(EDM)http://www.emc.com/
HPOMNIBack/DataProtectorhttp://www.hp.com/
IBMsTivoliStorageManager(formerlyADSM)http://www.tivoli.com/storage/
EMCNetworkerhttp://www.emc.com/
BrightStorARCserveBackuphttp://www.ca.com/us/datalossprevention.aspx
SterlingSoftwaresSAMS:Alexandria(formerlyfromSpectralogic)http://www.sterling.com/sams/
SUNsSolsticeBackuphttp://www.sun.com/software/whitepapers/backupnstorage/
CommVaultGalaxyhttp://www.commvault.com/
etc

TheaboveMediaManagementVendorswillprovidefirstlinetechnicalsupport(andinstallationguides)fortheirrespectiveproducts.
AcompletelistofsupportedMediaManagementVendorscanbefoundat:
http://www.oracle.com/technology/deploy/availability/htdocs/bsp.htm
WhenallocatingchannelsonecanspecifyMediaManagementspesificparameters.Herearesomeexamples:
NetbackuponSolaris:

allocatechannelt1typeSBT_TAPEPARMS=SBT_LIBRARY=/usr/openv/netbackup/bin/libobk.so.1
NetbackuponWindows:

allocatechannelt1typeSBT_TAPEsendNB_ORA_CLIENT=client_machine_name
Omniback/DataProtectoronHPUX:

allocatechannelt1typeSBT_TAPEPARMS=SBT_LIBRARY=/opt/omni/lib/libob2oracle8_64bit.sl'
or:
allocatechanneldev_1typesbt_tapeparms
ENV=OB2BARTYPE=Oracle8,OB2APPNAME=orcl,OB2BARLIST=machinename_orcl_archlogs)'
6. Howdoesoneclone/duplicateadatabasewithRMAN?

ThefirststeptocloneorduplicateadatabasewithRMANistocreateanewINIT.ORAandpasswordfile(usetheorapwdutility)on
themachineyouneedtoclonethedatabaseto.Reviewallparametersandmaketherequiredchanged.Forexample,setthe
DB_NAMEparametertothenewdatabasesname.
Secondly,youneedtochangeyourenvironmentvariables,anddoaSTARTUPNOMOUNTfromsqlplus.Thisdatabaseisreferredto
astheAUXILIARYinthescriptbelow.
Lastly,writeaRMANscriptlikethistodothecloning,andcallitwithrmancmdfiledupdb.rcv:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

22/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
connecttargetsys/secure@origdb
connectcatalogrman/rman@catdb
connectauxiliary/
run{
setnewnamefordatafile1to/ORADATA/u01/system01.dbf'
setnewnamefordatafile2to/ORADATA/u02/undotbs01.dbf'
setnewnamefordatafile3to/ORADATA/u03/users01.dbf'
setnewnamefordatafile4to/ORADATA/u03/indx01.dbf'
setnewnamefordatafile5to/ORADATA/u02/example01.dbf'
allocateauxiliarychanneldupdb1typedisk
setuntilsequence2thread1
duplicatetargetdatabasetodupdb
logfile
GROUP1(/ORADATA/u02/redo01.log)SIZE200kREUSE,
GROUP2(/ORADATA/u03/redo02.log)SIZE200kREUSE
}
Theabovescriptwillconnecttothetarget(databasethatwillbecloned),therecoverycatalog(togetbackupinfo),andtheauxiliary
database(newduplicateDB).Previousbackupswillberestoredandthedatabaserecoveredtothesetuntiltimespecifiedinthe
script.
Notes:thesetnewnamecommandsareonlyrequiredifyourdatafilenameswilldifferentfromthetargetdatabase.
ThenewlyclonedDBwillhaveitsownuniqueDBID.
7. CanonerestoreRMANbackupswithoutaCONTROLFILEandRECOVERYCATALOG?

DetailsofRMANbackupsarestoredinthedatabasecontrolfilesandoptionallyaRecoveryCatalog.Ifboththesearegone,RMAN
cannotrestorethedatabase.Insuchasituationonemustextractacontrolfile(orotherfiles)fromthebackuppieceswrittenout
whenthelastbackupwastaken.Letslookatanexample:
Letstakeabackup(partialinourcaseforilustrativepurposes):

$rmantarget/nocatalog
RecoveryManager:Release10.1.0.2.064bitProduction
Copyright(c)1995,2004,Oracle.Allrightsreserved.
connectedtotargetdatabase:ORCL(DBID=1046662649)
usingtargetdatabasecontrolfileinsteadofrecoverycatalog
RMAN>backupdatafile1

Startingbackupat20AUG04
allocatedchannel:ORA_DISK_1
channelORA_DISK_1:sid=146devtype=DISK
channelORA_DISK_1:startingfulldatafilebackupset
channelORA_DISK_1:specifyingdatafile(s)inbackupset
inputdatafilefno=00001name=/oradata/orcl/system01.dbf
channelORA_DISK_1:startingpiece1at20AUG04
channelORA_DISK_1:finishedpiece1at20AUG04
piecehandle=
/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T153256_0lczd9tf_.bkpcomment=NONE
channelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:45
channelORA_DISK_1:startingfulldatafilebackupset
channelORA_DISK_1:specifyingdatafile(s)inbackupset
includingcurrentcontrolfileinbackupset
includingcurrentSPFILEinbackupset

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

23/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
channelORA_DISK_1:startingpiece1at20AUG04
channelORA_DISK_1:finishedpiece1at20AUG04
piecehandle=
/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T153256_0lczfrx8_.bkpcomment=NONE
channelORA_DISK_1:backupsetcomplete,elapsedtime:00:00:04
Finishedbackupat20AUG04[/code]
Now,letsdestroyoneofthecontrolfiles:

SQL>showparametersCONTROL_FILES
NAMETYPEVALUE

control_filesstring/oradata/orcl/control01.ctl,
/oradata/orcl/control02.ctl,
/oradata/orcl/control03.ctl
SQL>shutdownabort
ORACLEinstanceshutdown.
SQL>!mv/oradata/orcl/control01.ctl/tmp/control01.ctl</pre>
Now,letsseeifwecanrestoreit.FirstweneedtostartthedatabaaseinNOMOUNTmode:

SQL>startupNOMOUNT
ORACLEinstancestarted.
TotalSystemGlobalArea289406976bytes
FixedSize1301536bytes
VariableSize262677472bytes
DatabaseBuffers25165824bytes
RedoBuffers262144bytes</pre>
Now,fromSQL*Plus,runthefollowingPL/SQLblocktorestorethefile:

DECLARE
v_devtypeVARCHAR2(100)
v_doneBOOLEAN
v_maxPiecesNUMBER
TYPEt_pieceNameISTABLEOFvarchar2(255)INDEXBYbinary_integer
v_pieceNamet_pieceName
BEGIN
Definethebackuppieces(namesfromtheRMANLogfile)
v_pieceName(1):=
/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_ncsnf_TAG20040820T153256_0lczfrx8_.bkp'
v_pieceName(2):=
/flash_recovery_area/ORCL/backupset/2004_08_20/o1_mf_nnndf_TAG20040820T153256_0lczd9tf_.bkp'
v_maxPieces:=2
Allocateachannel(Usetype=>nullforDISK,type=>sbt_tapeforTAPE)
v_devtype:=DBMS_BACKUP_RESTORE.deviceAllocate(type=>NULL,ident=>d1)
RestorethefirstControlFile

DBMS_BACKUP_RESTORE.restoreSetDataFile
CFNAMEmistbetheexactpathandfilenameofacontrolfiletahtwasbackedup
DBMS_BACKUP_RESTORE.restoreControlFileTo(cfname=>/app/oracle/oradata/orcl/control01.ctl)
dbms_output.put_line(Startrestoring||v_maxPieces||pieces.)
FORiIN1..v_maxPiecesLOOP

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

24/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
dbms_output.put_line(Restoringfrompiece||v_pieceName(i))
DBMS_BACKUP_RESTORE.restoreBackupPiece(handle=>v_pieceName(i),done=>v_done,params=>null)
exitwhenv_done
ENDLOOP
Deallocatethechannel
DBMS_BACKUP_RESTORE.deviceDeAllocate(d1)
EXCEPTION
WHENOTHERSTHEN
DBMS_BACKUP_RESTORE.deviceDeAllocate
RAISE
END
/
Letsseeifthecontrolfilewasrestored:

SQL>!lsl/oradata/orcl/control01.ctl
rwr1oracledba3096576Aug2016:45/oradata/orcl/control01.ctl[/code]
WeshouldnowbeabletoMOUNTthedatabaseandcontinuerecovery
SQL>!cp/oradata/orcl/control01.ctl/oradata/orcl/control02.ctl
SQL>!cp/oradata/orcl/control01.ctl/oradata/orcl/control03.ctl
SQL>alterdatabasemount
SQL>recoverdatabaseusingbackupcontrolfile
ORA00279:change7917452generatedat08/20/200416:40:59neededforthread1
ORA00289:suggestion:
/flash_recovery_area/ORCL/archivelog/2004_08_20/o1_mf_1_671_%u_.arc
ORA00280:change7917452forthread1isinsequence#671
Specifylog:{<RET>=suggested|filename|AUTO|CANCEL}
/oradata/orcl/redo02.log
Logapplied.
Mediarecoverycomplete.
Databasealtered.
SQL>alterdatabaseopenresetlogs
Databasealtered.
DBAProfessionalfocusedInterviewQuestionsAnswers:
1. Explainthedifferencebetweenahotbackupandacoldbackupandthebenefitsassociatedwitheach.?
Ahotbackupisbasicallytakingabackupofthedatabasewhileitisstillupandrunninganditmustbeinarchivelogmode.Acold
backupistakingabackupofthedatabasewhileitisshutdownanddoesnotrequirebeinginarchivelogmode.Thebenefitoftaking
ahotbackupisthatthedatabaseisstillavailableforusewhilethebackupisoccurringandyoucanrecoverthedatabasetoanypoint
intime.Thebenefitoftakingacoldbackupisthatitistypicallyeasiertoadministerthebackupandrecoveryprocess.Inaddition,
sinceyouaretakingcoldbackupsthedatabasedoesnotrequirebeinginarchivelogmodeandthustherewillbeaslight
performancegainasthedatabaseisnotcuttingarchivelogstodisk.
2. Youhavejusthadtorestorefrombackupanddonothaveanycontrolfiles.Howwouldyougoaboutbringingupthisdatabase?
Iwouldcreateatextbasedbackupcontrolfile,stipulatingwhereondiskallthedatafileswhereandthenissuetherecovercommand
withtheusingbackupcontrolfileclause.
3. Howdoyouswitchfromaninit.orafiletoaspfile?
Issuethecreatespfilefrompfilecommand.

4. Explainthedifferencebetweenadatablock,anextentandasegment.?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

25/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Adatablockisthesmallestunitoflogicalstorageforadatabaseobject.Asobjectsgrowtheytakechunksofadditionalstoragethat
arecomposedofcontiguousdatablocks.Thesegroupingsofcontiguousdatablocksarecalledextents.Alltheextentsthatanobject
takeswhengroupedtogetherareconsideredthesegmentofthedatabaseobject.
5. GivetwoexamplesofhowyoumightdeterminethestructureofthetableDEPT.?
Usethedescribecommandorusethedbms_metadata.get_ddlpackage.
6. Wherewouldyoulookforerrorsfromthedatabaseengine?

Inthealertlog.
7. CompareandcontrastTRUNCATEandDELETEforatable.?
Boththetruncateanddeletecommandhavethedesiredoutcomeofgettingridofalltherowsinatable.Thedifferencebetweenthe
twoisthatthetruncatecommandisaDDLoperationandjustmovesthehighwatermarkandproducesanowrollback.Thedelete
command,ontheotherhand,isaDMLoperation,whichwillproducearollbackandthustakelongertocomplete.
8. Givethereasoningbehindusinganindex.?
Fasteraccesstodatablocksinatable.
9. Givethetwotypesoftablesinvolvedinproducingastarschemaandthetypeofdatatheyhold.?
Facttablesanddimensiontables.Afacttablecontainsmeasurementswhiledimensiontableswillcontaindatathatwillhelpdescribe
thefacttables.
10. Whattypeofindexshouldyouuseonafacttable?
ABitmapindex.
11. Givetwoexamplesofreferentialintegrityconstraints.?
Aprimarykeyandaforeignkey.
12. Atableisclassifiedasaparenttableandyouwanttodropandrecreateit.Howwouldyoudothiswithoutaffectingthechildren
tables?
Disabletheforeignkeyconstrainttotheparent,dropthetable,recreatethetable,enabletheforeignkeyconstraint.
13. ExplainthedifferencebetweenARCHIVELOGmodeandNOARCHIVELOGmodeandthebenefitsanddisadvantagestoeach.?
ARCHIVELOGmodeisamodethatyoucanputthedatabaseinforcreatingabackupofalltransactionsthathaveoccurredinthe
databasesothatyoucanrecovertoanypointintime.NOARCHIVELOGmodeisbasicallytheabsenceofARCHIVELOGmodeand
hasthedisadvantageofnotbeingabletorecovertoanypointintime.NOARCHIVELOGmodedoeshavetheadvantageofnot
havingtowritetransactionstoanarchivelogandthusincreasestheperformanceofthedatabaseslightly.
14. Whatcommandwouldyouusetocreateabackupcontrolfile?
Alterdatabasebackupcontrolfiletotrace.
15. Givethestagesofinstancestartuptoausablestatewherenormalusersmayaccessit.?
STARTUPNOMOUNTInstancestartup
STARTUPMOUNTThedatabaseismounted
STARTUPOPENThedatabaseisopened
16. WhatcolumndifferentiatestheV$viewstotheGV$viewsandhow?
TheINST_IDcolumnwhichindicatestheinstanceinaRACenvironmenttheinformationcamefrom.
17. HowwouldyougoaboutgeneratinganEXPLAINplan?
Createaplantablewithutlxplan.sql.
Usetheexplainplansetstatement_id=tst1intoplan_tableforaSQLstatement
Lookattheexplainplanwithutlxplp.sqlorutlxpls.sql
18. Howwouldyougoaboutincreasingthebuffercachehitratio?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

26/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Usethebuffercacheadvisoryoveragivenworkloadandthenquerythev$db_cache_advicetable.IfachangewasnecessarythenI
wouldusethealtersystemsetdb_cache_sizecommand.
19. ExplainanORA01555
Yougetthiserrorwhenyougetasnapshottoooldwithinrollback.Itcanusuallybesolvedbyincreasingtheundoretentionor
increasingthesizeofrollbacks.Youshouldalsolookatthelogicinvolvedintheapplicationgettingtheerrormessage.
20. Explainthedifferencebetween$ORACLE_HOMEand$ORACLE_BASE.?
ORACLE_BASEistherootdirectoryfororacle.ORACLE_HOMElocatedbeneathORACLE_BASEiswheretheoracleproducts
reside.
21. Howwouldyoudeterminethetimezoneunderwhichadatabasewasoperating?
selectDBTIMEZONEfromdual
22. ExplaintheuseofsettingGLOBAL_NAMESequaltoTRUE.

SettingGLOBAL_NAMESdictateshowyoumightconnecttoadatabase.ThisvariableiseitherTRUEorFALSEandifitissetto
TRUEitenforcesdatabaselinkstohavethesamenameastheremotedatabasetowhichtheyarelinking.
23. WhatcommandwouldyouusetoencryptaPL/SQLapplication?

WRAP
24. ExplainthedifferencebetweenaFUNCTION,PROCEDUREandPACKAGE.?

AfunctionandprocedurearethesameinthattheyareintendedtobeacollectionofPL/SQLcodethatcarriesasingletask.Whilea
proceduredoesnothavetoreturnanyvaluestothecallingapplication,afunctionwillreturnasinglevalue.Apackageontheother
handisacollectionoffunctionsandproceduresthataregroupedtogetherbasedontheircommonalitytoabusinessfunctionor
application.
25. Explaintheuseoftablefunctions.?

TablefunctionsaredesignedtoreturnasetofrowsthroughPL/SQLlogicbutareintendedtobeusedasanormaltableorviewina
SQLstatement.TheyarealsousedtopipelineinformationinanETLprocess.
26. Namethreeadvisorystatisticsyoucancollect.?

BufferCacheAdvice,SegmentLevelStatistics,&TimedStatistics
27. WhereintheOracledirectorytreestructureareaudittracesplaced?

Inunix$ORACLE_HOME/rdbms/audit,inWindowstheeventviewer
28. Explainmaterializedviewsandhowtheyareused.?

Materializedviewsareobjectsthatarereducedsetsofinformationthathavebeensummarized,grouped,oraggregatedfrombase
tables.Theyaretypicallyusedindatawarehouseordecisionsupportsystems.
29. Whenauserprocessfails,whatbackgroundprocesscleansupafterit?

PMON
30. Whatbackgroundprocessrefreshesmaterializedviews?

TheJobQueueProcesses.
31. Howwouldyoudeterminewhatsessionsareconnectedandwhatresourcestheyarewaitingfor?

UseofV$SESSIONandV$SESSION_WAIT
32. Describewhatredologsare.?

Redologsarelogicalandphysicalstructuresthataredesignedtoholdallthechangesmadetoadatabaseandareintendedtoaidin
therecoveryofadatabase.
33. Howwouldyouforcealogswitch?

ALTERSYSTEMSWITCHLOGFILE
34. GivetwomethodsyoucouldusetodeterminewhatDDLchangeshavebeenmade.?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

27/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
YoucoulduseLogminerorStreams
35. Whatdoescoalescingatablespacedo?

Coalescingisonlyvalidfordictionarymanagedtablespacesanddefragmentsspacebycombiningneighboringfreeextentsinto
largesingleextents.
36. WhatisthedifferencebetweenaTEMPORARYtablespaceandaPERMANENTtablespace?

Atemporarytablespaceisusedfortemporaryobjectssuchassortstructureswhilepermanenttablespacesareusedtostorethose
objectsmeanttobeusedasthetrueobjectsofthedatabase.
37. Nameatablespaceautomaticallycreatedwhenyoucreateadatabase.?

TheSYSTEMtablespace.
38. Whencreatingauser,whatpermissionsmustyougranttoallowthemtoconnecttothedatabase?

GranttheCONNECTtotheuser.
39. Howdoyouaddadatafiletoatablespace?

ALTERTABLESPACEADDDATAFILESIZE
40. Howdoyouresizeadatafile?

ALTERDATABASEDATAFILERESIZE
41. Whatviewwouldyouusetolookatthesizeofadatafile?

DBA_DATA_FILES

42. Whatviewwouldyouusetodeterminefreespaceinatablespace?

DBA_FREE_SPACE
43. Howwouldyoudeterminewhohasaddedarowtoatable?

Turnonfinegrainauditingforthetable.
44. Howcanyourebuildanindex?

ALTERINDEXREBUILD
45. Explainwhatpartitioningisandwhatitsbenefitis.?

Partitioningisamethodoftakinglargetablesandindexesandsplittingthemintosmaller,moremanageablepieces.
46. YouhavejustcompiledaPL/SQLpackagebutgoterrors,howwouldyouviewtheerrors?

SHOWERRORS
47. Howcanyougatherstatisticsonatable?

TheANALYZEcommand.
48. Howcanyouenableatraceforasession?

UsetheDBMS_SESSION.SET_SQL_TRACEor
UseALTERSESSIONSETSQL_TRACE=TRUE
49. WhatisthedifferencebetweentheSQL*LoaderandIMPORTutilities?

ThesetwoOracleutilitiesareusedforloadingdataintothedatabase.Thedifferenceisthattheimportutilityreliesonthedatabeing
producedbyanotherOracleutilityEXPORTwhiletheSQL*Loaderutilityallowsdatatobeloadedthathasbeenproducedbyother
utilitiesfromdifferentdatasourcesjustsolongasitconformstoASCIIformattedordelimitedfiles.
50. Nametwofilesusedfornetworkconnectiontoadatabase.?
TNSNAMES.ORAandSQLNET.ORA

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

28/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
DATABASEADMINISTRATION
51. Whatisadatabaseinstance?Explain.

Adatabaseinstance(Server)isasetofmemorystructureandbackgroundprocessesthataccessasetofdatabasefiles.The
processescanbesharedbyalloftheusers.
Thememorystructurethatisusedtostorethemostquerieddatafromdatabase.Thishelpsuptoimprovedatabaseperformanceby
decreasingtheamountofI/Operformedagainstdatafile.
52. WhatisParallelServer?

Multipleinstancesaccessingthesamedatabase(onlyinmultiCPUenvironments)
53. Whatisaschema?

Thesetofobjectsownedbyuseraccountiscalledtheschema.
54. Whatisanindex?HowitisimplementedinOracledatabase?

Anindexisadatabasestructureusedbytheservertohavedirectaccessofarowinatable.Anindexisautomaticallycreatedwhen
auniqueofprimarykeyconstraintclauseisspecifiedincreatetablecommand
55. Whatareclusters?

Groupoftablesphysicallystoredtogetherbecausetheysharecommoncolumnsandareoftenusedtogetheriscalledcluster.
56. Whatisaclusterkey?

Therelatedcolumnsofthetablesarecalledtheclusterkey.Theclusterkeyisindexedusingaclusterindexanditsvalueisstored
onlyonceformultipletablesinthecluster.
57. WhatarethebasicelementofbaseconfigurationofanOracledatabase?

Itconsistsofoneormoredatafiles.
oneormorecontrolfiles.
twoormoreredologfiles.
TheDatabasecontainsmultipleusers/schemas
oneormorerollbacksegments
oneormoretablespaces
Datadictionarytables
Userobjects(table,indexes,viewsetc.,)
Theserverthataccessthedatabaseconsistsof
SGA(Databasebuffer,DictionaryCacheBuffers,Redologbuffers,SharedSQLpool)
SMON(SystemMONito)
PMON(ProcessMONitor)
LGWR(LoGWrite)
DBWR(DataBaseWrite)
ARCH(ARCHiver)
CKPT(CheckPoint)
RECO
Dispatcher
UserProcesswithassociatedPGS
58. Whatisadeadlock?Explain.

Twoprocesseswaitingtoupdatetherowsofatable,whicharelockedbyotherprocessesthendeadlockarises.
Inadatabaseenvironmentthiswilloftenhappenbecauseofnotissuingtheproperrowlockcommands.Poordesignoffrontend
applicationmaycausethissituationandtheperformanceofserverwillreducedrastically.
Theselockswillbereleasedautomaticallywhenacommit/rollbackoperationperformedoranyoneofthisprocessesbeingkilled
externally.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

29/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
MEMORYMANAGEMENT
59. WhatisSGA?

TheSystemGlobalAreainanOracledatabaseistheareainmemorytofacilitatethetransferofinformationbetweenusers.Itholds
themostrecentlyrequestedstructuralinformationbetweenusers.Itholdsthemostrecentlyrequestedstructuralinformationabout
thedatabase.Thestructureisdatabasebuffers,dictionarycache,redologbufferandsharedpoolarea.
60. Whatisasharedpool?

ThedatadictionarycacheisstoredinanareainSGAcalledthesharedpool.ThiswillallowsharingofparsedSQLstatementsamong
concurrentusers.
61. WhatismeanbyProgramGlobalArea(PGA)?

ItisareainmemorythatisusedbyasingleOracleuserprocess.
62. Whatisadatasegment?

Datasegmentarethephysicalareaswithinadatabaseblockinwhichthedataassociatedwithtablesandclustersarestored.
63. WhatarethefactorscausingthereparsingofSQLstatementsinSGA?

Duetoinsufficientsharedpoolsize.
MonitortheratioofthereloadstakesplacewhileexecutingSQLstatements.Iftheratioisgreaterthan1thenincreasethe
SHARED_POOL_SIZE.
DATABASELOGICAL&PHYSICALARCHITECTURE
64. WhatisDatabaseBuffers?

DatabasebuffersarecacheintheSGAusedtoholdthedatablocksthatarereadfromthedatasegmentsinthedatabasesuchas
tables,indexesandclustersDB_BLOCK_BUFFERSparameterinINIT.ORAdecidesthesize.
65. Whatisdictionarycache?

Dictionarycacheisinformationaboutthedatabaseobjectsstoredinadatadictionarytable.
66. Whatismeantbyrecursivehints?

Numberoftimesprocessesrepeatedlyquerythedictionarytableiscalledrecursivehints.Itisduetothedatadictionarycacheistoo
small.ByincreasingtheSHARED_POOL_SIZEparameterwecanoptimizethesizeofdatadictionarycache.
67. Whatisredologbuffer?

Changesmadetotherecordsarewrittentotheonlineredologfiles.Sothattheycanbeusedinrollforwardoperationsduring
databaserecoveries.Beforewritingthemintotheredologfiles,theywillfirstbroughttoredologbuffersinSGAandLGWRwillwrite
intofilesfrequently.LOG_BUFFERparameterwilldecidethesize.
68. Howwillyouswapobjectsintoadifferenttablespaceforanexistingdatabase?

Exporttheuser
Performimportusingthecommandimpsystem/managerfile=export.dmp indexfile=newrite.sql.Thiswillcreatealldefinitionsinto
newfile.sql.
Dropnecessaryobjects.
Runthescriptnewfile.sqlafteralteringthetablespaces.
Importfromthebackupforthenecessaryobjects.
69. ListtheOptionalFlexibleArchitecture(OFA)ofOracledatabase?HowcanweorganizethetablespacesinOracledatabasetohave
maximumperformance?

SYSTEMDatadictionarytables.
DATAStandardoperationaltables.
DATA2Statictablesusedforstandardoperations
INDEXESIndexesforStandardoperationaltables.
INDEXES1Indexesofstatictablesusedforstandardoperations.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

30/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
TOOLSToolstable.
TOOLS1Indexesfortoolstable.
RBSStandardOperationsRollbackSegments,
RBS1,RBS2Additional/SpecialRollbacksegments.
TEMPTemporarypurposetablespace
TEMP_USERTemporarytablespaceforusers.
USERSUsertablespace.
70. Howwillyouforcedatabasetouseparticularrollbacksegment?

SETTRANSACTIONUSEROLLBACKSEGMENTrbs_name.
71. Whatismeantbyfreeextent?

Afreeextentisacollectionofcontinuousfreeblocksintablespace.Whenasegmentisdroppeditsextentsarereallocatedandare
markedasfree.
72.WhichparameterinStorageclausewillreducenumberofrowsperblock?

PCTFREEparameter
Rowsizealsoreducesnoofrowsperblock.
73. Whatisthesignificanceofhavingstorageclause?

Wecanplanthestorageforatableashowmuchinitialextentsarerequired,howmuchcanbeextendednext,howmuch%should
leavefreeformanagingrowupdating,etc.,
74. HowdoesSpaceallocationtableplacewithinablock?

Eachblockcontainsentriesasfollows
Fixedblockheader
Variableblockheader
RowHeader,rowdate(multiplerowsmayexists)
PCTEREE(%offreespaceforrowupdatinginfuture)
75. WhatistheroleofPCTFREEparameterisstorageclause?

Thisisusedtoreservecertainamountofspaceinablockforexpansionofrows.
76. WhatistheOPTIMALparameter?
Itisusedtosettheoptimallengthofarollbacksegment.
77. WhatisthefunctionalityofSYSTEMtablespace?

Tomanagethedatabaseleveltransactionssuchasmodificationsofthedatadictionarytablethatrecordinformationaboutthefree
spaceusage.
78. Howwillyoucreatemultiplerollbacksegmentsinadatabase?

Createadatabase,whichimplicitlycreatesaSYSTEMrollbacksegmentinaSYSTEMtablespace.
CreateasecondrollbacksegmentnameR0intheSYSTEMtablespace.
Makenewrollbacksegmentavailable(aftershutdown,modifyinit.ora fileandstartdatabase)
Createothertablespaces(RBS)forrollbacksegments.
DeactivaterollbacksegmentR0andactivatethenewlycreatedrollbacksegments.
79. Howthespaceutilizationtakesplacewithinrollbacksegments?

Itwilltrytofitthetransactioninacyclicfashiontoallexistingextents.Onceitfoundanextentisinusethenitforcedtoacquireanew
extent(numberofextentsisbasedontheoptimalsize)
80. Whyqueryfailssometimes?

Rollbacksegmentdynamicallyextenttohandlelargertransactionsentryloads.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

31/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Asingletransactionmaywipeoutallavailablefreespaceintherollbacksegmenttablespace.Thispreventsotheruserusingrollback
segments.
81. Howwillyoumonitorthespaceallocation?

ByqueryingDBA_SEGMENTtable/view
82. Howwillyoumonitorrollbacksegmentstatus?

QueryingtheDBA_ROLLBACK_SEGSview
INUSERollbackSegmentisonline.
AVAILABLERollbackSegmentavailablebutnotonline.
OFFLINERollbackSegmentoffline
INVALIDRollbackSegmentDropped.
NEEDSRECOVERYContainsdatabutneedrecoveryorcorrupted.
PARTLYAVAILABLEContainsdatafromanunresolvedtransactioninvolvingadistributeddatabase.
83. Listthesequenceofeventswhenalargetransactionthatexceedsbeyonditsoptimalvaluewhenanentrywrapsandcausesthe
rollbacksegmenttoexpandintoanotherextend.?

TransactionBegins.
AnentryismadeintheRESheaderfornewtransactionsentry
TransactionacquiresblocksinanextentofRBS
Theentryattemptstowrapintosecondextent.Noneisavailable,sothattheRBSmustextent.
TheRBScheckstoseeifitispartofitsOPTIMALsize.
RBSchoosesitsoldestinactivesegment.
Oldestinactivesegmentiseliminated.
RBSextents
Thedatadictionarytablesforspacemanagementareupdated.
TransactionCompletes.
84. Howcanweplanstorageforverylargetables?

Limitthenumberofextentsinthetable
Separatetablefromitsindexes.
Allocatesufficienttemporarystorage.
85. Howwillyouestimatethespacerequiredbyanonclusteredtables?

Calculatethetotalheadersize
Calculatetheavailabledataspaceperdatablock
Calculatethecombinedcolumnlengthsoftheaveragerow
Calculatethetotalaveragerowsize.
Calculatetheaveragenumberrowsthatcanfitinablock
Calculatethenumberofblocksandbytesrequiredforthetable.
Afterarrivingthecalculation,add10%additionalspacetocalculatetheinitialextentsizeforaworkingtable.
86. Itispossibletouserawdevicesasdatafilesandwhataretheadvantagesoverfilesystemfiles?

Yes.
TheadvantagesoverfilesystemfilesarethatI/OwillbeimprovedbecauseOracleisbyepassingthekernelwhichwritingintodisk.
Diskcorruptionwillbeveryless.
87. WhatisaControlfile?

Databasesoverallphysicalarchitectureismaintainedinafilecalledcontrolfile.Itwillbeusedtomaintaininternalconsistencyand
guiderecoveryoperations.Multiplecopiesofcontrolfilesareadvisable.
88. Howtoimplementthemultiplecontrolfilesforanexistingdatabase?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

32/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Shutdownthedatabase
Copyoneoftheexistingcontrolfiletonewlocation
EditConfigorafilebyaddingnewcontrolfilename
Restartthedatabase.
89. Whatisredologfilemirroring?Howcanbeachieved?

Processofhavingacopyofredologfilesiscalledmirroring.
Thiscanbeachievedbycreatinggroupoflogfilestogether,sothatLGWRwillautomaticallywritesthemtoallthemembersofthe
currentonlineredologgroup.Ifanyonegroupfailsthendatabaseautomaticallyswitchovertonextgroup.Itdegradesperformance.
90. Whatisadvantageofhavingdiskshadowing/mirroring?

Shadowsetofdiskssaveasabackupintheeventofdiskfailure.Inmostoperatingsystemsifanydiskfailureoccursitautomatically
switchovertoplaceoffaileddisk.
ImprovedperformancebecausemostOSsupportvolumeshadowingcandirectfileI/Orequesttousetheshadowsetoffilesinstead
ofthemainsetoffiles.ThisreducesI/Oloadonthemainsetofdisks.
91. WhatisuseofrollbacksegmentsinOracledatabase?

Theyallowthedatabasetomaintainreadconsistencybetweenmultipletransactions.
92. Whatisarollbacksegmententry?

Itisthesetofbeforeimagedatablocksthatcontainrowsthataremodifiedbyatransaction.
Eachrollbacksegmententrymustbecompletedwithinonerollbacksegment.
Asinglerollbacksegmentcanhavemultiplerollbacksegmententries.
93. Whatishitratio?

Itisameasureofwellthedatacachebufferishandlingrequestsfordata.
HitRatio=(LogicalReadsPhysicalReadsHitsMisses)/LogicalReads.
94. Whenwillbeasegmentreleased?

WhenSegmentisdropped.
WhenShrink(RBSonly)
Whentruncated(TRUNCATEusedwithdropstorageoption)
95. Whataredisadvantagesofhavingrawdevices?

Weshoulddependonexport/importutilityforbackup/recovery(fullyreliable)
Thetarcommandcannotbeusedforphysicalfilebackup,insteadwecanuseddcommand,whichislessflexibleandhaslimited
recoveries.
96. Listthefactorsthatcanaffecttheaccuracyoftheestimations?

Thespaceusedtransactionentriesanddeletedrecords,doesnotbecomefreeimmediatelyaftercompletionduetodelayedclean
out.
Trailingnullsandlengthbytesarenotstored.
Insertsof,updatestoanddeletesofrowsaswellascolumnslargerthanasingledatablock,cancausefragmentationachainedrow
pieces.
DATABASESECURITY&ADMINISTRATION
97. WhatisuserAccountinOracledatabase?

Auseraccountisnotaphysicalstructureindatabasebutitishavingimportantrelationshiptotheobjectsinthedatabaseandwillbe
havingcertainprivileges.
98. Howwillyouenforcesecurityusingstoredprocedures?

Dontgrantuseraccessdirectlytotableswithintheapplication.
Insteadgranttheabilitytoaccesstheproceduresthataccessthetables.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

33/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whenprocedureexecuteditwillexecutetheprivilegeofproceduresowner.Userscannotaccesstablesexceptviatheprocedure.
99. Whatarethedictionarytablesusedtomonitoradatabasespace?

DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
SQL*PlusStatements
100. WhatarethetypesofSQLstatement?

DataDefinitionLanguage:CREATE,ALTER,DROP,TRUNCATE,REVOKE,NOAUDIT&COMMIT.
DataManipulationLanguage:INSERT,UPDATE,DELETE,LOCKTABLE,EXPLAINPLAN&SELECT.
TransitionalControl:COMMIT&ROLLBACK
SessionControl:ALTERSESSION&SETROLE
SystemControl:ALTERSYSTEM.
101. Whatisatransaction?

Transactionislogicalunitbetweentwocommitsandcommitandrollback.
102. WhatisdifferencebetweenTRUNCATE&DELETE?

TRUNCATEcommitsafterdeletingentiretablei.e.,cannotberolledback.
DatabasetriggersdonotfireonTRUNCATE
DELETEallowsthefiltereddeletion.Deletedrecordscanberolledbackorcommitted.
DatabasetriggersfireonDELETE.
103. Whatisajoin?Explainthedifferenttypesofjoins?

Joinisaquery,whichretrievesrelatedcolumnsorrowsfrommultipletables.
SelfJoinJoiningthetablewithitself.
EquiJoinJoiningtwotablesbyequatingtwocommoncolumns.
NonEquiJoinJoiningtwotablesbyequatingtwocommoncolumns.
OuterJoinJoiningtwotablesinsuchawaythatquerycanalsoretrieverowsthatdonothavecorrespondingjoinvalueintheother
table.
104. Whatisthesubquery?

Subqueryisaquerywhosereturnvaluesareusedinfilteringconditionsofthemainquery.
105. Whatiscorrelatedsubquery?

Correlatedsubqueryisasubquery,whichhasreferencetothemainquery.
106. ExplainCONNECTBYPRIOR?

Retrievesrowsinhierarchicalordereg.
selectempno,enamefromempwhere.
107. DifferencebetweenSUBSTRandINSTR?

INSTR(String1,String2(n,(m)),
INSTRreturnsthepositionofthemthoccurrenceofthestring2instring1.Thesearchbeginsfromnthpositionofstring1.
SUBSTR(String1n,m)
SUBSTRreturnsacharacterstringofsizeminstring1,startingfromnthpositionofstring1.
108. ExplainUNION,MINUS,UNIONALLandINTERSECT?

INTERSECTreturnsalldistinctrowsselectedbybothqueries.
MINUSreturnsalldistinctrowsselectedbythefirstquerybutnotbythesecond.
UNIONreturnsalldistinctrowsselectedbyeitherquery

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

34/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
UNIONALLreturnsallrowsselectedbyeitherquery,includingallduplicates.
109. WhatisROWID?

ROWIDisapseudocolumnattachedtoeachrowofatable.Itis18characterslong,blockno,rownumberarethecomponentsof
ROWID.
110. Whatisthefastestwayofaccessingarowinatable?

UsingROWID.
CONSTRAINTS
111. Whatisanintegrityconstraint?

Integrityconstraintisarulethatrestrictsvaluestoacolumninatable.
112. Whatisreferentialintegrityconstraint?

Maintainingdataintegritythroughasetofrulesthatrestrictthevaluesofoneormorecolumnsofthetablesbasedonthevaluesof
primarykeyoruniquekeyofthereferencedtable.
113. WhatistheusageofSAVEPOINTS?

SAVEPOINTSareusedtosubdivideatransactionintosmallerparts.Itenablesrollingbackpartofatransaction.Maximumoffive
savepointsareallowed.
114. WhatisONDELETECASCADE?

WhenONDELETECASCADEisspecifiedOraclemaintainsreferentialintegritybyautomaticallyremovingdependentforeignkey
valuesifareferencedprimaryoruniquekeyvalueisremoved.
115. Whatarethedatatypesallowedinatable?

CHAR,VARCHAR2,NUMBER,DATE,RAW,LONGandLONGRAW.
116. WhatisdifferencebetweenCHARandVARCHAR2?WhatisthemaximumSIZEallowedforeachtype?

CHARpadsblankspacestothemaximumlength.
VARCHAR2doesnotpadblankspaces.
ForCHARthemaximumlengthis255and2000forVARCHAR2.
117. HowmanyLONGcolumnsareallowedinatable?IsitpossibletouseLONGcolumnsinWHEREclauseorORDERBY?

OnlyoneLONGcolumnisallowed.ItisnotpossibletouseLONGcolumninWHEREorORDERBYclause.
118. WhataretheprerequisitestomodifydatatypeofacolumnandtoaddacolumnwithNOTNULLconstraint?

Tomodifythedatatypeofacolumnthecolumnmustbeempty.
ToaddacolumnwithNOTNULLconstrain,thetablemustbeempty.
119. Wheretheintegrityconstraintsarestoredindatadictionary?

TheintegrityconstraintsarestoredinUSER_CONSTRAINTS.
120. Howwillyouactivate/deactivateintegrityconstraints?

TheintegrityconstraintscanbeenabledordisabledbyALTERTABLEENABLECONSTRAINT/DISABLECONSTRAINT.
121. IfuniquekeyconstraintonDATEcolumniscreated,willitvalidatetherowsthatareinsertedwithSYSDATE?

Itwont,BecauseSYSDATEformatcontainstimeattachedwithit.
122. Whatisadatabaselink?

Databaselinkisanamedpaththroughwhicharemotedatabasecanbeaccessed.
123. Howtoaccessthecurrentvalueandnextvaluefromasequence?Isitpossibletoaccessthecurrentvalueinasessionbefore
accessingnextvalue?

SequencenameCURRVAL,sequencenameNEXTVAL.Itisnotpossible.Onlyifyouaccessnextvalueinthesession,currentvalue
canbeaccessed.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

35/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
124. WhatisCYCLE/NOCYCLEinaSequence?

CYCLEspecifiesthatthesequencecontinuetogeneratevaluesafterreachingeithermaximumorminimumvalue.Afterpan
ascendingsequencereachesitsmaximumvalue,itgeneratesitsminimumvalue.Afteradescendingsequencereachesitsminimum,
itgeneratesitsmaximum.
NOCYCLEspecifiesthatthesequencecannotgeneratemorevaluesafterreachingitsmaximumorminimumvalue.
125. WhataretheadvantagesofVIEW?
Toprotectsomeofthecolumnsofatablefromotherusers.
Tohidecomplexityofaquery.
Tohidecomplexityofcalculations.
126. Canaviewbeupdated/inserted/deleted?IfYesunderwhatconditions?

AViewcanbeupdated/deleted/insertedifithasonlyonebasetableiftheviewisbasedoncolumnsfromoneormoretablesthen
insert,updateanddeleteisnotpossible.
127. Ifaviewonasinglebasetableismanipulatedwillthechangesbereflectedonthebasetable?

Ifchangesaremadetothetablesandthesetablesarethebasetablesofaview,thenthechangeswillbereferenceontheview.
OSRELATESINTERVIEWQUESTIONSFORDBAPROFESSIONAL:
1. HowdoyoulistthefilesinanUNIXdirectorywhilealsoshowinghiddenfiles?

lsltra
2. HowdoyouexecuteaUNIXcommandinthebackground?

Usethe&
3. WhatUNIXcommandwillcontrolthedefaultfilepermissionswhenfilesarecreated?

Umask
4. Explaintheread,write,andexecutepermissionsonaUNIXdirectory.?

Readallowsyoutoseeandlistthedirectorycontents.
Writeallowsyoutocreate,editanddeletefilesandsubdirectoriesinthedirectory.
Executegivesyouthepreviousread/writepermissionsplusallowsyoutochangeintothedirectoryandexecuteprogramsorshells
fromthedirectory.
5. thedifferencebetweenasoftlinkandahardlink?

Asymbolic(soft)linkedfileandthetargetedfilecanbelocatedonthesameordifferentfilesystemwhileforahardlinktheymustbe
locatedonthesamefilesystem.
6. GivethecommandtodisplayspaceusageontheUNIXfilesystem.?

dflk
7. Explainiostat,vmstatandnetstat.?

Iostatreportsonterminal,diskandtapeI/Oactivity.
Vmstatreportsonvirtualmemorystatisticsforprocesses,disk,tapeandCPUactivity.
Netstatreportsonthecontentsofnetworkdatastructures.
8. HowwouldyouchangealloccurrencesofavalueusingVI?

Use:%s///g
9. GivetwoUNIXkernelparametersthateffectanOracleinstall?
SHMMAX&SHMMNI

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

36/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
10. Briefly,howdoyouinstallOraclesoftwareonUNIX.?

Basically,setupdisks,kernelparameters,andrunorainst..
ORACLETROUBLESHOOTINGINTERVIEWQUESTIONS
1. HowcanyoudetermineifanOracleinstanceisupfromtheoperatingsystemlevel?
Level:Low
Expectedanswer:ThereareseveralbaseOracleprocessesthatwillberunningonmultiuseroperatingsystems,thesewillbe
smon,pmon,dbwrandlgwr.Anyanswerthathasthemusingtheiroperatingsystemprocessshowingfeaturetocheckforthese
isacceptable.Forexample,onUNIXapsef|grepdbwrwillshowwhatinstancesareup.
2. UsersfromthePCclientsaregettingmessagesindicating:
Level:Low
ORA06114:(Cncterr,cantgeterrtxt.SeeServrMsgs&CodesManual)
Whatcouldtheproblembe?
Expectedanswer:Theinstancenameisprobablyincorrectintheirconnectionstring.
3. UsersfromthePCclientsaregettingthefollowingerrorstack:
Level:Low
ERROR:ORA01034:ORACLEnotavailable
ORA07318:smsget:openerrorwhenopeningsgadef.dbffile.
HPUXError:2:Nosuchfileordirectory
Whatistheprobablecause?
Expectedanswer:TheOracleinstanceisshutdownthattheyaretryingtoaccess,restarttheinstance.
4. HowcanyoudetermineiftheSQLNETprocessisrunningforSQLNETV1?HowaboutV2?
Level:Low
Expectedanswer:ForSQLNETV1checkfortheexistenceoftheorasrvprocess.Youcanusethecommandtcpctlstatustoget
afullstatusoftheV1TCPIPserver,otherprotocolshavesimilarcommandformats.ForSQLNETV2checkforthepresenceof
theLISTENERprocess(s)oryoucanissuethecommandlsnrctlstatus.
5. WhatfilewillgiveyouOracleinstancestatusinformation?Whereisitlocated?
Level:Low
Expectedanswer:Thealert.oralog.Itislocatedinthedirectoryspecifiedbythebackground_dump_destparameterinthe
v$parametertable.
6. Usersaren?tbeingallowedonthesystem.Thefollowingmessageisreceived:
Level:Intermediate
ORA00257archiverisstuck.Connectinternalonly,untilfreed
Whatistheproblem?
Expectedanswer:Thearchivedestinationisprobablyfull,backupthearchivelogsandremovethemandthearchiverwillre
start.
7. WherewouldyoulooktofindoutifaredologwascorruptedassumingyouareusingOraclemirroredredologs?
Level:Intermediate
Expectedanswer:ThereisnomessagethatcomestotheSQLDBAorSRVMGRprogramsduringstartupinthissituation,you
mustcheckthealert.logfileforthisinformation.
8. Youattempttoaddadatafileandget:
Level:Intermediate
ORA01118:cannotaddanymoredatafiles:limitof40exceeded
Whatistheproblemandhowcanyoufixit?
Expectedanswer:Whenthedatabasewascreatedthedb_filesparameterintheinitializationfilewassetto40.Youcan
shutdownandresetthistoahighervalue,uptothevalueofMAX_DATAFILESasspecifiedatdatabasecreation.Ifthe
MAX_DATAFILESissettolow,youwillhavetorebuildthecontrolfiletoincreaseitbeforeproceeding.
9. Youlookatyourfragmentationreportandseethatsmonhasn?tcoalescedanyofyoutablespaces,eventhoughyouknowseveral
havelargechunksofcontiguousfreeextents.Whatistheproblem?
Level:High
Expectedanswer:Checkthedba_tablespacesviewforthevalueofpct_increaseforthetablespaces.Ifpct_increaseiszero,
smonwillnotcoalescetheirfreespace.
10. Yourusersgetthefollowingerror:
Level:Intermediate
ORA00055maximumnumberofDMLlocksexceeded
Whatistheproblemandhowdoyoufixit?
Expectedanswer:ThenumberofDMLLocksissetbytheinitializationparameterDML_LOCKS.Ifthisvalueissettolow(whichit
isbydefault)youwillgetthiserror.IncreasethevalueofDML_LOCKS.Ifyouaresurethatthisisjustatemporaryproblem,you
canhavethemwaitandthentryagainlaterandtheerrorshouldclear.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

37/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
11. YougetacallfromyoubackupDBAwhileyouareonvacation.Hehascorruptedallofthecontrolfileswhileplayingwiththe
ALTERDATABASEBACKUPCONTROLFILEcommand.Whatdoyoudo?
Level:High
Expectedanswer:AslongasalldatafilesaresafeandhewassuccessfulwiththeBACKUPcontrolfilecommandyoucandothe
following:
CONNECTINTERNAL
STARTUPMOUNT
(TakeanyreadonlytablespacesofflinebeforenextstepALTERDATABASEDATAFILE.OFFLINE)
RECOVERDATABASEUSINGBACKUPCONTROLFILE
ALTERDATABASEOPENRESETLOGS
(bringreadonlytablespacesbackonline)
Shutdownandbackupthesystem,thenrestart
IftheyhavearecentoutputfilefromtheALTERDATABASEBACKUPCONTROLFILETOTRACEcommand,theycanusethat
torecoveraswell.
Ifnobackupofthecontrolfileisavailablethenthefollowingwillberequired:
CONNECTINTERNAL
STARTUPNOMOUNT
CREATECONTROLFILE..
However,theywillneedtoknowallofthedatafiles,logfiles,andsettingsforMAXLOGFILES,MAXLOGMEMBERS,
MAXLOGHISTORY,MAXDATAFILESforthedatabasetousethecommand
1. WhyisaUNIONALLfasterthanaUNION?
Theunionoperation,youwillrecall,bringstwosetsofdatatogether.Itwill*NOT*howeverproduceduplicateorredundantrows.To
performthisfeatofmagic,aSORToperationisdoneonbothtables.Thisisobviouslycomputationallyintensive,andusessignificant
memoryaswell.AUNIONALLconverselyjustdumpscollectionofbothsetstogetherinrandomorder,notworryingaboutduplicates.
2. WhataresomeadvantagestousingOraclesCREATEDATABASEstatementtocreateanewdatabasemanually?
Youcanscripttheprocesstoincludeitinasetofinstallscriptsyoudeliverwithaproduct.
YoucanputyourcreatedatabasescriptinCVSforversioncontrol,soasyoumakechangesoradjustmentstoit,youcantrackthem
likeyoudochangestosoftwarecode.
Youcanlogtheoutputandreviewitforerrors.
Youlearnmoreabouttheprocessofdatabasecreation,suchaswhatoptionsareavailableandwhy.
3. Whatarethreerulesofthumbtocreategoodpasswords?HowwouldaDBAenforcethoserulesinOracle?Whatbusiness
challengesmightyouencounter?
Typicalpasswordcrackingsoftwareusesadictionaryinthelocallanguage,aswellasalistofpropernames,andcombinations
thereoftoattempttoguessunknownpasswords.Sincecomputerscanchurnthrough10softhousandsofattemptsquickly,thiscan
beaveryaffectivewaytobreakintoadatabase.Agoodpasswordthereforeshouldnotbeadictionaryword,itshouldnotbea
propername,birthday,orotherobviousguessableinformation.Itshouldalsobeofsufficientlength,suchaseighttotencharacters,
includingupperandlowercase,specialcharacters,andevenalternatecharactersifpossible.
Oraclehasafacilitycalledpasswordsecurityprofiles.Wheninstalledtheycanenforcecomplexity,andlengthrulesaswellasother
passwordrelatedsecuritymeasures.
Inthesecurityarena,passwordscanbemadebetter,anditisafairlysolvableproblem.However,whataboutintherealworld?Often
thebiggestchallengeisinimplementingasetofruleslikethisintheenterprise.Therewilllikelybealotofresistancetothis,asit
createsadditionalhasslesforusersofthesystemwhomaynotbeusedtothinkingaboutsecurityseriously.Educatingbusinessfolks
abouttherealrisks,bycomingupwithrealstoriesofvulnerabilitiesandbreakinsyouveencounteredonthejob,orthosediscussed
ontheinternetgoesalongwaytowardsemphasizingwhatisatstake.
4. DescribetheOracleWaitInterface,howitworks,andwhatitprovides.Whataresomelimitations?Whatdothe
db_file_sequential_readanddb_file_scattered_readeventsindicate?
TheOracleWaitInterfacereferstoOraclesdatadictionaryformanagingwaitevents.Selectingfromtablessuchasv$system_event
andv$session_eventgiveyoueventtotalsthroughthelifeofthedatabase(orsession).Theformeraretotalsforthewholesystem,
andlatteronapersessionbasis.Theeventdb_file_sequential_readreferstosingleblockreads,andtableaccessesbyrowid.
db_file_scattered_readconverselyreferstofulltablescans.Itissonamedbecausetheblocksareread,andscatteredintothebuffer
cache.
5. HowdoyoureturnthetopNresultsofaqueryinOracle?Whydoesnttheobviousmethodwork?
MostpeoplethinkofusingtheROWNUMpseudocolumnwithORDERBY.UnfortunatelytheROWNUMisdetermined*before*the
ORDERBYsoyoudontgettheresultsyouwant.TheansweristouseasubquerytodotheORDERBYfirst.Forexampletoreturn
thetop5employeesbysalary:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

38/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
SELECT*FROM(SELECT*FROMemployeesORDERBYsalary)WHEREROWNUM<5
6. CanOraclesDataGuardbeusedonStandardEdition,andifsohow?Howcanyoutestthatthestandbydatabaseisinsync?
OraclesDataGuardtechnologyisalayerofsoftwareandautomationbuiltontopofthestandbydatabasefacility.InOracleStandard
Editionitispossibletobeastandbydatabase,andupdateit*manually*.Roughly,putyourproductiondatabaseinarchivelogmode.
Createahotbackupofthedatabaseandmoveittothestandbymachine.Thencreateastandbycontrolfileontheproduction
machine,andshipthatfile,alongwithallthearchivedredologfilestothestandbyserver.Onceyouhaveallthesefilesassembled,
placethemintheirproperlocations,recoverthestandbydatabase,andyourereadytoroll.Fromthispointon,youmustmanually
ship,andmanuallyapplythosearchivedredologstostayinsyncwithproduction.
Totestyourstandbydatabase,makeachangetoatableontheproductionserver,andcommitthechange.Thenmanuallyswitcha
logfilesothosechangesarearchived.Manuallyshipthenewestarchivedredologfile,andmanuallyapplyitonthestandbydatabase.
Thenopenyourstandbydatabaseinreadonlymode,andselectfromyourchangedtabletoverifythosechangesareavailable.Once
youredone,shutdownyourstandbyandstartupagaininstandbymode.
7. Whatisadatabaselink?Whatisthedifferencebetweenapublicandaprivatedatabaselink?Whatisafixeduserdatabase
link?
Adatabaselinkallowsyoutomakeaconnectionwitharemotedatabase,Oracleornot,andquerytablesfromit,evenincorporating
thoseaccesseswithjoinstolocaltables.
Aprivatedatabaselinkonlyworksfor,andisaccessibletotheuser/schemathatownsit.Aglobalonecanbeaccessedbyanyuserin
thedatabase.
Afixeduserlinkspecifiesthatyouwillconnecttotheremotedbasoneandonlyoneuserthatisdefinedinthelink.

TECHNICALORACLEQUESTIONS

WhatarethecomponentsofphysicaldatabasestructureofOracledatabase?Oracledatabaseiscomprisedofthreetypesoffiles.
Oneormoredatafiles,twoaremoreredologfiles,andoneormorecontrolfiles.
WhatarethecomponentsoflogicaldatabasestructureofOracledatabase?
Therearetablespacesanddatabasesschemaobjects.
Whatisatablespace?
AdatabaseisdividedintoLogicalStorageUnitcalledtablespaces.Atablespaceisusedtogroupedrelatedlogicalstructures
together.
WhatisSYSTEMtablespaceandwhenisitcreated?
EveryOracledatabasecontainsatablespacenamedSYSTEM,whichisautomaticallycreatedwhenthedatabaseiscreated.The
SYSTEMtablespacealwayscontainsthedatadictionarytablesfortheentiredatabase.
Explaintherelationshipamongdatabase,tablespaceanddatafile?
Eachdatabaseslogicallydividedintooneormoretablespacesoneormoredatafilesareexplicitlycreatedforeachtablespace.
Whatisschema?
Aschemaiscollectionofdatabaseobjectsofauser.
WhatareSchemaObjects?
Schemaobjectsarethelogicalstructuresthatdirectlyrefertothedatabasesdata.Schemaobjectsincludetables,views,sequences,
synonyms,indexes,clusters,databasetriggers,procedures,functionspackagesanddatabaselinks.
Canobjectsofthesameschemaresideindifferenttablespaces?
Yes.
Canatablespaceholdobjectsfromdifferentschemes?
Yes.
WhatisOracletable?
AtableisthebasicunitofdatastorageinanOracledatabase.Thetablesofadatabaseholdalloftheuseraccessibledata.Table
dataisstoredinrowsandcolumns.
WhatisanOracleview?
Aviewisavirtualtable.Everyviewhasaqueryattachedtoit.(ThequeryisaSELECTstatementthatidentifiesthecolumnsandrows
ofthetable(s)theviewuses.)
WhatisPartialBackup?
APartialBackupisanyoperatingsystembackupshortofafullbackup,takenwhilethedatabaseisopenorshutdown.
WhatisMirroredonlineRedoLog?

Amirroredonlineredologconsistsofcopiesofonlineredologfilesphysicallylocatedonseparatedisks,changesmadetoone
memberofthegrouparemadetoallmembers.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

39/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatisFullBackup?
Afullbackupisanoperatingsystembackupofalldatafiles,onlineredologfilesandcontrolfilethatconstituteORACLEdatabase
andtheparameter.
CanaViewbasedonanotherView?
Yes.
CanaTablespaceholdobjectsfromdifferentSchemes?
Yes.
CanobjectsofthesameSchemaresideindifferenttablespace?
Yes.
WhatistheuseofControlFile?
WhenaninstanceofanORACLEdatabaseisstarted,itscontrolfileisusedtoidentifythedatabaseandredologfilesthatmustbe
openedfordatabaseoperationtoproceed.Itisalsousedindatabaserecovery.
DoViewcontainData?
Viewsdonotcontainorstoredata.
WhataretheReferentialactionssupportedbyFOREIGNKEYintegrityconstraint?
UPDATEandDELETERestrictAreferentialintegrityrulethatdisallowstheupdateordeletionofreferenceddata.DELETECascade
Whenareferencedrowisdeletedallassociateddependentrowsaredeleted.
WhatarethetypeofSynonyms?
TherearetwotypesofSynonymsPrivateandPublic.
WhatisaRedoLog?
ThesetofRedoLogfilesSYSDATE,UID,USERorUSERENVSQLfunctions,orthepseudocolumnsLEVELorROWNUM.
WhatisanIndexSegment?
EachIndexhasanIndexsegmentthatstoresallofitsdata.
ExplaintherelationshipamongDatabase,TablespaceandDatafile?
Eachdatabaseslogicallydividedintooneormoretablespacesoneormoredatafilesareexplicitlycreatedforeachtablespace
WhatarethedifferenttypeofSegments?
DataSegment,IndexSegment,RollbackSegmentandTemporarySegment.
WhatareClusters?
Clustersaregroupsofoneormoretablesphysicallystorestogethertosharecommoncolumnsandareoftenusedtogether.
WhatisanIntegrityConstrains?
Anintegrityconstraintisadeclarativewaytodefineabusinessruleforacolumnofatable.
WhatisanIndex?
AnIndexisanoptionalstructureassociatedwithatabletohavedirectaccesstorows,whichcanbecreatedtoincreasethe
performanceofdataretrieval.Indexcanbecreatedononeormorecolumnsofatable.
WhatisanExtent?
AnExtentisaspecificnumberofcontiguousdatablocks,obtainedinasingleallocation,andusedtostoreaspecifictypeof
information.
WhatisaView?
Aviewisavirtualtable.EveryviewhasaQueryattachedtoit.(TheQueryisaSELECTstatementthatidentifiesthecolumnsand
rowsofthetable(s)theviewuses.)
WhatisTable?
AtableisthebasicunitofdatastorageinanORACLEdatabase.Thetablesofadatabaseholdalloftheuseraccessibledata.Table
dataisstoredinrowsandcolumns.
Canaviewbasedonanotherview?Yes.
Whataretheadvantagesofviews?
Provideanadditionalleveloftablesecurity,byrestrictingaccesstoapredeterminedsetofrowsandcolumnsofatable.
Hidedatacomplexity.
Simplifycommandsfortheuser.
Presentthedatainadifferentperspectivefromthatofthebasetable.
Storecomplexqueries.
WhatisanOraclesequence?
Asequencegeneratesaseriallistofuniquenumbersfornumericalcolumnsofadatabasestables.
Whatisasynonym?
Asynonymisanaliasforatable,view,sequenceorprogramunit.
Whatarethetypesofsynonyms?
Therearetwotypesofsynonymsprivateandpublic.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

40/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisaprivatesynonym?
Onlyitsownercanaccessaprivatesynonym.
Whatisapublicsynonym?
Anydatabaseusercanaccessapublicsynonym.
Whataresynonymsusedfor?
Masktherealnameandownerofanobject.
Providepublicaccesstoanobject
Providelocationtransparencyfortables,viewsorprogramunitsofaremotedatabase.
SimplifytheSQLstatementsfordatabaseusers.
WhatisanOracleindex?
Anindexisanoptionalstructureassociatedwithatabletohavedirectaccesstorows,whichcanbecreatedtoincreasethe
performanceofdataretrieval.Indexcanbecreatedononeormorecolumnsofatable.
Howaretheindexupdates?
IndexesareautomaticallymaintainedandusedbyOracle.Changestotabledataareautomaticallyincorporatedintoallrelevant
indexes.
WhatisaTablespace?
AdatabaseisdividedintoLogicalStorageUnitcalledtablespace.Atablespaceisusedtogroupedrelatedlogicalstructurestogether
WhatisRollbackSegment?
ADatabasecontainsoneormoreRollbackSegmentstotemporarilystoreundoinformation.
WhataretheCharacteristicsofDataFiles?
Adatafilecanbeassociatedwithonlyonedatabase.Oncecreatedadatafilecantchangesize.Oneormoredatafilesformalogical
unitofdatabasestoragecalledatablespace.
HowtodefineDataBlocksize?
AdatablocksizeisspecifiedforeachORACLEdatabasewhenthedatabaseiscreated.Adatabaseusersandallocatedfree
databasespaceinORACLEdatablocks.BlocksizeisspecifiedinINIT.ORAfileandcantbechangedlatter.
WhatdoesaControlfileContain?
AControlfilerecordsthephysicalstructureofthedatabase.Itcontainsthefollowinginformation.
DatabaseName
Namesandlocationsofadatabasesfilesandredologfiles.
Timestampofdatabasecreation.
WhatisdifferencebetweenUNIQUEconstraintandPRIMARYKEYconstraint?

AcolumndefinedasUNIQUEcancontainNullswhileacolumndefinedasPRIMARYKEYcantcontainNulls.
WhatisIndexCluster?
AClusterwithanindexontheClusterKey
WhendoesaTransactionend?
WhenitiscommittedorRollbacked.
WhatistheeffectofsettingthevalueALL_ROWSforOPTIMIZER_GOALparameteroftheALTERSESSIONcommand?What
arethefactorsthataffectOPTIMIZERinchoosinganOptimizationapproach?
AnswerTheOPTIMIZER_MODEinitializationparameterStatisticsintheDataDictionarytheOPTIMIZER_GOALparameterofthe
ALTERSESSIONcommandhintsinthestatement.
WhatistheeffectofsettingthevalueCHOOSEforOPTIMIZER_GOAL,parameteroftheALTERSESSIONCommand?
TheOptimizerchoosesCost_basedapproachandoptimizeswiththegoalofbestthroughputifstatisticsforatleastoneofthetables
accessedbytheSQLstatementexistinthedatadictionary.OtherwisetheOPTIMIZERchoosesRULE_basedapproach.
Howdoesonecreateanewdatabase?(forDBA)
OnecancreateandmodifyOracledatabasesusingtheOracledbca(DatabaseConfigurationAssistant)utility.Thedbcautilityis
locatedinthe$ORACLE_HOME/bindirectory.TheOracleUniversalInstaller(oui)normallystartsitafterinstallingthedatabase
serversoftware.
Onecanalsocreatedatabasesmanuallyusingscripts.Thisoption,however,isfallingoutoffashion,asitisquiteinvolvedanderror
prone.LookatthisexampleforcreatingandOracle9idatabase:
CONNECTSYSASSYSDBA
ALTERSYSTEMSETDB_CREATE_FILE_DEST=/u01/oradata/'
ALTERSYSTEMSETDB_CREATE_ONLINE_LOG_DEST_1=/u02/oradata/'
ALTERSYSTEMSETDB_CREATE_ONLINE_LOG_DEST_2=/u03/oradata/'
CREATEDATABASE
WhatdatabaseblocksizeshouldIuse?(forDBA)
Oraclerecommendsthatyourdatabaseblocksizematch,orbemultiplesofyouroperatingsystemblocksize.Onecanusesmaller
blocksizes,buttheperformancecostissignificant.Yourchoiceshoulddependonthetypeofapplicationyouarerunning.Ifyouhave
manysmalltransactionsaswithOLTP,useasmallerblocksize.Withfewerbutlargertransactions,aswithaDSSapplication,usea
largerblocksize.Ifyouareusingavolumemanager,consideryouroperatingsystemblocksizetobe8K.Thisisbecausevolume
managerproductsuse8Kblocks(andthisisnotconfigurable).

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

41/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatarethedifferentapproachesusedbyOptimizerinchoosinganexecutionplan?
RulebasedandCostbased.
WhatdoesROLLBACKdo?
ROLLBACKretractsanyofthechangesresultingfromtheSQLstatementsinthetransaction.
Howdoesonecoalescefreespace?(forDBA)
SMONcoalescesfreespace(extents)intolarger,contiguousextentsevery2hoursandeventhen,onlyforashortperiodoftime.
SMONwillnotcoalescefreespaceifatablespacesdefaultstorageparameterpctincreaseissetto0.WithOracle7.3onecan
manuallycoalesceatablespaceusingtheALTERTABLESPACECOALESCEcommand,untilthenuse:
SQL>altersessionseteventsimmediatetracenamecoalesceleveln'
WherenisthetablespacenumberyougetfromSELECTTS#,NAMEFROMSYS.TS$
YoucangetstatusinformationaboutthisprocessbyselectingfromtheSYS.DBA_FREE_SPACE_COALESCEDdictionaryview.
Howdoesonepreventtablespacefragmentation?(forDBA)
AlwayssetPCTINCREASEto0or100.
BizarrevaluesforPCTINCREASEwillcontributetofragmentation.ForexampleifyousetPCTINCREASEto1youwillseethatyour
extentsaregoingtohaveweirdandwackysizes:100K,100K,101K,102K,etc.Suchextentsofbizarresizearerarelyreusedintheir
entirety.PCTINCREASEof0or100givesyouniceroundextentsizesthatcaneasilybereused.E.g..100K,100K,200K,400K,etc.

Usethesameextentsizeforallthesegmentsinagiventablespace.LocallyManagedtablespaces(availablefrom8ionwards)with
uniformextentsizesvirtuallyeliminatesanytablespacefragmentation.Notethatthenumberofextentspersegmentdoesnotcause
anyperformanceissueanymore,unlesstheyrunintothousandsandthousandswhereadditionalI/Omayberequiredtofetchthe
additionalblockswhereextentmapsofthesegmentarestored.
Wherecanonefindthehighwatermarkforatable?(forDBA)
Thereisnosinglesystemtable,whichcontainsthehighwatermark(HWM)foratable.AtablesHWMcanbecalculatedusingthe
resultsfromthefollowingSQLstatements:
SELECTBLOCKS
FROMDBA_SEGMENTS
WHEREOWNER=UPPER(owner)ANDSEGMENT_NAME=UPPER(table)
ANALYZETABLEowner.table ESTIMATESTATISTICS
SELECTEMPTY_BLOCKS
FROMDBA_TABLES
WHEREOWNER=UPPER(owner)ANDSEGMENT_NAME=UPPER(table)
Thus,thetablesHWM=(queryresult1)(queryresult2)1
NOTE:YoucanalsousetheDBMS_SPACEpackageandcalculatetheHWM=TOTAL_BLOCKSUNUSED_BLOCKS1.
WhatisCOSTbasedapproachtooptimization?
Consideringavailableaccesspathsanddeterminingthemostefficientexecutionplanbasedonstatisticsinthedatadictionaryforthe
tablesaccessedbythestatementandtheirassociatedclustersandindexes.
WhatdoesCOMMITdo?
COMMITmakespermanentthechangesresultingfromallSQLstatementsinthetransaction.ThechangesmadebytheSQL
statementsofatransactionbecomevisibletootherusersessionstransactionsthatstartonlyaftertransactioniscommitted.
Howareextentsallocatedtoasegment?(forDBA)
Oracle8andaboveroundsoffextentstoamultipleof5blockswhenmorethan5blocksarerequested.Ifonerequests16Kor2
blocks(assuminga8Kblocksize),Oracledoesntrounditupto5blocks,butitallocates2blocksor16Kasrequested.Ifoneasksfor
8blocks,Oraclewillrounditupto10blocks.
Spaceallocationalsodependsuponthesizeofcontiguousfreespaceavailable.Ifoneasksfor8blocksandOraclefindsa
contiguousfreespacethatisexactly8blocks,itwouldgiveityou.Ifitwere9blocks,Oraclewouldalsogiveittoyou.ClearlyOracle
doesntalwaysroundextentstoamultipleof5blocks.
Theexceptiontothisruleislocallymanagedtablespaces.Ifatablespaceiscreatedwithlocalextentmanagementandtheextentsize
is64K,thenOracleallocates64Kor8blocksassuming8Kblocksize.Oracledoesntroundituptothemultipleof5whena
tablespaceislocallymanaged.
Canonerenameadatabaseuser(schema)?(forDBA)
No,thisislistedasEnhancementRequest158508.Workaround:
DoauserlevelexportofuserA
createnewuserB
Importsystem/managerfromuser=Atouser=B
DropuserA
DefineTransaction?ATransactionisalogicalunitofworkthatcomprisesoneormoreSQLstatementsexecutedbyasingleuser.
WhatisReadOnlyTransaction?
AReadOnlytransactionensuresthattheresultsofeachqueryexecutedinthetransactionareconsistantwithrespecttothesame
pointintime.
Whatisadeadlock?Explain.
Twoprocesseswatingtoupdatetherowsofatablewhicharelockedbytheotherprocessthendeadlockarises.Inadatabase
environmentthiswilloftenhappenbecauseofnotissuingproperrowlockcommands.Poordesignoffrontendapplicationmaycause
thissituationandtheperformanceofserverwillreducedrastically.
Theselockswillbereleasedautomaticallywhenacommit/rollbackoperationperformedoranyoneofthisprocessesbeingkilled
externally.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

42/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatisaSchema?
Thesetofobjectsownedbyuseraccountiscalledtheschema.
WhatisaclusterKey?
Therelatedcolumnsofthetablesarecalledtheclusterkey.Theclusterkeyisindexedusingaclusterindexanditsvalueisstored
onlyonceformultipletablesinthecluster.
WhatisParallelServer?
Multipleinstancesaccessingthesamedatabase(OnlyInMultiCPUenvironments)
WhatarethebasicelementofBaseconfigurationofanoracleDatabase?
Itconsistsof
oneormoredatafiles.
oneormorecontrolfiles.
twoormoreredologfiles.
TheDatabasecontains
multipleusers/schemas
oneormorerollbacksegments
oneormoretablespaces
Datadictionarytables
Userobjects(table,indexes,viewsetc.,)
Theserverthataccessthedatabaseconsistsof
SGA(Databasebuffer,DictionaryCacheBuffers,Redologbuffers,SharedSQLpool)
SMON(SystemMONito)
PMON(ProcessMONitor)
LGWR(LoGWrite)
DBWR(DataBaseWrite)
ARCH(ARCHiver)
CKPT(CheckPoint)
RECO
Dispatcher
UserProcesswithassociatedPGS
Whatisclusters?
GroupoftablesphysicallystoredtogetherbecausetheysharecommoncolumnsandareoftenusedtogetheriscalledCluster.
WhatisanIndex?HowitisimplementedinOracleDatabase?
Anindexisadatabasestructureusedbytheservertohavedirectaccessofarowinatable.Anindexisautomaticallycreatedwhen
auniqueofprimarykeyconstraintclauseisspecifiedincreatetablecomman(Ver7.0)
WhatisaDatabaseinstance?Explain
Adatabaseinstance(Server)isasetofmemorystructureandbackgroundprocessesthataccessasetofdatabasefiles.
Theprocesscanbesharedbyallusers.Thememorystructurethatareusedtostoremostquerieddatafromdatabase.Thishelps
uptoimprovedatabaseperformancebydecreasingtheamountofI/Operformedagainstdatafile.
WhatistheuseofANALYZEcommand?
Toperformoneofthesefunctiononanindex,table,orcluster:
Tocollectstatisticsaboutobjectusedbytheoptimizerandstoretheminthedatadictionary.
Todeletestatisticsabouttheobjectusedbyobjectfromthedatadictionary.
Tovalidatethestructureoftheobject.
Toidentifymigratedandchainedrowsofthetableorcluster.
Whatisdefaulttablespace?
TheTablespacetocontainschemaobjectscreatedwithoutspecifyingatablespacename.
WhatarethesystemresourcesthatcanbecontrolledthroughProfile?
ThenumberofconcurrentsessionstheusercanestablishtheCPUprocessingtimeavailabletotheuserssessiontheCPU
processingtimeavailabletoasinglecalltoORACLEmadebyaSQLstatementtheamountoflogicalI/Oavailabletotheusers
sessiontheamoutoflogicalI/OavailabletoasinglecalltoORACLEmadebyaSQLstatementtheallowedamountofidletimefor
theuserssessiontheallowedamountofconnecttimefortheuserssession.
WhatisTablespaceQuota?
Thecollectiveamountofdiskspaceavailabletotheobjectsinaschemaonaparticulartablespace.
WhatarethedifferentLevelsofAuditing?
StatementAuditing,PrivilegeAuditingandObjectAuditing.
WhatisStatementAuditing?
Statementauditingistheauditingofthepowerfulsystemprivilegeswithoutregardtospecificallynamedobjects.
Whatarethedatabaseadministratorsutilitiesavailable?
SQL*DBAThisallowsDBAtomonitorandcontrolanORACLEdatabase.SQL*LoaderItloadsdatafromstandardoperating
systemfiles(Flatfiles)intoORACLEdatabasetables.Export(EXP)andImport(imp)utilitiesallowyoutomoveexistingdatain
ORACLEformattoandfromORACLEdatabase.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

43/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatareroles?Howcanweimplementroles?
Rolesaretheeasiestwaytograntandmanagecommonprivilegesneededbydifferentgroupsofdatabaseusers.Creatingrolesand
assigningprovidestoroles.Assigneachroletogroupofusers.Thiswillsimplifythejobofassigningprivilegestoindividualusers.
WhatareRoles?
Rolesarenamedgroupsofrelatedprivilegesthataregrantedtousersorotherroles.
WhataretheuseofRoles?
REDUCEDGRANTINGOFPRIVILEGESRatherthanexplicitlygrantingthesamesetofprivilegestomanyusersadatabase
administratorcangranttheprivilegesforagroupofrelatedusersgrantedtoaroleandthengrantonlytheroletoeachmemberof
thegroup.
DYNAMICPRIVILEGEMANAGEMENTWhentheprivilegesofagroupmustchange,onlytheprivilegesoftheroleneedtobe
modified.Thesecuritydomainsofallusersgrantedthegroupsroleautomaticallyreflectthechangesmadetotherole.
SELECTIVEAVAILABILITYOFPRIVILEGESTherolesgrantedtoausercanbeselectivelyenable(availableforuse)ordisabled
(notavailableforuse).Thisallowsspecificcontrolofausersprivilegesinanygivensituation.
APPLICATIONAWARENESSAdatabaseapplicationcanbedesignedtoautomaticallyenableanddisableselectiveroleswhena
userattemptstousetheapplication.
WhatisPrivilegeAuditing?
Privilegeauditingistheauditingoftheuseofpowerfulsystemprivilegeswithoutregardtospecificallynamedobjects.
WhatisObjectAuditing?Objectauditingistheauditingofaccessestospecificschemaobjectswithoutregardtouser.
WhatisAuditing?
Monitoringofuseraccesstoaidintheinvestigationofdatabaseuse.
Howdoesoneseetheuptimeforadatabase?LookatthefollowingSQLquery:
SELECTto_char(startup_time,DDMONYYYYHH24:MI:SS)DBStartupTime
FROMsys.v_$instance
MarcoBergmanprovidedthefollowingalternativesolution:
SELECTto_char(logon_time,DyddMonHH24:MI:SS)DBStartupTime
FROMsys.v_$session
WHERESid=1/*thisispmon*/
/
UsersstillrunningonOracle7cantryoneofthefollowingqueries:
ColumnSTARTEDformata18headSTARTUPTIME
SelectC.INSTANCE,
to_date(JUL.VALUE,J)
||to_char(floor(SEC.VALUE/3600 ),09)
||:
||Substr(to_char(mod(SEC.VALUE/60 ,60),09),2,2)
||Substr(to_char(floor(mod(SEC.VALUE/60 ,60)),09),2,2)
||.
||Substr(to_char(mod(SEC.VALUE,60),09),2,2)STARTED
fromSYS.V_$INSTANCEJUL,
SYS.V_$INSTANCESEC,
SYS.V_$THREADC
WhereJUL.KEYlike%JULIAN%
andSEC.KEYlike%SECOND%'
Selectto_date(JUL.VALUE,J)
||to_char(to_date(SEC.VALUE,SSSSS),HH24:MI:SS)STARTED
fromSYS.V_$INSTANCEJUL,
SYS.V_$INSTANCESEC
whereJUL.KEYlike%JULIAN%
andSEC.KEYlike%SECOND%'
selectto_char(to_date(JUL.VALUE,J)+(SEC.VALUE/86400 ),ReturnaDATE
DDMONYYHH24:MI:SS)STARTED
fromV$INSTANCEJUL,
V$INSTANCESEC
whereJUL.KEYlike%JULIAN%
andSEC.KEYlike%SECOND%'
WherearemyTEMPFILES,IdontseetheminV$DATAFILEorDBA_DATA_FILE?(forDBA)
Tempfiles,unlikenormaldatafiles,arenotlistedinv$datafileordba_data_files.Insteadqueryv$tempfileordba_temp_files:
SELECT*FROMv$tempfile
SELECT*FROMdba_temp_files
HowdoIfindused/freespaceinaTEMPORARYtablespace?
Unlikenormaltablespaces,truetemporarytablespaceinformationisnotlistedinDBA_FREE_SPACE.Insteadusethe
V$TEMP_SPACE_HEADERview:
SELECTtablespace_name,SUM(bytesused),SUM(bytesfree)
FROMV$temp_space_header
GROUPBYtablespace_name

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

44/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisaprofile?
EachdatabaseuserisassignedaProfilethatspecifieslimitationsonvarioussystemresourcesavailabletotheuser.
Howwillyouenforcesecurityusingstoredprocedures?
Dontgrantuseraccessdirectlytotableswithintheapplication.Insteadgranttheabilitytoaccesstheproceduresthataccessthe
tables.Whenprocedureexecuteditwillexecutetheprivilegeofproceduresowner.Userscannotaccesstablesexceptviathe
procedure.
Howcanoneseewhoisusingatemporarysegment?
Foreveryuserusingtemporaryspace,thereisanentryinSYS.V$_LOCKwithtypeTS.
Alltemporarysegmentsarenamedffff.bbbb whereffffisthefileitisinandbbbbisfirstblockofthesegment.Ifyourtemporary
tablespaceissettoTEMPORARY,allsortsaredoneinonelargetemporarysegment.Forusagestats,see
SYS.V_$SORT_SEGMENT
FromOracle8.0,onecanjustquerySYS.v$sort_usage.Lookattheseexamples:
selects.username,u.USER,u.tablespace,u.contents,u.extents,u.blocks
fromsys.v_$session s,sys.v_$sort_usage u
wheres.addr=u.session_addr
/
selects.osuser,s.process,s.username,s.serial#,
Sum(u.blocks)*vp.value/1024 sort_size
fromsys.v_$session s,sys.v_$sort_usage u,sys.v_$parameter VP
wheres.saddr=u.session_addr
andvp.name =db_block_size
ands.osuserlike&1
groupbys.osuser,s.process,s.username,s.serial#,vp.value
/
Howdoesonegettheviewdefinitionoffixedviews/tables?
Queryv$fixed_view_definition.Example:SELECT*FROMv$fixed_view_definitionWHEREview_name=V$SESSION'
Whatarethedictionarytablesusedtomonitoradatabasespaces?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
HowcanwespecifytheArchivedlogfilenameformatanddestination?
Bysettingthefollowingvaluesininit.ora file.LOG_ARCHIVE_FORMAT=arch%S/s/T/tarc(%SLogsequencenumberandiszero
leftpaded,%sLogsequencenumbernotpadded.%TThreadnumberlefzeropadedand%tThreadnumbernotpadded).The
filenamecreatedisarch0001areif%Sisused.LOG_ARCHIVE_DEST=path.
WhatisuserAccountinOracledatabase?
AnuseraccountisnotaphysicalstructureinDatabasebutitishavingimportantrelationshiptotheobjectsinthedatabaseandwill
behavingcertainprivileges.
Whenwillthedatainthesnapshotlogbeused?
Wemustbeabletocreateaafterrowtriggerontable(i.e.,itshouldbenotbealreadyavailable)Aftergivingtableprivileges.We
cannotspecifysnapshotlognamebecauseoracleusesthenameofthemastertableinthenameofthedatabaseobjectsthat
supportitssnapshotlog.Themastertablenameshouldbelessthanorequalto23characters.(Thetablenamecreatedwillbe
MLOGS_tablename,andtriggernamewillbeTLOGSname).
Whatdynamicdatareplication?
UpdatingorInsertingrecordsinremotedatabasethroughdatabasetriggers.Itmayfailifremotedatabaseishavinganyproblem.
WhatisTwoPhaseCommit?
Twophasecommitismechanismthatguaranteesadistributedtransactioneithercommitsonallinvolvednodesorrollsbackonall
involvednodestomaintaindataconsistencyacrosstheglobaldistributeddatabase.Ithastwophase,aPreparePhaseandaCommit
Phase.
HowcanyouEnforceReferentialIntegrityinsnapshots?
Timethereferencestooccurwhenmastertablesarenotinuse.Peformthereferencethemanuallyimmdiatelylockingthemaster
tables.Wecanjointablesinsnopshotsbycreatingacomplexsnapshotsthatwillbasedonthemastertables.
WhatisaSQL*NET?
SQL*NETisORACLEsmechanismforinterfacingwiththecommunicationprotocolsusedbythenetworksthatfacilitatedistributed
processinganddistributeddatabases.ItisusedinClintServerandServerServercommunications.
WhatisaSNAPSHOT?
Snapshotsarereadonlycopiesofamastertablelocatedonaremotenodewhichisperiodicallyrefreshedtoreflectchangesmade
tothemastertable.
WhatisthemechanismprovidedbyORACLEfortablereplication?
SnapshotsandSNAPSHOTLOGs
Whatissnapshots?
Snapshotisanobjectusedtodynamicallyreplicatedatabetweendistributedatabaseatspecifiedtimeintervals.Inver7.0theyare
readonly.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

45/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatarethevarioustypeofsnapshots?
SimpleandComplex.
DescribetwophasesofTwophasecommit?
PreparephaseTheglobalcoordinator(initiatingnode)askaparticipantstoprepare(topromisetocommitorrollbackthe
transaction,evenifthereisafailure)CommitPhaseIfallparticipantsrespondtothecoordinatorthattheyareprepared,the
coordinatorasksallnodestocommitthetransaction,ifallparticipantscannotprepare,thecoordinatorasksallnodestorollbackthe
transaction.
Whatissnapshotlog?
Itisatablethatmaintainsarecordofmodificationstothemastertableinasnapshot.Itisstoredinthesamedatabaseasmaster
tableandisonlyavailableforsimplesnapshots.Itshouldbecreatedbeforecreatingsnapshots.
Whatarethebenefitsofdistributedoptionsindatabases?
Databaseonotherserverscanbeupdatedandthosetransactionscanbegroupedtogetherwithothersinalogicalunit.
Databaseusesatwophasecommit.
Whataretheoptionsavailabletorefreshsnapshots?
COMPLETETablesarecompletelyregeneratedusingthesnapshotsqueryandthemastertableseverytimethesnapshot
referenced.
FASTIfsimplesnapshotusedthenasnapshotlogcanbeusedtosendthechangestothesnapshottables.
FORCEDefaultvalue.IfpossibleitperformsaFASTrefreshOtherwiseitwillperformacompleterefresh.
WhatisaSNAPSHOTLOG?
Asnapshotlogisatableinthemasterdatabasethatisassociatedwiththemastertable.ORACLEusesasnapshotlogtotrackthe
rowsthathavebeenupdatedinthemastertable.Snapshotlogsareusedinupdatingthesnapshotsbasedonthemastertable.
WhatisDistributeddatabase?
Adistributeddatabaseisanetworkofdatabasesmanagedbymultipledatabaseserversthatappearstoauserassinglelogical
database.Thedataofalldatabasesinthedistributeddatabasecanbesimultaneouslyaccessedandmodified.
Howcanwereducethenetworktraffic?
Replicationofdataindistributedenvironment.
Usingsnapshotstoreplicatedata.
Usingremoteprocedurecalls.
Differentiatesimpleandcomplex,snapshots?
AsimplesnapshotisbasedonaquerythatdoesnotcontainsGROUPBYclauses,CONNECTBYclauses,JOINs,subqueryor
snashotofoperations.
Acomplexsnapshotscontainatleastanyoneoftheabove.
WhataretheBuiltinsusedforsendingParameterstoforms?
Youcanpassparametervaluestoaformwhenanapplicationexecutesthecall_form,New_form,Open_formorRun_product.
Canyouhavemorethanonecontentcanvasviewattachedwithawindow?
Yes.Eachwindowyoucreatemusthaveatleastonecontentcanvasviewassignedtoit.Youcanalsocreateawindowthathas
manipulatedcontentcanvasview.Atruntimeonlyoneofthecontentcanvasviewsassigntoawindowisdisplayedatatime.
IstheAfterreporttriggerfiredifthereportexecutionfails?
Yes.
DoesaBeforeformtriggerfirewhentheparameterformissuppressed?
Yes.
WhatisSGA?TheSystemGlobalAreainanOracledatabaseistheareainmemorytofacilitatethetransferofinformationbetween
users.Itholdsthemostrecentlyrequestedstructuralinformationbetweenusers.Itholdsthemostrecentlyrequestedstructural
informationaboutthedatabase.Thestructureisdatabasebuffers,dictionarycache,redologbufferandsharedpoolarea.
Whatisasharedpool?
ThedatadictionarycacheisstoredinanareainSGAcalledthesharedpool.ThiswillallowsharingofparsedSQLstatementsamong
concurrentusers.
WhatismeanbyProgramGlobalArea(PGA)?ItisareainmemorythatisusedbyasingleOracleuserprocess.
Whatisadatasegment?
Datasegmentarethephysicalareaswithinadatabaseblockinwhichthedataassociatedwithtablesandclustersarestored.
WhatarethefactorscausingthereparsingofSQLstatementsinSGA?
Duetoinsufficientsharedpoolsize.
MonitortheratioofthereloadstakesplacewhileexecutingSQLstatements.Iftheratioisgreaterthan1thenincreasethe
SHARED_POOL_SIZE.
Whatareclusters?
Clustersaregroupsofoneormoretablesphysicallystorestogethertosharecommoncolumnsandareoftenusedtogether.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

46/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisclusterkey?
Therelatedcolumnsofthetablesinaclusterarecalledtheclusterkey.
Doaviewcontaindata?
Viewsdonotcontainorstoredata.
WhatisuserAccountinOracledatabase?
Auseraccountisnotaphysicalstructureindatabasebutitishavingimportantrelationshiptotheobjectsinthedatabaseandwillbe
havingcertainprivileges.
Howwillyouenforcesecurityusingstoredprocedures?
Dontgrantuseraccessdirectlytotableswithintheapplication.Insteadgranttheabilitytoaccesstheproceduresthataccessthe
tables.Whenprocedureexecuteditwillexecutetheprivilegeofproceduresowner.Userscannotaccesstablesexceptviathe
procedure.
Whatarethedictionarytablesusedtomonitoradatabasespace?
DBA_FREE_SPACE
DBA_SEGMENTS
DBA_DATA_FILES.
Canapropertyclauseitselfbebasedonapropertyclause?
Yes
Ifaparameterisusedinaquerywithoutbeingpreviouslydefined,whatdiff.existbetween.report2.0and2.5whenthequeryis
applied?
Whilebothreports2.0and2.5createtheparameter,report2.5givesamessagethatabindparameterhasbeencreated.
Whatarethesqlclausessupportedinthelinkpropertysheet?
Wherestartwithhaving.
Whatistriggerassociatedwiththetimer?
Whentimerexpired.
Whatarethetriggerassociatedwithimageitems?
Whenimageactivatedfireswhentheoperatorsdoubleclicksonanimageitemwhenimagepressedfireswhenanoperatorclicksor
doubleclicksonanimageitem
Whatarethedifferentwindowseventsactivatedatruntimes?
When_window_activated
When_window_closed
When_window_deactivated
When_window_resized
Withinthistriggers,youcanexaminethebuiltinsystemvariablesystem.event_windowtodeterminethenameofthewindowfor
whichthetriggerfired.
Whendoyouusedataparametertype?
Whenthevalueofadataparameterbeingpassedtoacalledproductisalwaysthenameoftherecordgroupdefinedinthecurrent
form.Dataparametersareusedtopassdatatoproductsinvokedwiththerun_productbuiltinsubprogram.
Whatisdifferencebetweenopen_formandcall_form?
whenoneforminvokesanotherformbyexecutingopen_formthefirstformremainsdisplayed,andoperatorscannavigatebetween
theformsasdesired.whenoneforminvokesanotherformbyexecutingcall_form,thecalledformismodalwithrespecttothecalling
form.Thatis,anywindowsthatbelongtothecallingformaredisabled,andoperatorscannotnavigatetothemuntiltheyfirstexitthe
calledform.
Whatisnew_formbuiltin?
Whenoneforminvokesanotherformbyexecutingnew_formoracleformexitsthefirstformandreleasesitsmemorybeforeloading
thenewformcallingnewformcompletelyreplacethefirstwiththesecond.Iftherearechangespendinginthefirstform,theoperator
willbepromptedtosavethembeforethenewformisloaded.
WhatistheLOVofValidationPropertyofanitem?Whatistheuseofit?
WhenLOVforValidationissettoTrue,OracleFormscomparesthecurrentvalueofthetextitemtothevaluesinthefirstcolumn
displayedintheLOV.Wheneverthevalidationeventoccurs.Ifthevalueinthetextitemmatchesoneofthevaluesinthefirstcolumn
oftheLOV,validationsucceeds,theLOVisnotdisplayed,andprocessingcontinuesnormally.Ifthevalueinthetextitemdoesnot
matchoneofthevaluesinthefirstcolumnoftheLOV,OracleFormsdisplaystheLOVandusesthetextitemvalueasthesearch
criteriatoautomaticallyreducethelist.
Whatisthediff.whenFlexmodeismodeonandwhenitisoff?
Whenflexmodeison,reportsautomaticallyresizestheparentwhenthechildisresized.
Whatisthediff.whenconfinemodeisonandwhenitisoff?
Whenconfinemodeison,anobjectcannotbemovedoutsideitsparentinthelayout.
Whatarevisualattributes?
Visualattributesarethefont,color,patternproprietiesthatyousetforformandmenuobjectsthatappearinyourapplication
interface.
Whichofthetwoviewsshouldobjectsaccordingtopossession?
viewbystructure.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

47/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatarethetwotypesofviewsavailableintheobjectnavigator(specifictoreport2.5)?
Viewbystructureandviewbytype.
Whatarethevbxcontrols?
Vbxcontrolprovideasimplemethodofbuildingandenhancinguserinterfaces.Thecontrolscanusetoobtainuserinputsand
displayprogramoutputs.vbxcontrolwhereoriginallydevelopasextensionsforthemsvisualbasicenvironmentsandincludesuch
itemsassliders,ridesandknobs.
Whatistheuseoftransactionaltriggers?
Usingtransactionaltriggerswecancontrolormodifythedefaultfunctionalityoftheoracleforms.
Howdoyoucreateanewsessionwhileopenanewform?
Usingopen_formbuiltinsettingthesessionoptionEx.Open_form(Stocks,active,session).wheninvokethemultipleformswith
openformandcall_forminthesameapplication,statewhetherthefollowingaretrue/False
Whatarethewaystomonitortheperformanceofthereport?
Usereportsprofileexecutablestatement.UseSQLtracefacility.
Iftwogroupsarenotlinkedinthedatamodeleditor,Whatisthehierarchybetweenthem?
Twogroupthatisabovearetheleftmostrankhigherthanthegroupthatistorightorbelowit.
Anopenformcannotbeexecutethecall_formprocedureifyouchainofcalledformshasbeeninitiatedbyanotheropenform?
True
Explainabouthorizontal,Verticaltoolbarcanvasviews?
Toolbarcanvasviewsareusedtocreatetoolbarsforindividualwindows.Horizontaltoolbarsaredisplayatthetopofawindow,just
underitsmenubar.VerticalToolbarsaredisplayedalongtheleftsideofawindow
Whatisthepurposeoftheproductorderoptioninthecolumnpropertysheet?
Tospecifytheorderofindividualgroupevaluationinacrossproducts.
Whatistheuseofimage_zoombuiltin?
Tomanipulateimagesinimageitems.
Howdoyoureferenceaparameterindirectly?
ToindirectlyreferenceaparameterusetheNAMEIN,COPYbuiltinstoindirectlysetandreferencetheparametersvalueExample
name_in(capitalparametermyparam),Copy(SURESH,Parametermy_param)
Whatisatimer?
Timerisaninternaltimeclockthatyoucanprogrammaticallycreatetoperformanactioneachtimethetimes.
Whatarethetwophasesofblockcoordination?
Therearetwophasesofblockcoordination:theclearphaseandthepopulationphase.During,theclearphase,OracleForms
navigatesinternallytothedetailblockandflushestheobsoletedetailrecords.Duringthepopulationphase,OracleFormsissuesa
SELECTstatementtorepopulatethedetailblockwithdetailrecordsassociatedwiththenewmasterrecord.Theseoperationsare
accomplishedthroughtheexecutionoftriggers.
WhatareMostCommontypesofComplexmasterdetailrelationships?
Therearethreemostcommontypesofcomplexmasterdetailrelationships:
masterwithdependentdetails
masterwithindependentdetails
detailwithtwomasters
Whatisatextlist?
Thetextliststylelistitemappearsasarectangularboxwhichdisplaysthefixednumberofvalues.Whenthetextlistcontainsvalues
thatcannotbedisplayed,averticalscrollbarappears,allowingtheoperatortoviewandselectundisplayedvalues.
Whatisterm?
Thetermisterminaldefinitionfilethatdescribestheterminalformwhichyouareusingr20run.
Whatisuseofterm?
Thetermfilewhichkeyiscorrespondtowhichoraclereportfunctions.
Whatispoplist?
Thepopliststylelistitemappearsinitiallyasasinglefield(similartoatextitemfield).Whentheoperatorselectsthelisticon,alistof
availablechoicesappears.
Whatisthemaximumnoofcharstheparametercanstore?
Themaximumnoofcharstheparametercanstoreisonlyvalidforcharparameters,whichcanbeupto64K.Noparametersdefault
to23BytesandDateparameterdefaultto7Bytes.
Whatarethedefaultextensionsofthefilescreatedbylibrarymodule?
Thedefaultfileextensionsindicatethelibrarymoduletypeandstorageformat.pllpl/sqllibrarymodulebinary
WhataretheCoordinationPropertiesinaMasterDetailrelationship?
Thecoordinationpropertiesare
Deferred

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

48/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
AutoQuery
ThesePropertiesdeterminewhenthepopulationphaseofblock
coordinationshouldoccur.
Howdoyoudisplayconsoleonawindow?
Theconsoleincludesthestatuslineandmessageline,andisdisplayedatthebottomofthewindowtowhichitisassigned.To specify
thattheconsoleshouldbedisplayed,settheconsolewindowformpropertytothenameofanywindowintheform.Toincludethe
console,setconsolewindowtoNull.
WhatarethedifferentParametertypes?
TextParametersDataParameters
Stateanythreemouseeventssystemvariables?
System.mouse_button_pressedSystem.mouse_button_shift
Whatarethetypesofcalculatedcolumnsavailable?
Summary,Formula,Placeholdercolumn.
Explainaboutstackedcanvasviews?
Stackedcanvasviewisdisplayedinawindowontopof,orstackedonthecontentcanvasviewassignedtothatsamewindow.
Stackedcanvasviewsobscuresomepartoftheunderlyingcontentcanvasview,andoroftenshownandhiddenprogrammatically.
Howdoesonedoofflinedatabasebackups?
Shutdownthedatabasefromsqlplusorservermanager.Backupallfilestosecondarystorage(eg.tapes).Ensurethatyoubackup
alldatafiles,allcontrolfilesandalllogfiles.Whencompleted,restartyourdatabase.
Dothefollowingqueriestogetalistofallfilesthatneedstobebackedup:
selectnamefromsys.v_$datafile
selectmemberfromsys.v_$logfile
selectnamefromsys.v_$controlfile
SometimesOracletakesforevertoshutdownwiththeimmediateoption.Asworkaroundtothisproblem,shutdownusingthese
commands:
altersystemcheckpoint
shutdownabort
startuprestrict
shutdownimmediate
NotethatifyoudatabaseisinARCHIVELOGmode,onecanstillusearchivedlogfilestorollforwardfromanofflinebackup.Ifyou
cannottakeyourdatabasedownforacold(offline)backupataconvenienttime,switchyourdatabaseintoARCHIVELOGmodeand
performhot(online)backups.
WhatisthedifferencebetweenSHOW_EDITORandEDIT_TEXTITEM?
Showeditoristhegenericbuiltinwhichacceptsanyeditornameandtakessomeinputstringandreturnsmodifiedoutputstring.
Whereastheedit_textitembuiltinneedstheinputfocustobeinthetextitembeforethebuiltinisexecuted.
WhatarethebuiltinsthatareusedtoAttachanLOVprogrammaticallytoanitem?
set_item_property
get_item_property
(bysettingtheLOV_NAMEproperty)
Howdoesonedoonlinedatabasebackups?
Eachtablespacethatneedstobebackedupmustbeswitchedintobackupmodebeforecopyingthefilesouttosecondarystorage
(tapes).Lookatthissimpleexample.
ALTERTABLESPACExyzBEGINBACKUP
!cpxyfFile1/backupDir/
ALTERTABLESPACExyzENDBACKUP
Itisbettertobackuptablespacefortablespacethantoputalltablespacesinbackupmode.Backingthemupseparatelyincursless
overhead.Whendone,remembertobackupyourcontrolfiles.Lookatthisexample:
ALTERSYSTEMSWITCHLOGFILEForcelogswitchtoupdatecontrolfileheaders
ALTERDATABASEBACKUPCONTROLFILETO/backupDir/control.dbf'
NOTE:Donotrunonlinebackupsduringpeakprocessingperiods.Oraclewillwritecompletedatabaseblocksinsteadofthenormal
deltastoredologfileswhileinbackupmode.Thiswillleadtoexcessivedatabasearchivingandevendatabasefreezes.
HowdoesonebackupadatabaseusingRMAN?
ThebiggestadvantageofRMANisthatitonlybackupusedspaceinthedatabase.Rmandoesntputtablespacesinbackupmode,
savingonredogenerationoverhead.RMANwillrereaddatabaseblocksuntilitgetsaconsistentimageofit.Lookatthissimple
backupexample.
rmantargetsys/***nocatalog
run{
allocatechannelt1typedisk
backup
format/app/oracle/db_backup/%d_t%t_s%s_p%p
(database)
releasechannelt1
}
ExampleRMANrestore:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

49/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
rmantargetsys/***nocatalog
run{
allocatechannelt1typedisk
1. setuntiltimeAug072000:51

restoretablespaceusers
recovertablespaceusers
releasechannelt1
}
Theexamplesaboveareextremelysimplisticandonlyusefulforillustratingbasicconcepts.BydefaultOracleusesthedatabase
controlfilestostoreinformationaboutbackups.NormallyonewouldrathersetupaRMANcatalogdatabasetostoreRMANmetadata
in.ReadtheOracleBackupandRecoveryGuidebeforeimplementinganyRMANbackups.
Note:RMANcannotwriteimagecopiesdirectlytotape.OneneedstouseathirdpartymediamanagerthatintegrateswithRMANto
backupdirectlytotape.Alternativelyonecanbackuptodiskandthenmanuallycopythebackupstotape.
Whatarethedifferentfileextensionsthatarecreatedbyoraclereports?
RepfileandRdffile.
Whatisstripsourcesgenerateoptions?
Removesthesourcecodefromthelibraryfileandgeneratesalibraryfilesthatcontainsonlypcode.Theresultingfilecanbeusedfor
finaldeployment,butcannotbesubsequentlyeditedinthedesigner.ex.f45genmodule=old_lib.plluserid=scott/tigerstrip_source
YESoutput_file
HowdoesoneputadatabaseintoARCHIVELOGmode?
Themainreasonforrunninginarchivelogmodeisthatonecanprovide24houravailabilityandguaranteecompletedata
recoverability.ItisalsonecessarytoenableARCHIVELOGmodebeforeonecanstarttouseonlinedatabasebackups.Toenable
ARCHIVELOGmode,simplychangeyourdatabasestartupcommandscript,andbouncethedatabase:
SQLPLUS>connectsysassysdba
SQLPLUS>startupmountexclusive
SQLPLUS>alterdatabasearchivelog
SQLPLUS>archivelogstart
SQLPLUS>alterdatabaseopen
NOTE1:Remembertotakeabaselinedatabasebackuprightafterenablingarchivelogmode.Withoutitonewouldnotbeableto
recover.Also,implementanarchivelogbackuptopreventthearchivelogdirectoryfromfillingup.
NOTE2:ARCHIVELOGmodewasintroducedwithOracleV6,andisessentialfordatabasepointintimerecovery.Archivingcanbe
usedincombinationwithonlineandofflinedatabasebackups.
NOTE3:YoumaywanttosetthefollowingINIT.ORAparameterswhenenablingARCHIVELOGmode:log_archive_start=TRUE,
log_archive_dest=andlog_archive_format=
NOTE4:YoucanchangethearchivelogdestinationofadatabaseonlinewiththeARCHIVELOGSTARTTOdirectory'statement.
Thisstatementisoftenusedtoswitcharchivingbetweenasetofdirectories.
NOTE5:WhenrunningOracleRealApplicationServer(RAC),youneedtoshutdownallnodesbeforechangingthedatabaseto
ARCHIVELOGmode.
WhatisthebasicdatastructurethatisrequiredforcreatinganLOV?
RecordGroup.
Howdoesonebackuparchivedlogfiles?
OnecanbackuparchivedlogfilesusingRMANoranyoperatingsystembackuputility.Remembertodeletefilesafterbackingthem
uptopreventthearchivelogdirectoryfromfillingup.Ifthearchivelogdirectorybecomesfull,yourdatabasewillhang!Lookatthis
simpleRMANbackupscript:
RMAN>run{
2>allocatechanneldev1typedisk
3>backup
4>format/app/oracle/arch_backup/log_t%t_s%s_p%p
5>(archivelogalldeleteinput)
6>releasechanneldev1
7>}
DoesOraclewritetodatafilesinbegin/hotbackupmode?
Oraclewillstopupdatingfileheaders,butwillcontinuetowritedatatothedatabasefilesevenifatablespaceisinbackupmode.
Inbackupmode,Oraclewillwriteoutcompletechangedblockstotheredologfiles.Normallyonlydeltas(changes)areloggedtothe
redologs.Thisisdonetoenablereconstructionofablockifonlyhalfofitwasbackedup(splitblocks).Becauseofthis,oneshould
noticeincreasedlogactivityandarchivingduringonlinebackups.
WhatistheMaximumallowedlengthofRecordgroupColumn?Recordgroupcolumnnamescannotexceed30characters.
Whichparametercanbeusedtosetreadlevelconsistencyacrossmultiplequeries?
Readonly
WhatarethedifferenttypesofRecordGroups?
QueryRecordGroups
NonQueryRecordGroups
StateRecordGroups

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

50/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Fromwhichdesignationisitpreferredtosendtheoutputtotheprinted?
Previewer
Whataredifferencebetweenpostdatabasecommitandpostformcommit?
Postformcommitfiresonceduringthepostandcommittransactionsprocess,afterthedatabasecommitoccurs.Thepostform
committriggerfiresafterinserts,updatesanddeleteshavebeenpostedtothedatabasebutbeforethetransactionshavebeen
finalizedintheissuingthecommand.Thepostdatabasecommittriggerfiresafteroracleformsissuesthecommittofinalized
transactions.
Whatarethedifferentdisplaystylesoflistitems?
Pop_listText_listCombobox
Whichoftheabovemethodsisthefastermethod?performingthecalculationinthequeryisfaster.
Withwhichfunctionofsummaryitemisthecomputeatoptionsrequired?
percentageoftotalfunctions.
Whatareparameters?
Parametersprovideasimplemechanismfordefiningandsettingthevaluesofinputsthatarerequiredbyaformatstartup.Form
parametersarevariablesoftypechar,number,datethatyoudefineatdesigntime.
Whatarethethreetypesofuserexitsavailable?
OraclePrecompilerexits,Oraclecallinterface,NonOracleuserexits.
Howmanywindowsinaformcanhaveconsole?
Onlyonewindowinaformcandisplaytheconsole,andyoucannotchangetheconsoleassignmentatruntime.
Whatisanadministrative(privileged)user?
OracleDBAsandoperatorstypicallyuseadministrativeaccountstomanagethedatabaseanddatabaseinstance.Anadministrative
accountisauserthatisgrantedSYSOPERorSYSDBAprivileges.SYSDBAandSYSOPERallowaccesstoadatabaseinstanceeven
ifitisnotrunning.Controloftheseprivilegesismanagedoutsideofthedatabaseviapasswordfilesandspecialoperatingsystem
groups.Thispasswordfileiscreatedwiththeorapwdutility.
Whatarethetworepeatingframealwaysassociatedwithmatrixobject?
Onedownrepeatingframebelowoneacrossrepeatingframe.
Whatarethemasterdetailtriggers?
OnCheck_delete_masterOn_clear_detailsOn_populate_details
Howdoesoneconnecttoanadministrativeuser?
IfanadministrativeuserbelongstothedbagrouponUnix,ortheORA_DBA(ORA_sid_DBA)grouponNT,he/shecanconnect
likethis:
connect/assysdba
Nopasswordisrequired.Thisisequivalenttothedesupportedconnectinternalmethod.
Apasswordisrequiredfornonsecureadministrativeaccess.Thesepasswordsarestoredinpasswordfiles.Remoteconnections
viaNet8areclassifiedasnonsecure.Lookatthisexample:
connectsys/passwordassysdba
Howdoesonecreateapasswordfile?
TheOraclePasswordFile($ORACLE_HOME/dbs/orapwororapwSID)storespasswordsforuserswithadministrativeprivileges.One
needstocreateapasswordfilesbeforeremoteadministrators(likeOEM)willbeallowedtoconnect.
Followthisproceduretocreateanewpasswordfile:
.LoginastheOraclesoftwareowner
.Runcommand:orapwdfile=$ORACLE_HOME/dbs/orapw$ORACLE_SIDpassword=mypasswd
.Shutdownthedatabase(SQLPLUS>SHUTDOWNIMMEDIATE)
.EdittheINIT.ORAfileandensureREMOTE_LOGIN_PASSWORDFILE=exclusiveisset.
.Startupthedatabase(SQLPLUS>STARTUP)
NOTE:Theorapwdutilitypresentsasecurityriskinthatitreceivesapasswordfromthecommandline.Thispasswordisvisibleinthe
processtableofmanysystems.Administratorsneedstobeawareofthis!
Isitpossibletomodifyanexternalqueryinareportwhichcontainsit?
No.
Doesagroupingdoneforobjectsinthelayouteditoraffectthegroupingdoneinthedatamodeleditor?
No.
Howdoesoneadduserstoapasswordfile?
OnecanselectfromtheSYS.V_$PWFILE_USERSviewtoseewhichusersarelistedinthepasswordfile.Newuserscanbeaddedto
thepasswordfilebygrantingthemSYSDBAorSYSOPERprivileges,orbyusingtheorapwdutility.GRANTSYSDBATOscott
Ifabreakorderissetonacolumnwoulditaffectcolumnswhichareunderthecolumn?
No
WhyareOPS$accountsasecurityriskinaclient/serverenvironment?
IfyouallowpeopletologinwithOPS$accountsfromWindowsWorkstations,youcannotbesurewhotheyreallyare.Withterminals,
youcanrelyonoperatingsystempasswords,withWindows,youcannot.
IfyousetREMOTE_OS_AUTHENT=TRUEinyourinit.ora file,OracleassumesthattheremoteOShasauthenticatedtheuser.If
REMOTE_OS_AUTHENTissettoFALSE(recommended),remoteuserswillbeunabletoconnectwithoutapassword.IDENTIFIED

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

51/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
EXTERNALLYwillonlybeineffectfromthelocalhost.Also,ifyouareusingOPS$asyourprefix,youwillbeabletologonlocally
withorwithoutapassword,regardlessofwhetheryouhaveidentifiedyourIDwithapasswordordefinedittobeIDENTIFIED
EXTERNALLY.
Douserparametersappearinthedatamodaleditorin2.5?
No
Canyoupassdataparameterstoforms?
No
Isitpossibletolinktwogroupsinsideacrossproductsafterthecrossproductsgrouphasbeencreated?
no
Whatarethedifferentmodalsofwindows?
Modallesswindows
Modalwindows
Whataremodalwindows?
Modalwindowsareusuallyusedasdialogs,andhaverestrictedfunctionalitycomparedtomodellesswindows.Onsomeplatformsfor
exampleoperatorscannotresize,scrolloriconifyamodalwindow.
WhatarethedifferentdefaulttriggerscreatedwhenMasterDeletesPropertyissettoNonisolated?MasterDeletesProperty
ResultingTriggers

NonIsolated(thedefault)OnCheckDeleteMaster
OnClearDetails
OnPopulateDetails
WhatarethedifferentdefaulttriggerscreatedwhenMasterDeletesPropertyissettoisolated?MasterDeletesProperty
ResultingTriggers

IsolatedOnClearDetails
OnPopulateDetails
WhatarethedifferentdefaulttriggerscreatedwhenMasterDeletesPropertyissettoCascade?
MasterDeletesPropertyResultingTriggers

CascadingOnClearDetails
OnPopulateDetails
Predelete
Whatisthediff.bet.settingupofparametersinreports2.0reports2.5?
LOVscanbeattachedtoparametersinthereports2.5parameterform.
Whatarethedifferencebetweenlov&listitem?
Lovisapropertywhereaslistitemisanitem.Alistitemcanhaveonlyonecolumn,lovcanhaveoneormorecolumns.
Whatistheadvantageofthelibrary?Librariesprovideaconvenientmeansofstoringclientsideprogramunitsandsharingthem
amongmultipleapplications.Onceyoucreatealibrary,youcanattachittoanyotherform,menu,orlibrarymodules.Whenyoucan
calllibraryprogramunitsfromtriggersmenuitemscommandsandusernamedroutine,youwriteinthemodulestowhichyouhave
attachthelibrary.Whenalibraryattachesanotherlibrary,programunitsinthefirstlibrarycanreferenceprogramunitsinthe
attachedlibrary.Librarysupportdynamicloadingthatislibraryprogramunitsareloadedintoanapplicationonlywhenneeded.This
cansignificantlyreducetheruntimememoryrequirementsofapplications.
Whatislexicalreference?Howcanitbecreated?
Lexicalreferenceisplace_holderfortextthatcanbeembeddedinasqlstatements.Alexicalreferencecanbecreatedusing&
beforethecolumnorparametername.
Whatissystem.coordination_operation?
Itrepresentsthecoordinationcausingeventthatoccuronthemasterblockinmasterdetailrelation.
Whatissynchronize?Itisaterminalscreenwiththeinternalstateoftheform.Itupdatesthescreendisplaytoreflecttheinformation
thatoracleformshasinitsinternalrepresentationofthescreen.
Whatuseofcommandlineparametercmdfile?
Itisacommandlineargumentthatallowsyoutospecifyafilethatcontainasetofargumentsforr20run.
WhatisaText_ioPackage?
Itallowsyoutoreadandwriteinformationtoafileinthefilesystem.
Whatisforms_DDL?
IssuesdynamicSqlstatementsatruntime,includingserversidepl/SQlandDDL
Howislinktooloperationdifferentbet.reports2&2.5?
InReports2.0thelinktoolhastobeselectedandthentwofieldstobelinkedareselectedandthelinkisautomaticallycreated.In2.5
thefirstfieldisselectedandthelinktoolisthenusedtolinkthefirstfieldtothesecondfield.
WhatarethedifferentstylesofactivationofoleObjects?
InplaceactivationExternalactivation

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

52/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
HowdoyoureferenceaParameter?
InPl/Sql,Youcanreferenceandsetthevaluesofformparametersusingbindvariablessyntax.Ex.PARAMETERname=or
:block.item=PARAMETERParametername
Whatisthedifferencebetweenobjectembedding&linkinginOracleforms?
InOracleforms,Embeddedobjectsbecomepartoftheformmodule,andlinkedobjectsarereferencesfromaformmoduletoa
linkedsourcefile.
Nameofthefunctionsusedtoget/setcanvasproperties?
Get_view_property,Set_view_property
WhatarethebuiltinsthatareusedforsettingtheLOVpropertiesatruntime?
get_lov_property
set_lov_property
Whatarethebuiltinsusedforprocessingrows?
Get_group_row_count(function)
Get_group_selection_count(function)
Get_group_selection(function)
Reset_group_selection(procedure)
Set_group_selection(procedure)
Unset_group_selection(procedure)
WhatarebuiltinsusedforProcessingrows?
GET_GROUP_ROW_COUNT(function)
GET_GROUP_SELECTION_COUNT(function)
GET_GROUP_SELECTION(function)
RESET_GROUP_SELECTION(procedure)
SET_GROUP_SELECTION(procedure)
UNSET_GROUP_SELECTION(procedure)
Whatarethebuiltinusedforgettingcellvalues?
Get_group_char_cell(function)
Get_groupcell(function)
Get_group_number_cell(function)
WhatarethebuiltinsusedforGettingcellvalues?
GET_GROUP_CHAR_CELL(function)
GET_GROUPCELL(function)
GET_GROUP_NUMBET_CELL(function)
Atleasthowmanysetofdatamustadatamodelhavebeforeadatamodelcanbebaseonit?
Four
Toexecuterowfrombeingdisplayedthatstillusecolumnintherowwhichpropertycanbeused?
Formattrigger.
Whataredifferenttypesofmodulesavailableinoracleform?
FormmoduleacollectionofobjectsandcoderoutinesMenumodulesacollectionofmenusandmenuitemcommandsthat
togethermakeupanapplicationmenulibrarymoduleacollectionofusernamedprocedures,functionsandpackagesthatcanbe
calledfromothermodulesintheapplication
Whatistheremoveonexitproperty?Foramodellesswindow,itdetermineswhetheroracleformshidesthewindowautomatically
whentheoperatorsnavigatestoanitemintheanotherwindow.
WhatisWHENDatabaserecordtrigger?
Fireswhenoracleformsfirstmarksarecordasaninsertoranupdate.Thetriggerfiresassoonasoracleformsdeterminesthrough
validationthattherecordshouldbeprocessedbythenextpostorcommitasaninsertorupdate.cgenerallyoccursonlywhenthe
operatorsmodifiesthefirstitemintherecord,andaftertheoperatorattemptstonavigateoutoftheitem.
Whatisadifferencebetweenpreselectandprequery?
Firesduringtheexecutequeryandcountqueryprocessingafteroracleformsconstructstheselectstatementtobeissued,butbefore
thestatementisactuallyissued.Theprequerytriggerfiresjustbeforeoracleformsissuestheselectstatementtothedatabaseafter
theoperatorasdefinetheexamplerecordsbyenteringthequerycriteriainenterquerymode.Prequerytriggerfiresbeforepre
selecttrigger.
Whatarebuiltinsassociatedwithtimers?
find_timercreate_timerdelete_timer
WhatarethebuiltinsusedforfindingobjectIDfunctions?
Find_group(function)
Find_column(function)
WhatarethebuiltinsusedforfindingObjectIDfunction?
FIND_GROUP(function)
FIND_COLUMN(function)

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

53/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Anyattempttonavigateprogrammaticallytodisabledforminacall_formstackisallowed?
False
UsetheAdd_group_rowproceduretoaddarowtoastaticrecordgroup1.trueorfalse?
False
WhatthirdpartytoolscanbeusedwithOracleEBU/RMAN?ThefollowingMediaManagementSoftwareVendorshaveintegrated
theirmediamanagementsoftwarepackageswithOracleRecoveryManagerandOracle7EnterpriseBackupUtility.TheMedia
ManagementVendorswillprovidefirstlinetechnicalsupportfortheintegratedbackup/recoversolutions.
VeritasNetBackup
EMCDataManager(EDM)
HPOMNIBackII
IBMsTivoliStorageManagerformerlyADSM
LegatoNetworker
ManageITBackupandRecovery
SterlingSoftwaresSAMS:AlexandriaformerlyfromSpectralogic
SunSolsticeBackup
Whyandwhenshouldonetune?
OneofthebiggestresponsibilitiesofaDBAistoensurethattheOracledatabaseistunedproperly.TheOracleRDBMSishighly
tunableandallowsthedatabasetobemonitoredandadjustedtoincreaseitsperformance.Oneshoulddoperformancetuningfor
thefollowingreasons:
Thespeedofcomputingmightbewastingvaluablehumantime(userswaitingforresponse)Enableyoursystemtokeepupwiththe
speedbusinessisconductedandOptimizehardwareusagetosavemoney(companiesarespendingmillionsonhardware).
AlthoughthisFAQisnotoverlyconcernedwithhardwareissues,oneneedstorememberthanyoucannottuneaBuickintoaFerrari.
Howcanabreakorderbecreatedonacolumninanexistinggroup?Whatarethevarioussubeventsamousedoubleclick
eventinvolves?
Bydraggingthecolumnoutsidethegroup.
Whatistheuseofplaceholdercolumn?Whatarethevarioussubeventsamousedoubleclickeventinvolves?
Aplaceholdercolumnisusedtoholdcalculatedvaluesataspecifiedplaceratherthanallowingistoappearintheactualrowwhereit
hastoappear.
Whatistheuseofhiddencolumn?Whatarethevarioussubeventsamousedoubleclickeventinvolves?
Ahiddencolumnisusedtowhenacolumnhastoembedintoboilerplatetext.
Whatdatabaseaspectsshouldbemonitored?
Oneshouldimplementamonitoringsystemtoconstantlymonitorthefollowingaspectsofadatabase.Writingcustomscripts,
implementingOraclesEnterpriseManager,orbuyingathirdpartymonitoringproductcanachievethis.Ifanalarmistriggered,the
systemshouldautomaticallynotifytheDBA(email,page,etc.)totakeappropriateaction.
Infrastructureavailability:
.Isthedatabaseupandrespondingtorequests
.Arethelistenersupandrespondingtorequests
.AretheOracleNamesandLDAPServersupandrespondingtorequests
.AretheWebListenersupandrespondingtorequests

Thingsthatcancauseserviceoutages:
.Isthearchivelogdestinationfillingup?
.Objectsgettingclosetotheirmaxextents
.Userandprocesslimitsreached
Thingsthatcancausebadperformance:
SeequestionWhattuningindicatorscanoneuse?.
Whereshouldthetuningeffortbedirected?
Considerthefollowingareasfortuning.Theorderinwhichstepsarelistedneedstobemaintainedtopreventtuningsideeffects.For
example,itisnogoodincreasingthebuffercacheifyoucanreduceI/ObyrewritingaSQLstatement.DatabaseDesign(ifitsnottoo
late):
Poorsystemperformanceusuallyresultsfromapoordatabasedesign.Oneshouldgenerallynormalizetothe3NF.Selective
denormalizationcanprovidevaluableperformanceimprovements.Whendesigning,alwayskeepthedataaccesspathinmind.Also
lookatproperdatapartitioning,datareplication,aggregationtablesfordecisionsupportsystems,etc.
ApplicationTuning:
Experienceshowedthatapproximately80%ofallOraclesystemperformanceproblemsareresolvedbycodingoptimalSQL.Also
considerproperschedulingofbatchtasksafterpeakworkinghours.
MemoryTuning:
Properlysizeyourdatabasebuffers(sharedpool,buffercache,logbuffer,etc)bylookingatyourbufferhitratios.Pinlargeobjects
intomemorytopreventfrequentreloads.
DiskI/OTuning:
Databasefilesneedstobeproperlysizedandplacedtoprovidemaximumdisksubsystemthroughput.Alsolookforfrequentdisk
sorts,fulltablescans,missingindexes,rowchaining,datafragmentation,etc
EliminateDatabaseContention:
Studydatabaselocks,latchesandwaiteventscarefullyandeliminatewherepossible.TunetheOperatingSystem:
MonitorandtuneoperatingsystemCPU,I/Oandmemoryutilization.Formoreinformation,readtherelatedOracleFAQdealingwith
yourspecificoperatingsystem.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

54/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatarethevarioussubeventsamousedoubleclickeventinvolves?Whatarethevarioussubeventsamousedoubleclick
eventinvolves?
Doubleclickingthemouseconsistsofthemousedown,mouseup,mouseclick,mousedown&mouseupevents.
Whatarethedefaultparameterthatappearatruntimeintheparameterscreen?Whatarethevarioussubeventsamouse
doubleclickeventinvolves?
DestypeandDesname.
WhatarethebuiltinsusedforCreatinganddeletinggroups?
CREATEGROUP(function)
CREATE_GROUP_FROM_QUERY(function)
DELETE_GROUP(procedure)
Whataredifferenttypesofcanvasviews?
Contentcanvasviews
Stackedcanvasviews
Horizontaltoolbar
verticaltoolbar.
WhatarethedifferenttypesofDeletedetailswecanestablishinMasterDetails?
Cascade
Isolate
Nonisolate
Whatisrelationbetweenthewindowandcanvasviews?
Canvasviewsarethebackgroundobjectsonwhichyouplacetheinterfaceitems(Textitems),checkboxes,radiogroupsetc.,)and
boilerplateobjects(boxes,lines,imagesetc.,)thatoperatorsinteractwithustheyrunyourform.Eachcanvasviewsdisplayedina
window.
WhatisaUser_exit?
Callstheuserexitnamedintheuser_exit_string.Invokesa3Glprogrambynamewhichhasbeenproperlylinkedintoyourcurrent
oracleformsexecutable.
Howisitpossibletoselectgenerateaselectsetforthequeryinthequerypropertysheet?
Byusingthetables/columnsbuttonandthenspecifyingthetableandthecolumnnames.
Howcanvaluesbepassedbet.precompilerexits&Oraclecallinterface?
ByusingthestatementEXECIAFGET&EXECIAFPUT.
Howcanasquarebedrawninthelayouteditorofthereportwriter?
Byusingtherectangletoolwhilepressingthe(Constraint)key.
Howcanatextfilebeattachedtoareportwhilecreatinginthereportwriter?
Byusingthelinkfilepropertyinthelayoutboilerplatepropertysheet.
HowcanImessagetopassedtotheuserfromreports?
ByusingSRW.MESSAGEfunction.
Doesoneneedtodrop/truncateobjectsbeforeimporting?
Beforeoneimportrowsintoalreadypopulatedtables,oneneedstotruncateordropthesetablestogetridoftheolddata.Ifnot,the
newdatawillbeappendedtotheexistingtables.OnemustalwaysDROPexistingSequencesbeforereimporting.Ifthesequences
arenotdropped,theywillgeneratenumbersinconsistentwiththerestofthedatabase.Note:Itisalsoadvisabletodropindexes
beforeimportingtospeeduptheimportprocess.Indexescaneasilyberecreatedafterthedatawassuccessfullyimported.
Howcanabuttonbeusedinareporttogiveadrilldownfacility?
BysettingtheactionassociatedwithbuttontoExecutepl/sqloptionandusingtheSRW.Run_reportfunction.
Canoneimport/exportbetweendifferentversionsofOracle?
Differentversionsoftheimportutilityisupwardscompatible.Thismeansthatonecantakeanexportfilecreatedfromanoldexport
version,andimportitusingalaterversionoftheimportutility.Thisisquiteaneffectivewayofupgradingadatabasefromone
releaseofOracletothenext.
OraclealsoshipssomepreviouscatexpX.sqlscriptsthatcanbeexecutedasuserSYSenablingolderimp/expversionstowork(for
backwardscompatibility).Forexample,onecanrun$ORACLE_HOME/rdbms/admin/catexp7.sqlonanOracle8databasetoallow
theOracle7.3exp/imputilitiestorunagainstanOracle8database.
Whataredifferenttypesofimages?
BoilerplateimagesImageItems
Canoneexporttomultiplefiles?/CanonebeattheUnix2Giglimit?
FromOracle8i,theexportutilitysupportsmultipleoutputfiles.Thisfeatureenableslargeexportstobedividedintofileswhosesizes
willnotexceedanyoperatingsystemlimits(FILESIZE=parameter).Whenimportingfrommultifileexportyoumustprovidethesame
filenamesinthesamesequenceintheFILE=parameter.Lookatthisexample:
expSCOTT/TIGERFILE=D:\F1.dmp,E:\F2.dmpFILESIZE=10mLOG=scott.log
UsethefollowingtechniqueifyouuseanOracleversionpriorto8i:
Createacompressedexportonthefly.Dependingonthetypeofdata,youprobablycanexportupto10gigabytestoasinglefile.
Thisexampleusesgzip.ItoffersthebestcompressionIknowof,butyoucanalsosubstituteitwithzip,compressorwhatever.
1. createanamedpipe

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

55/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
mknodexp.pipe p
1. readthepipeoutputtozipfileinthebackground

gzip<exp.pipe >scott.exp.gz&
1. feedthepipe

expuserid=scott/tigerfile=exp.pipe
Whatisbindreferenceandhowcanitbecreated?
Bindreferenceareusedtoreplacethesinglevalueinsql,pl/sqlstatementsabindreference

canbecreatedusinga(:)beforeacolumnoraparametername.
HowcanoneimproveImport/Exportperformance?
EXPORT:

.SettheBUFFERparametertoahighvalue(e.g.2M)
.SettheRECORDLENGTHparametertoahighvalue(e.g.64K)
.Stopunnecessaryapplicationstofreeupresourcesforyourjob.
.Ifyourunmultipleexportsessions,ensuretheywritetodifferentphysicaldisks.
.DONOTexporttoanNFSmountedfilesystem.Itwilltakeforever.
IMPORT:
.CreateanindexfilesothatyoucancreateindexesAFTERyouhaveimporteddata.DothisbysettingINDEXFILEtoafilenameand
thenimport.Nodatawillbeimportedbutafilecontainingindexdefinitionswillbecreated.Youmusteditthisfileafterwardsand
supplythepasswordsfortheschemasonallCONNECTstatements.
.Placethefiletobeimportedonaseparatephysicaldiskfromtheoracledatafiles
.IncreaseDB_CACHE_SIZE(DB_BLOCK_BUFFERSpriorto9i)considerablyintheinit$SID.ora file
.SettheLOG_BUFFERtoabigvalueandrestartoracle.
.Stopredologarchivingifitisrunning(ALTERDATABASENOARCHIVELOG)
.CreateaBIGtablespacewithaBIGrollbacksegmentinside.Setallotherrollbacksegmentsoffline(excepttheSYSTEMrollback
segmentofcourse).Therollbacksegmentmustbeasbigasyourbiggesttable(Ithink?)
.UseCOMMIT=Nintheimportparameterfileifyoucanaffordit
.UseANALYZE=NintheimportparameterfiletoavoidtimeconsumingANALYZEstatements
.Remembertoruntheindexfilepreviouslycreated
Givethesequenceofexecutionofthevariousreporttriggers?
Beforeform,Afterform,Beforereport,Betweenpage,Afterreport.
WhatarethecommonImport/Exportproblems?(forDBA)
ORA00001:Uniqueconstraint()violatedYouareimportingduplicaterows.UseIGNORE=NOtoskiptablesthatalreadyexist
(impwillgiveanerroriftheobjectisrecreated).
ORA01555:SnapshottoooldAskyouruserstoSTOPworkingwhileyouareexportingoruseparameterCONSISTENT=NO
ORA01562:FailedtoextendrollbacksegmentCreatebiggerrollbacksegmentsorsetparameterCOMMIT=Ywhileimporting
IMP00015:StatementfailedobjectalreadyexistsUsetheIGNORE=Yimportparametertoignoretheseerrors,butbecareful
asyoumightendupwithduplicaterows.
Whyisitpreferabletocreateafewerno.ofqueriesinthedatamodel?
Becauseforeachquery,reporthastoopenaseparatecursorandhastorebind,executeandfetchdata.
Whereistheexternalqueryexecutedattheclientortheserver?Attheserver.
Whereisaprocedurereturninanexternalpl/sqllibraryexecutedattheclientorattheserver?
Attheclient.
WhatiscoordinationEvent?
Anyeventthatmakesadifferentrecordinthemasterblockthecurrentrecordisacoordinationcausingevent.
WhatisthedifferencebetweenOLEServer&OleContainer?
AnOleserverapplicationcreatesoleObjectsthatareembeddedorlinkedinoleContainersex.Oleserversarems_word&
ms_excel.OLEcontainersprovideaplacetostore,displayandmanipulateobjectsthatarecreatedbyoleserverapplications.Ex.
oracleformsisanexampleofanoleContainer.
Whatisanobjectgroup?Anobjectgroupisacontainerforagroupofobjectsyoudefineanobjectgroupwhenyouwantto
packagerelatedobjects,sothatyoucopyorreferencetheminothermodules.
WhatisanLOV?
AnLOVisascrollablepopupwindowthatprovidestheoperatorwitheitherasingleormulticolumnselectionlist.
AtwhatpointofreportexecutionisthebeforeReporttriggerfired?
Afterthequeryisexecutedbutbeforethereportisexecutedandtherecordsaredisplayed.
WhatarethebuiltinsusedforModifyingagroupsstructure?
ADDGROUP_COLUMN(function)
ADD_GROUP_ROW(procedure)
DELETE_GROUP_ROW(procedure)

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

56/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisanuserexitusedfor?
Awayinwhichtopasscontrol(andpossiblyarguments)formOraclereporttoanotherOracleproductsof3GLandthenreturn
control(and)backtoOraclereports.
WhatistheUserNamedEditor?
Ausernamededitorhasthesametexteditingfunctionalityasthedefaulteditor,but,becauseitisanamedobject,youcanspecify
editorattributessuchaswindowsdisplaysize,position,andtitle.
MydatabasewasterminatedwhileinBACKUPMODE,doIneedtorecover?
IfadatabasewasterminatedwhileoneofitstablespaceswasinBACKUPMODE(ALTERTABLESPACExyzBEGINBACKUP),itwill
tellyouthatmediarecoveryisrequiredwhenyoutrytorestartthedatabase.TheDBAisthenrequiredtorecoverthedatabaseand
applyallarchivedlogstothedatabase.However,fromOracle7.2,youcansimplytaketheindividualdatafilesoutofbackupmodeand
restartthedatabase.
ALTERDATABASEDATAFILE/path/filenameENDBACKUP
OnecanselectfromV$BACKUPtoseewhichdatafilesareinbackupmode.Thisnormallysavesasignificantamountofdatabase
downtime.
ThiruVadivelucontributedthefollowing:
FromOracle9ionwards,thefollowingcommandcanbeusedtotakeallofthedatafilesoutofhotbackupmode:
ALTERDATABASEENDBACKUP
Theabovecommandsneedtobeissuedwhenthedatabaseismounted.
WhatisaStaticRecordGroup?
Astaticrecordgroupisnotassociatedwithaquery,rather,youdefineitsstructureandrowvaluesatdesigntime,andtheyremain
fixedatruntime.
Whatisarecordgroup?
ArecordgroupisaninternalOracleFormsthatstructurethathasacolumn/rowframeworksimilartoadatabasetable.However,
unlikedatabasetables,recordgroupsareseparateobjectsthatbelongtotheformmodulewhichtheyaredefined.
MydatabaseisdownandIcannotrestore.Whatnow?
Recoverywithoutanybackupisnormallynotsupported,however,OracleConsultingcansometimesextractdatafromanoffline
databaseusingautilitycalledDUL(DiskUnLoad).ThisutilityreadsdatainthedatafilesandunloadsitintoSQL*Loaderorexport
dumpfiles.DULdoesnotcareaboutrollbacksegments,corruptedblocks,etc,andcanthusnotguaranteethatthedataisnot
logicallycorrupt.Itisintendedasanabsolutelastresortandwillmostlikelycostyourcompanyalotofmoney!!!
IvelostmyREDOLOGfiles,howcanIgetmyDBback?
ThefollowingINIT.ORAparametermayberequiredifyourcurrentredologsarecorruptedorblownaway.Cautionisadvisedwhen
enablingthisparameterasyoumightenduplosingyourentiredatabase.PleasecontactOracleSupportbeforeusingit.
_allow_resetlogs_corruption=true
Whatisapropertyclause?
Apropertyclauseisanamedobjectthatcontainsalistofpropertiesandtheirsettings.Onceyoucreateapropertyclauseyoucan
baseotherobjectonit.Anobjectbasedonapropertycaninheritthesettingofanypropertyintheclausethatmakessenseforthat
object.
Whatisaphysicalpage?&Whatisalogicalpage?
Aphysicalpageisasizeofapage.Thatisoutputbytheprinter.Thelogicalpageisthesizeofonepageoftheactualreportasseen
inthePreviewer.
IvelostsomeRollbackSegments,howcanIgetmyDBback?
RestartyourdatabasewiththefollowingINIT.ORAparameterifoneofyourrollbacksegmentsiscorrupted.Youcanthendropthe
corruptedrollbacksegmentsandcreateitfromscratch.
Cautionisadvisedwhenenablingthisparameter,asuncommittedtransactionswillbemarkedascommitted.Onecanverywellend
upwithlostorinconsistentdata!!!PleasecontactOracleSupportbeforeusingit._Corrupted_rollback_segments=(rbs01,rbs01,
rbs03,rbs04)
WhatarethedifferencesbetweenEBUandRMAN?
EnterpriseBackupUtility(EBU)isafunctionallyrich,highperformanceinterfaceforbackingupOracle7databases.Itissometimes
referredtoasOEBUforOracleEnterpriseBackupUtility.TheOracleRecoveryManager(RMAN)utilitythatshipswithOracle8and
aboveissimilartoOracle7sEBUutility.However,thereisnodirectupgradepathfromEBUtoRMAN.
HowdoesonecreateaRMANrecoverycatalog?
Startbycreatingadatabaseschema(usuallycalledrman).Assignanappropriatetablespacetoitandgrantitthe
recovery_catalog_ownerrole.Lookatthisexample:
sqlplussys
SQL>createuserrmanidentifiedbyrman
SQL>alteruserrmandefaulttablespacetoolstemporarytablespacetemp
SQL>alteruserrmanquotaunlimitedontools
SQL>grantconnect,resource,recovery_catalog_ownertorman
SQL>exit
Next,logintormanandcreatethecatalogschema.PriortoOracle8ithiswasdonebyrunningthecatrman.sqlscript.rmancatalog
rman/rman
RMAN>createcatalogtablespacetools
RMAN>exit

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

57/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Youcannowcontinuebyregisteringyourdatabasesinthecatalog.Lookatthisexample:
rmancatalogrman/rmantargetbackdba/backdba
RMAN>registerdatabase
Howcanagroupinacrossproductsbevisuallydistinguishedfromagroupthatdoesnotformacrossproduct?
Agroupthatformspartofacrossproductwillhaveathickerborder.
Whatistheframe&repeatingframe?
Aframeisaholderforagroupoffields.Arepeatingframeisusedtodisplayasetofrecordswhentheno.ofrecordsthatareto
displayedisnotknownbefore.
Whatisacombobox?
Acomboboxstylelistitemcombinesthefeaturesfoundinlistandtextitem.Unlikethepoplistorthetextliststylelistitems,the
comboboxstylelistitemwillbothdisplayfixedvaluesandacceptoneoperatorenteredvalue.
Whatarethreepanesthatappearintheruntimepl/sqlinterpreter?
1.Sourcepane.
2.interpreterpane.
3.Navigatorpane.
WhatarethetwopanesthatAppearinthedesigntimepl/sqlinterpreter?
1.Sourcepane.
2.Interpreterpane
Whatarethetwowaysbywhichdatacanbegeneratedforaparameterslistofvalues?
1.Usingstaticvalues.
2.Writingselectstatement.
Whatarethevariousmethodsofperformingacalculationinareport?
1.PerformthecalculationintheSQLstatementsitself.
2.Useacalculated/summarycolumninthedatamodel.
Whatarethedefaultextensionsofthefilescreatedbymenumodule?
.mmb,
.mmx
Whatarethedefaultextensionsofthefilescreatedbyformsmodules?
.fmbformmodulebinary
.fmxformmoduleexecutable
Todisplaythepageno.foreachpageonareportwhatwouldbethesource&logicalpageno.or&ofphysicalpageno.?
&physicalpageno.
Itispossibletouserawdevicesasdatafilesandwhatistheadvantagesoverfile.systemfiles?Yes.Theadvantagesoverfile
systemfiles.I/OwillbeimprovedbecauseOracleisbyepassingthekernnelwhichwritingintodisk.DiskCorruptionwillbeveryless.
Whataredisadvantagesofhavingrawdevices?
Weshoulddependonexport/importutilityforbackup/recovery(fullyreliable)Thetarcommandcannotbeusedforphysicalfile
backup,insteadwecanuseddcommandwhichislessflexibleandhaslimitedrecoveries.
Whatisthesignificanceofhavingstorageclause?
Wecanplanthestorageforatableashowmuchinitialextentsarerequired,howmuchcanbeextendednext,howmuch%should
leavefreeformanagingrowupdationsetc.,
WhatistheuseofINCTYPEoptioninEXPcommand?
TypeexportshouldbeperformedCOMPLETE,CUMULATIVE,INCREMENTAL.Listthesequenceofeventswhenalargetransaction
thatexceedsbeyonditsoptimalvaluewhenanentrywrapsandcausestherollbacksegmenttoexpandintoanotionCompletes.e.will
bewritten.
WhatistheuseofFILEoptioninIMPcommand?
Thenameofthefilefromwhichimportshouldbeperformed.
WhatisaSharedSQLpool?
ThedatadictionarycacheisstoredinanareainSGAcalledtheSharedSQLPool.ThiswillallowsharingofparsedSQLstatements
amongconcurrentusers.
Whatishotbackupandhowitcanbetaken?
Takingbackupofarchivelogfileswhendatabaseisopen.ForthistheARCHIVELOGmodeshouldbeenabled.Thefollowingfiles
needtobebackedup.Alldatafiles.AllArchivelog,redologfiles.Allcontrolfiles.
ListtheOptionalFlexibleArchitecture(OFA)ofOracledatabase?orHowcanweorganizethetablespacesinOracledatabase
tohavemaximumperformance?
SYSTEMDatadictionarytables.
DATAStandardoperationaltables.
DATA2Statictablesusedforstandardoperations
INDEXESIndexesforStandardoperationaltables.
INDEXES1Indexesofstatictablesusedforstandardoperations.
TOOLSToolstable.
TOOLS1Indexesfortoolstable.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

58/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
RBSStandardOperationsRollbackSegments,
RBS1,RBS2Additional/SpecialRollbacksegments.
TEMPTemporarypurposetablespace
TEMP_USERTemporarytablespaceforusers.
USERSUsertablespace.
Howtoimplementthemultiplecontrolfilesforanexistingdatabase?
ShutdownthedatabaseCopyoneoftheexistingcontrolfiletonewlocationEditConfigorafilebyaddingnewcontrolfile.name
Restartthedatabase.
Whatisadvantageofhavingdiskshadowing/Mirroring?
Shadowsetofdiskssaveasabackupintheeventofdiskfailure.InmostOperatingSystemifanydiskfailureoccursitautomatically
switchovertoplaceoffaileddisk.ImprovedperformancebecausemostOSsupportvolumeshadowingcandirectfileI/Orequestto
usetheshadowsetoffilesinsteadofthemainsetoffiles.ThisreducesI/Oloadonthemainsetofdisks.
Howwillyouforcedatabasetouseparticularrollbacksegment?
SETTRANSACTIONUSEROLLBACKSEGMENTrbs_name.
Whyqueryfailssometimes?
Rollbacksegmentdynamicallyextenttohandlelargertransactionsentryloads.Asingletransactionmaywipeoutallavailablefree
spaceintheRollbackSegmentTablespace.ThispreventsotheruserusingRollbacksegments.
WhatistheuseofRECORDLENGTHoptioninEXPcommand?
Recordlengthinbytes.
Howwillyoumonitorrollbacksegmentstatus?
QueryingtheDBA_ROLLBACK_SEGSview
INUSERollbackSegmentisonline.
AVAILABLERollbackSegmentavailablebutnotonline.
OFFLINERollbackSegmentoffline
INVALIDRollbackSegmentDropped.
NEEDSRECOVERYContainsdatabutneedrecoveryorcorupted.
PARTLYAVAILABLEContainsdatafromanunresolvedtransactioninvolvingadistributeddatabase.
WhatismeantbyRedoLogfilemirroring?Howitcanbeachieved?
Processofhavingacopyofredologfilesiscalledmirroring.Thiscanbeachievedbycreatinggroupoflogfilestogether,sothat
LGWRwillautomaticallywritesthemtoallthemembersofthecurrentonlineredologgroup.Ifanyonegroupfailsthendatabase
automaticallyswitchovertonextgroup.Itdegradesperformance.
WhichparameterinStorageclausewillreduceno.ofrowsperblock?
PCTFREEparameter
Rowsizealsoreducesnoofrowsperblock.
Whatismeantbyrecursivehints?
Numberoftimesprocessesrepeatedlyquerythedictionarytableiscalledrecursivehints.Itisduetothedatadictionarycacheistoo
small.ByincreasingtheSHARED_POOL_SIZEparameterwecanoptimizethesizeofDataDictionaryCache.
WhatistheuseofPARFILEoptioninEXPcommand?
Nameoftheparameterfiletobepassedforexport.
Whatisthedifferencebetweenlocks,latches,enqueuesandsemaphores?
AlatchisaninternalOraclemechanismusedtoprotectdatastructuresintheSGAfromsimultaneousaccess.Atomichardware
instructionslikeTESTANDSETisusedtoimplementlatches.Latchesaremorerestrictivethanlocksinthattheyarealways
exclusive.Latchesareneverqueued,butwillspinorsleepuntiltheyobtainaresource,ortimeout.
Enqueuesandlocksaredifferentnamesforthesamething.Bothsupportqueuingandconcurrency.Theyarequeuedandserviced
inafirstinfirstout(FIFO)order.
Semaphoresareanoperatingsystemfacilityusedtocontrolwaiting.SemaphoresarecontrolledbythefollowingUnixparameters:
semmni,semmnsandsemmsl.Typicalsettingsare:
semmns=sumoftheprocessesparameterforeachinstance
(seeinit<instance>.oraforeachinstance)
semmni=numberofinstancesrunningsimultaneously
semmsl=semmns
Whatisalogicalbackup?
Logicalbackupinvolvesreadingasetofdatabaserecordsandwritingthemintoafile.Exportutilityisusedfortakingbackupand
Importutilityisusedtorecoverfrombackup.
WherecanonegetalistofallhiddenOracleparameters?
OracleinitializationorINIT.ORAparameterswithanunderscoreinfrontarehiddenorunsupportedparameters.Onecangetalistof
allhiddenparametersbyexecutingthisquery:
select*
fromSYS.X$KSPPI
wheresubstr(KSPPINM,1,1)=_'
Thefollowingquerydisplaysparameternameswiththeircurrentvalue:
selecta.ksppinmParameter,b.ksppstvlSessionValue,c.ksppstvlInstanceValue
fromx$ksppia,x$ksppcvb,x$ksppsvc
wherea.indx=b.indxanda.indx=c.indx

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

59/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
andsubstr(ksppinm,1,1)=_
orderbya.ksppinm
Remember:Thoushallnotplaywithundocumentedparameters!
WhatisadatabaseEVENTandhowdoesonesetit?
OracletraceeventsareusefulfordebuggingtheOracledatabaseserver.Thefollowingtwoexamplesaresimplytodemonstrate
syntax.Refertolaternotesonthispageforanexplanationofwhattheseparticulareventsdo.
EitheraddingthemtotheINIT.ORAparameterfilecanactivateevents.E.g.
event=1401tracenameerrorstack,level12
or,byissuinganALTERSESSIONSETEVENTScommand:E.g.
altersessionsetevents10046tracenamecontextforever,level4
Thealtersessionmethodonlyaffectstheuserscurrentsession,whereaschangestotheINIT.ORAfilewillaffectallsessionsonce
thedatabasehasbeenrestarted.
WhatisaRollbacksegmententry?
Itisthesetofbeforeimagedatablocksthatcontainrowsthataremodifiedbyatransaction.EachRollbackSegmententrymustbe
completedwithinonerollbacksegment.Asinglerollbacksegmentcanhavemultiplerollbacksegmententries.
Whatdatabaseeventscanbeset?
ThefollowingeventsarefrequentlyusedbyDBAsandOracleSupporttodiagnoseproblems:
10046tracenamecontextforever,level4TraceSQLstatementsandshowbindvariablesintraceoutput.
10046tracenamecontextforever,level8ThisshowswaiteventsintheSQLtracefiles
10046tracenamecontextforever,level12ThisshowsbothbindvariablenamesandwaiteventsintheSQLtracefiles
1401tracenameerrorstack,level121401tracenameerrorstack,level41401tracenameprocessstateDumpsouttrace
informationifanORA1401insertedvaluetoolargeforcolumnerroroccurs.The1401canbereplacedbyanyotherOracleServer
errorcodethatyouwanttotrace.
60tracenameerrorstacklevel10ShowwhereinthecodeOraclegetsadeadlock(ORA60),andmayhelptodiagnosethe
problem.
Thefollowinglistsofeventsareexamplesonly.Theymightbeversionspecific,sopleasecallOraclebeforeusingthem:
10210tracenamecontextforever,level1010211tracenamecontextforever,level1010231tracenamecontextforever,level10
Theseeventspreventdatabaseblockcorruptions
10049tracenamecontextforever,level2Memoryprotectcursor
10210tracenamecontextforever,level2Datablockcheck
10211tracenamecontextforever,level2Indexblockcheck
10235tracenamecontextforever,level1Memoryheapcheck
10262tracenamecontextforever,level300Allow300bytesmemoryleakforconnections
Note:YoucanusetheUnixoerrcommandtogetthedescriptionofanevent.OnUnix,youcantypeoerrora10053fromthe
commandprompttogeteventdetails.
Howcanonedumpinternaldatabasestructures?
Thefollowing(mostlyundocumented)commandscanbeusedtoobtaininformationaboutinternaldatabasestructures.
Dumpcontrolfilecontents

altersessionseteventsimmediatetracenameCONTROLFlevel10
/
Dumpfileheaders

altersessionseteventsimmediatetracenameFILE_HDRSlevel10
/
Dumpredologheaders

altersessionseteventsimmediatetracenameREDOHDRlevel10
/
Dumpthesystemstate

NOTE:Take3successiveSYSTEMSTATEdumps,with10minuteintervalsaltersessionseteventsimmediatetracename
SYSTEMSTATElevel10
/
Dumptheprocessstate

altersessionseteventsimmediatetracenamePROCESSSTATElevel10
/
DumpLibraryCachedetails

altersessionseteventsimmediatetracenamelibrarycachelevel10
/
DumpoptimizerstatisticswheneveraSQLstatementisparsed(hint:changestatementorflushpool)altersessionsetevents10053trace

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

60/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
namecontextforever,level1

/
Dumpadatabaseblock(File/BlockmustbeconvertedtoDBAaddress)ConvertfileandblocknumbertoaDBA(databaseblockaddress).

Eg:variablexvarchar2
exec:x :=dbms_utility.make_data_block_address(1,12)
printx
altersessionseteventsimmediatetracenameblockdumplevel50360894
/
Whatarethedifferentkindofexportbackups?
FullbackCompletedatabase
IncrementalOnlyaffectedtablesfromlastincrementaldate/fullbackupdate.
CumulativebackupOnlyaffectedtablefromthelastcumulativedate/fullbackupdate.
HowfreeextentsaremanagedinVer6.0andVer7.0?
FreeextentscannotbemergedtogetherinVer6.0.
FreeextentsareperiodicallycoalesceswiththeneighboringfreeextentinVer7.0
WhatistheuseofRECORDoptioninEXPcommand?ForIncrementalexports,theflagindirectswhetherarecordwillbestores
datadictionarytablesrecordingtheexport.
WhatistheuseofROWSoptioninEXPcommand?Flagtoindicatewhethertablerowsshouldbeexported.IfNonlyDDL
statementsforthedatabaseobjectswillbecreated.
WhatistheuseofCOMPRESSoptioninEXPcommand?
Flagtoindicatewhetherexportshouldcompressfragmentedsegmentsintosingleextents.
Howwillyouswapobjectsintoadifferenttablespaceforanexistingdatabase?
Exporttheuser
Performimportusingthecommandimpsystem/managerfile=export.dmp indexfile=newrite.sql.
Thiswillcreatealldefinitionsintonewfile.sql.Dropnecessaryobjects.
Runthescriptnewfile.sqlafteralteringthetablespaces.
Importfromthebackupforthenecessaryobjects.
HowdoesSpaceallocationtableplacewithinablock?
Eachblockcontainsentriesasfollows
Fixedblockheader
Variableblockheader
RowHeader,rowdate(multiplerowsmayexists)
PCTEREE(%offreespaceforrowupdationinfuture)
WhatarethefactorscausingthereparsingofSQLstatementsinSGA?
DuetoinsufficientSharedSQLpoolsize.MonitortheratioofthereloadstakesplacewhileexecutingSQLstatements.Iftheratiois
greaterthan1thenincreasetheSHARED_POOL_SIZE.LOGICAL&PHYSICALARCHITECTUREOFDATABASE.
Whatisdictionarycache?
Dictionarycacheisinformationaboutthedatabseobjectsstoredinadatadictionarytable.
WhatisaControlfile?
Databaseoverallphysicalarchitectureismaintainedinafilecalledcontrolfile.Itwillbeusedtomaintaininternalconsistencyand
guiderecoveryoperations.Multiplecopiesofcontrolfilesareadvisable.
WhatisDatabaseBuffers?
DatabasebuffersarecacheintheSGAusedtoholdthedatablocksthatarereadfromthedatasegmentsinthedatabasesuchas
tables,indexesandclustersDB_BLOCK_BUFFERSparameterinINIT.ORAdecidesthesize.
Howwillyoucreatemultiplerollbacksegmentsinadatabase?
CreateadatabasewhichimplicitlycreatesaSYSTEMRollbackSegmentinaSYSTEMtablespace.CreateaSecondRollback
SegmentnameR0intheSYSTEMtablespace.Makenewrollbacksegmentavailable(Aftershutdown,modifyinit.ora fileandStart
database)Createothertablespaces(RBS)forrollbacksegments.DeactivateRollbackSegmentR0andactivatethenewlycreated
rollbacksegments.
Whatiscoldbackup?Whataretheelementsofit?
Coldbackupistakingbackupofallphysicalfilesafternormalshutdownofdatabase.Weneedtotake.
AllDatafiles.
AllControlfiles.
Allonlineredologfiles.
Theinit.orafile(Optional)
Whatismeantbyredologbuffer?
Changesmadetoentriesarewrittentotheonlineredologfiles.Sothattheycanbeusedinrollforwardoperationsduringdatabase
recoveries.Beforewritingthemintotheredologfiles,theywillfirstbroughttoredologbuffersinSGAandLGWRwillwriteintofiles

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

61/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
frequently.LOG_BUFFERparameterwilldecidethesize.
Howwillyouestimatethespacerequiredbyanonclusteredtables?
Calculatethetotalheadersize
Calculatetheavailabledataspaceperdatablock
Calculatethecombinedcolumnlengthsoftheaveragerow
Calculatethetotalaveragerowsize.
Calculatetheaveragenumberrowsthatcanfitinablock
Calculatethenumberofblocksandbytesrequiredforthetable.
Afterarrivingthecalculation,add10%additionalspacetocalculatetheinitialextentsizeforaworkingtable.
Howwillyoumonitorthespaceallocation?
ByqueryingDBA_SEGMENTtable/view.
Whatismeantbyfreeextent?
Afreeextentisacollectionofcontinuousfreeblocksintablespace.Whenasegmentisdroppeditsextentsarereallocatedandare
markedasfree.
WhatistheuseofIGNOREoptioninIMPcommand?
AflagtoindicatewhethertheimportshouldignoreerrorsencounterwhenissuingCREATEcommands.
WhatistheuseofANALYSE(Ver7)optioninEXPcommand?
Aflagtoindicatewhetherstatisticalinformationabouttheexportedobjectsshouldbewrittentoexportdumpfile.
WhatistheuseofROWSoptioninIMPcommand?
Aflagtoindicatewhetherrowsshouldbeimported.IfthisissettoNthenonlyDDLfordatabaseobjectswillbeexecuted.
WhatistheuseofINDEXESoptioninEXPcommand?
Aflagtoindicatewhetherindexesontableswillbeexported.
WhatistheuseofINDEXESoptioninIMPcommand?
Aflagtoindicatewhetherimportshouldimportindexontablesornot.
WhatistheuseofGRANToptioninEXPcommand?
Aflagtoindicatewhethergrantsondatabseobjectswillbeexportedornot.ValueisYorN.
WhatistheuseofGRANToptioninIMPcommand?
Aflagtoindicatewhethergrantsondatabaseobjectswillbeimported.
WhatistheuseofFULLoptioninEXPcommand?
Aflagtoindicatewhetherfulldatabseexportshouldbeperformed.
WhatistheuseofSHOWoptioninIMPcommand?
Aflagtoindicatewhetherfilecontentshouldbedisplayedornot.
WhatistheuseofCONSTRAINTSoptioninEXPcommand?
Aflagtoindicatewhetherconstraintsontableneedtobeexported.
WhatistheuseofCONSISTENT(Ver7)optioninEXPcommand?
Aflagtoindicatewhetherareadconsistentversionofalltheexportedobjectsshouldbemaintained.
Whatarethedifferentmethodsofbackinguporacledatabase?
LogicalBackups
ColdBackups
HotBackups(Archivelog)
WhatisthedifferencebetweenONVALIDATEFIELDtriggerandaPOSTCHANGEtrigger?
WhenyouchangestheExistingvaluetonull,theOnvalidatefieldtriggerwillfirepostchangetriggerwillnotfire.Atthetimeof
executequerypostchangetriggerwillfire,onvalidatefieldtriggerwillnotfire.
WhenisPREQUERYtriggerexecuted?
WhenExecutequeryorcountqueryPackageproceduresareinvoked.
Howdoyoutraptheerrorinforms3.0?usingOnMessageorOnErrortriggers.
Howmanypagesyoucaninasingleform?
Unlimited
Whilespecifyingmaster/detailrelationshipbetweentwoblocksspecifyingthejoinconditionisamust?
TrueorFalse.?
True
EXIT_FORMisarestrictedpackageprocedure?
a.Trueb.False
True
WhatistheusageofanONINSERT,ONDELETEandONUPDATETRIGGERS?
Thesetriggersareexecuteswheninserting,deletingandupdatingoperationsareperformedandcanbeusedtochangethedefault
functionofinsert,deleteorupdaterespectively.ForEg,insteadofinsertingarowinatableanexistingrowcanbeupdatedinthe

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

62/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
sametable.
WhatarethetypesofPopupwindow?
thepopupfieldeditor
popuplistofvalues
popuppages.
Alert:
WhatisanSQL*FORMS?
SQL*formsis4GLtoolfordevelopingandexecutingOraclebasedinteractiveapplication.
Howdoyoucontroltheconstraintsinforms?
SelecttheuseconstraintpropertyisONBlockdefinitionscreen.
BLOCK
Whatisthedifferencebetweenrestrictedandunrestrictedpackageprocedure?
RestrictedpackageprocedurethataffectsthebasicfunctionsofSQL*Forms.Itcannotusedinalltriggersexceptkeytriggers.
UnrestrictedpackageprocedurethatdoesnotinterferewiththebasicfunctionsofSQL*Formsitcanbeusedinanytriggers.
Aqueryfetched10recordsHowmanytimesdoesaPREQUERYTriggerandPOSTQUERYTriggerwillgetexecuted?PRE
QUERYfiresonce.
POSTQUERYfires10times.
Givethesequenceinwhichtriggersfiredduringinsertoperations,whenthefollowing3triggersaredefinedatthesameblock
level?
a.ONINSERTb.POSTINSERTc.PREINSERT
Statetheorderinwhichthesetriggersareexecuted?
POSTFIELD,ONVALIDATEFIELD,POSTCHANGEandKEYNEXTFLD.KEYNEXTFLD,POSTCHANGE,ONVALIDATEFIELD,
POSTFIELD.g.
WhatthePAUSEpackageproceduredoes?
Pausesuspendsprocessinguntiltheoperatorpressesafunctionkey
Whatdoyoumeanbyapage?
Pagesarecollectionofdisplayinformation,suchasconstanttextandgraphics
WhatarethetypeofUserExits?
ORACLEPrecompliersuserexits
OCI(ORACLECallInterface)
NonORACELuserexits.
Page:
WhatisthedifferencebetweenanONVALIDATEFIELDtriggerandatrigger?
Onvalidatefieldtriggerfires,whenthefieldValidationstatusNeworchanged.Postfieldtriggerwheneverthecontrolleavingform
thefield,itwillfire.
CanweusearestrictedpackageprocedureinONVALIDATEFIELDTrigger?
No
IsaKeystartuptriggerfiresasresultofaoperatorpressingakeyexplicitly?
No
CanweuseGOBLOCKpackageinaprefieldtrigger?
No
Canwecreatetwoblockswiththesamenameinform3.0?
No
WhatdoesanonclearblockTriggerfire?ItfiresjustbeforeSQL*formsthecurrentblock.
Namethetwofilesthatarecreatedwhenyougeneratetheformgivethefilexextension?
INP(SourceFile)
FRM(ExecutableFile)
Whatpackageprocedureusedforinvokesql*plusfromsql*forms?
Host(E.g.Host(sqlplus))
WhatisthesignificanceofPAGE0informs3.0?
Hidethefieldsforinternalcalculation.
Whatarethedifferenttypesofkeytriggers?
FunctionKey
Keyfunction
Keyothers
Keystartup
WhatisthedifferencebetweenaFunctionKeyTriggerandKeyFunctionTrigger?
FunctionkeytriggersareassociatedwithindividualSQL*FORMSfunctionkeysYoucanattachKeyfunctiontriggersto10keysorkey
sequencesthatnormallydonotperformanySQL*FORMSoperations.ThesekeysreferredaskeyF0throughkeyF9.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

63/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
CommittedblocksometimesrefertoaBASETABLE?
False
Error_Codeisapackageproecdure?
a.Trueb.false
False
Wheniscostbasedoptimizationtriggered?ItsimportanttohavestatisticsonalltablesfortheCBO(CostBasedOptimizer)towork
correctly.Ifonetableinvolvedinastatementdoesnothavestatistics,Oraclehastoreverttorulebasedoptimizationforthat
statement.Soyoureallywantforalltablestohavestatisticsrightawayitwonthelpmuchtojusthavethelargertablesanalyzed.
Generally,theCBOcanchangetheexecutionplanwhenyou:
1.ChangestatisticsofobjectsbydoinganANALYZE
2.Changesomeinitializationparameters(forexample:hash_join_enabled,sort_area_size,db_file_multiblock_read_count).
Howcanoneoptimize%XYZ%queries?
Itispossibletoimprove%XYZ%queriesbyforcingtheoptimizertoscanalltheentriesfromtheindexinsteadofthetable.Thiscan
bedonebyspecifyinghints.Iftheindexisphysicallysmallerthanthetable(whichisusuallythecase)itwilltakelesstimetoscanthe
entireindexthantoscantheentiretable.
WhatEnterpackageproceduredoes?
EnterValidatedatainthecurrentvalidationunit.
WherecanonefindI/Ostatisticspertable?
TheUTLESTATreportshowsI/OpertablespacebutonecannotseewhattablesinthetablespacehasthemostI/O.The
$ORACLE_HOME/rdbms/admin/catio.sqlscriptcreatesasample_ioprocedureandtabletogathertherequiredinformation.After
executingtheprocedure,onecandoasimpleSELECT*FROMio_per_objecttoextracttherequiredinformation.Formoredetails,
lookattheheadercommentsinthe$ORACLE_HOME/rdbms/admin/catio.sqlscript.

Myquerywasfinelastweekandnowitisslow.Why?(forDBA)
Thelikelycauseofthisisbecausetheexecutionplanhaschanged.Generateacurrentexplainplanoftheoffendingqueryand
compareittoapreviousonethatwastakenwhenthequerywasperformingwell.Usuallythepreviousplanisnotavailable.
Somefactorsthatcancauseaplantochangeare:
.Whichtablesarecurrentlyanalyzed?Weretheypreviouslyanalyzed?(ie.WasthequeryusingRBOandnowCBO?)
.HasOPTIMIZER_MODEbeenchangedinINIT.ORA?
.HastheDEGREEofparallelismbeendefined/changedonanytable?
.Havethetablesbeenreanalyzed?Werethetablesanalyzedusingestimateorcompute?Ifestimate,whatpercentagewasused?
.Havethestatisticschanged?
.HastheINIT.ORAparameterDB_FILE_MULTIBLOCK_READ_COUNTbeenchanged?
.HastheINIT.ORAparameterSORT_AREA_SIZEbeenchanged?
.HaveanyotherINIT.ORAparametersbeenchanged?
.Whatdoyouthinktheplanshouldbe?Runthequerywithhintstoseeifthisproducestherequiredperformance.
WhyisOraclenotusingthedamnindex?
ThisproblemnormallyonlyariseswhenthequeryplanisbeinggeneratedbytheCostBasedOptimizer.Theusualcauseisbecause
theCBOcalculatesthatexecutingaFullTableScanwouldbefasterthanaccessingthetableviatheindex.
Fundamentalthingsthatcanbecheckedare:
.USER_TAB_COLUMNS.NUM_DISTINCTThiscolumndefinesthenumberofdistinctvaluesthecolumnholds.
.USER_TABLES.NUM_ROWSIfNUM_DISTINCT=NUM_ROWSthenusinganindexwouldbepreferabletodoingaFULLTABLE
SCAN.AstheNUM_DISTINCTdecreases,thecostofusinganindexincreasetherebyismakingtheindexlessdesirable.
.USER_INDEXES.CLUSTERING_FACTORThisdefineshoworderedtherowsareintheindex.IfCLUSTERING_FACTOR
approachesthenumberofblocksinthetable,therowsareordered.Ifitapproachesthenumberofrowsinthetable,therowsare
randomlyordered.Insuchacase,itisunlikelythatindexentriesinthesameleafblockwillpointtorowsinthesamedatablocks.
.DecreasetheINIT.ORAparameterDB_FILE_MULTIBLOCK_READ_COUNTAhighervaluewillmakethecostofaFULLTABLE
SCANcheaper.
.RememberthatyouMUSTsupplytheleadingcolumnofanindex,fortheindextobeused(unlessyouuseaFASTFULLSCANor
SKIPSCANNING).
.Therearemanyotherfactorsthataffectthecost,butsometimestheabovecanhelptoshowwhyanindexisnotbeingusedbythe
CBO.Iffromcheckingtheaboveyoustillfeelthatthequeryshouldbeusinganindex,tryspecifyinganindexhint.Obtainanexplain
planofthequeryeitherusingTKPROFwithTIMED_STATISTICS,sothatonecanseetheCPUutilization,orwithAUTOTRACEto
seethestatistics.Comparethistotheexplainplanwhennotusinganindex.
Whenshouldonerebuildanindex?
YoucanruntheANALYZEINDEXVALIDATESTRUCTUREcommandontheaffectedindexeseachinvocationofthiscommand
createsasinglerowintheINDEX_STATSview.ThisrowisoverwrittenbythenextANALYZEINDEXcommand,socopythecontents
oftheviewintoalocaltableaftereachANALYZE.ThebadnessoftheindexcanthenbejudgedbytheratioofDEL_LF_ROWSto
LF_ROWS.
Whataretheunrestrictedproceduresusedtochangethepopupscreenpositionduringruntime?
Anchorview
ResizeView
MoveView.
WhatisanAlert?
Analertiswindowthatappearsinthemiddleofthescreenoverlayingaportionofthecurrentdisplay.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

64/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Deletingapageremovesinformationaboutallthefieldsinthatpage?
a.True.b.False
a.True.
Twopopuppagescanappearonthescreenatatime?Twopopuppagescanappearonthescreenatatime?
a.True.b.False?
a.True.
Classifytherestrictedandunrestrictedprocedurefromthefollowing.
a.Call
b.UserExit
c.CallQuery
d.Up
e.ExecuteQuery
f.Message
g.ExitFrom
h.Post
i.Break?

a.Callunrestricted
b.UserExitUnrestricted
c.Call_queryUnrestricted
d.UpRestricted
e.ExecuteQueryRestricted
f.MessageRestricted
g.Exit_formRestricted
h.PostRestricted
i.BreakUnrestricted.
WhatisanUserExits?
Auserexitisasubroutinewhicharewritteninprogramminglanguagesusingpro*Cpro*Cobol,etc.,thatlinkintotheSQL*forms
executable.
WhatisaTrigger?
ApieceoflogicthatisexecutedatortriggeredbyaSQL*formsevent.
WhatisaPackageProcedure?
APackageprocedureisbuiltinPL/SQLprocedure.
Whatisthemaximumsizeofaform?
255characterwidthand255charactersLength.
Whatisthedifferencebetweensystem.current_fieldandsystem.cursor_field?
1.System.current_fieldgivesnameofthefield.
2.System.cursor_fieldgivesnameofthefieldwithblockname.
ListthesystemvariablesrelatedinBlockandField?
1.System.block_status
2.System.current_block
3.System.current_field
4.System.current_value
5.System.cursor_block
6.System.cursor_field
7.System.field_status.
WhatarethedifferenttypesofPackageProcedure?
1.Restrictedpackageprocedure.
2.Unrestrictedpackageprocedure.
WhatarethetypesofTRIGGERS?
1.NavigationalTriggers.
2.TransactionTriggers.
Identifypackagefunctionfromthefollowing?
1.ErrorCode
2.Break
3.Call
4.Errortext
5.Formfailure
6.Formfatal
7.Executequery
8.AnchorView
9.Message_code?

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

65/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
1.Error_Code
2.Error_Text
3.Form_Failure
4.Form_Fatal
5.Message_Code
Canyouattachanlovtoafieldatruntime?ifyes,givethebuildinname.?
Yes.Set_item_proprety
Isitpossibletoattachsamelibrarytomorethanoneform?
Yes
Canyouattachanlovtoafieldatdesigntime?
Yes
ListthewindowseventtriggersavailableinForms4.0?
Whenwindowactivated,
whenwindowclosed,
whenwindowdeactivated,
whenwindowresized
Whatarethetriggersassociatedwiththeimageitem?
WhenImageactivated(FireswhentheoperatordoubleclicksonanimageItems)
Whenimagepressed(fireswhentheoperatorselectsordeselectstheimageitem)
Whatisavisualattribute?
VisualAttributesarethefont,colorandpatterncharacteristicsofobjectsthatoperatorsseeandintractwithinourapplication.
Howmanymaximumnumberofradiobuttonscanyouassigntoaradiogroup?
Unlimitednoofradiobuttonscanbeassignedtoaradiogroup
Howdoyoupasstheparametersfromoneformtoanotherform?Topassoneormoreparameterstoacalledform,thecallingform
mustperformthefollowingstepsinatriggerorusernamedroutineexecutethecreate_parameter_listbuiltinfunctionto
programmatically.Createaparameterlisttoexecutetheaddparameterbuiltinproceduretoaddoneormoreparameterslist.
Executethecall_form,New_formorrun_productbuilt_inprocedureandincludethenameoridoftheparameterlisttobepassedto
thecalledform.
WhatisaLayoutEditor?
TheLayoutEditorisagraphicaldesignfacilityforcreatingandarrangingitemsandboilerplatetextandgraphicsobjectsinyour
applicationsinterface.
ListtheTypesofItems?
Textitem.
Chartitem.
Checkbox.
Displayitem.
Imageitem.
Listitem.
RadioGroup.
UserAreaitem.
Listsystemvariablesavailableinforms4.0,andnotavailableinforms3.0?
System.cordination_operation
SystemDate_threshold
System.effective_Date
System.event_window
System.suppress_working
Whatarethedisplaystylesofanalert?
Stop,Caution,note
Whatbuiltinisusedforshowingthealertduringruntime?
Show_alert.
Whatbuiltinisusedforchangingthepropertiesofthewindowdynamically?
Set_window_property
CanvasView
Whatarethedifferenttypesofwindows?
Rootwindow,secondarywindow.
Whatisapredefinedexceptionavailableinforms4.0?
Raiseform_trigger_failure
WhatisaradioGroup?
RadiogroupsdisplayafixednoofoptionsthataremutuallyExclusive.Usercanselectoneoutofnnumberofoptions.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

66/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatarethedifferenttypeofarecordgroup?
Queryrecordgroup
Staticrecordgroup
Nonqueryrecordgroup
Whatarethemenuitemsthatoracleforms4.0supports?
Plain,Check,Radio,Separator,Magic
Givetheequivalentterminforms4.0forthefollowing.Page,Page0?
PageCanvasView
Page0Canvasviewnull.
Whattriggersareassociatedwiththeradiogroup?
Onlywhenradiochangedtriggerassociatedwithradiogroup
VisualAttributes.
Whatarethetriggersassociatedwithacheckbox?
OnlyWhencheckboxactivatedTriggerassociatedwithaCheckbox.
Canyouattachanalerttoafield?
No
Canarootwindowbemademodal?
No
Whatisalistitem?
Itisalistoftextelements.
Listsomebuiltinroutinesusedtomanipulateimagesinimage_item?
Image_add
Image_and
Image_subtract
Image_xor
Image_zoom
Canyouchangethealertmessagesatruntime?
Ifyes,givethenameofthebuiltintochangethealertmessagesatruntime.Yes.Set_alert_property.
Whatisthebuiltinusedtogetandsetlovpropertiesduringruntime?
Get_lov_property
Set_lov_property
RecordGroup
Whatisthebuiltinroutineusedtocountthenoofrowsinagroup?
Get_group_row_count
SystemVariables
GivetheTypesofmodulesinaform?
Form
Menu
Library
WritetheAbbreviationforthefollowingFileExtension1.FMB2.MMB3.PLL?
FMBFormModuleBinary.
MMBMenuModuleBinary.
PLLPL/SQLLibraryModuleBinary.
Listthebuiltinroutineforcontrollingwindowduringruntime?
Find_window,
get_window_property,
hide_window,
move_window,
resize_window,
set_window_property,
show_View
Listthebuiltinroutineforcontrollingwindowduringruntime?
Find_canvas
GetCanvas_property
Get_view_property
Hide_View
Replace_content_view
Scroll_view
Set_canvas_property
Set_view_property
Show_view
Alert

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

67/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisthebuiltinfunctionusedforfindingthealert?
Find_alert
Editors
Listtheeditorsavailablesinforms4.0?
Defaulteditor
User_definededitors
systemeditors.
Whatbuilinroutinesareusedtodisplayeditordynamically?
Edit_textitem
show_editor
LOV
WhatisanLov?Alistofvaluesisasingleormulticolumnselectionlistdisplayedinapopupwindow
WhatisarecordGroup?
Arecordgroupisaninternaloracleformsdatastructurethathasasimilarcolumn/rowframeworktoadatabasetable
Givebuiltinroutinerelatedtoarecordgroups?
Create_group(Function)
Create_group_from_query(Function)
Delete_group(Procedure)
Add_group_column(Function)
Add_group_row(Procedure)
Delete_group_row(Procedure)
Populate_group(Function)
Populate_group_with_query(Function)
Set_group_Char_cell(procedure)
Listthebuiltinroutinesforthecontrollingcanvasviewsduringruntime?
Find_canvas
GetCanvas_property
Get_view_property
Hide_View
Replace_content_view
Scroll_view
Set_canvas_property
Set_view_property
Show_view
Alert
System.effective_datesystemvariableisreadonlyTrue/False?
False
Whatarethebuilt_inusedtotrappingerrorsinforms4?
Error_typereturncharacter
Error_codereturnnumber
Error_textreturnchar
Dbms_error_codereturnno.
Dbms_error_textreturnchar
WhatisOracleFinancials?
OracleFinancialsproductsprovideorganizationswithsolutionstoawiderangeoflongandshorttermaccountingsystemissues.
Regardlessofthesizeofthebusiness,OracleFinancialscanmeetaccountingmanagementdemandswith:
OracleAssets:Ensuresthatanorganizationspropertyandequipmentinvestmentisaccurateandthatthecorrectassettax
accountingstrategiesarechosen.
OracleGeneralLedger:Offersacompletesolutiontojournalentry,budgeting,allocations,consolidation,andfinancialreporting
needs.
OracleInventory:Helpsanorganizationmakebetterinventorydecisionsbyminimizingstockandmaximizingcashflow.
OracleOrderEntry:Providesorganizationswithasophisticatedorderentrysystemformanagingcustomercommitments.
OraclePayables:Letsanorganizationprocessmoreinvoiceswithfewerstaffmembersandtightercontrols.Helpssavemoney
throughmaximumdiscounts,bankfloat,andpreventionofduplicatepayment.
OraclePersonnel:Improvesthemanagementofemployeerelatedissuesbyretainingandmakingavailableeveryformofpersonnel
data.
OraclePurchasing:Improvesbuyingpower,helpsnegotiatebiggerdiscounts,eliminatespaperflow,increasesfinancialcontrols,and
increasesproductivity.
OracleReceivables:.Improvescashflowbylettinganorganizationprocessmorepaymentsfaster,withoutofflineresearch.Helps
correctlyaccountforcash,reduceoutstandingreceivables,andimprovecollectioneffectiveness.
OracleRevenueAccountingGivesanorganizationtimelyandaccuraterevenueandflexiblecommissionsreporting.
OracleSalesAnalysis:Allowsforbetterforecasting,planning.andreportingofsalesinformation.
Whatarethedesignfacilitiesavailableinforms4.0?
DefaultBlockfacility.
LayoutEditor.
MenuEditor.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

68/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
ObjectLists.
PropertySheets.
PL/SQLEditor.
TablesColumnsBrowser.
BuiltinsBrowser.
WhatisthemostimportantmoduleinOracleFinancials?
TheGeneralLedger(GL)moduleisthebasisforallotherOracleFinancialmodules.Allothermodulesprovideinformationtoit.Ifyou
implementOracleFinancials,youshouldswitchyourcurrentGLsystemfirst.GL isrelativelyeasytoimplement.Youshouldgolive
withitfirsttogiveyourimplementationteamachancetobefamiliarwithOracleFinancials.
Whatarethetypesofcanvasviews?
ContentView,StackedView.
WhatistheMultiOrgandwhatisitusedfor?(forDBA)
MultiOrgorMultipleOrganizationsArchitectureallowsmultipleoperatingunitsandtheirrelationshipstobedefinedwithinasingle
installationofOracleApplications.Thiskeepseachoperatingunitstransactiondataseparateandsecure.
UsethefollowingquerytodetermineifMuliOrgisintalled:
selectmulti_org_flagfromfnd_product_groups
WhatisthedifferencebetweenFieldsandFlexFields?(forDBA)
Afieldisapositiononaformthatoneusestoenter,view,update,ordeleteinformation.Afieldpromptdescribeseachfieldbytelling
whatkindofinformationappearsinthefield,oralternatively,whatkindofinformationshouldbeenteredinthefield.
AflexfieldisanOracleApplicationsfieldmadeupofsegments.Eachsegmenthasanassignednameandasetofvalidvalues.
OracleApplicationsusesflexfieldstocaptureinformationaboutyourorganization.Therearetwotypesofflexfields:keyflexfieldsand
descriptiveflexfields.
ExplaintypesofBlockinforms4.0?
BasetableBlocks.
ControlBlocks.
1.Abasetableblockisonethatisassociatedwithaspecificdatabasetableorview.
2.Acontrolblockisablockthatisnotassociatedwithadatabasetable.ITEMS
WhatisanAlert?
Analertisamodalwindowthatdisplaysamessagenotifiestheoperatorofsomeapplicationcondition
Whatarethebuiltinroutinesisavailableinforms4.0tocreateandmanipulateaparameterlist?
Add_parameter
Create_Parameter_list
Delete_parameter
Destroy_parameter_list
Get_parameter_attr
Get_parameter_list
set_parameter_attr
WhatisarecordGroup?
Arecordgroupisaninternaloracleformsdatastructurethathasasimilarcolumn/rowframeworktoadatabasetable
WhatisaNavigableitem?
Anavigableitemisonethatoperatorscannavigatetowiththekeyboardduringdefaultnavigation,orthatOracleformscannavigate
tobyexecutinganavigationalbuiltinprocedure.
WhatisalibraryinForms4.0?
AlibraryisacollectionofPl/SQLprogramunits,includingusernamedprocedures,functions&packages
Howimage_itemscanbepopulatetofieldinforms4.0?
AfetchfromalongrawdatabasecolumnPL/Sqlassignmenttoexecutingtheread_image_filebuilt_inproceduretogetanimage
fromthefilesystem.
Whatisthecontentviewandstackedview?
AcontentviewistheBaseviewthatoccupiestheentirecontentpaneofthewindowinwhichitisdisplayed.Astackedviewdiffers
fromacontentcanvasviewinthatitisnotthebaseviewforthewindowtowhichitisassigned
WhatisaCheckBox?ACheckBoxisatwostatecontrolthatindicateswhetheracertainconditionorvalueisonoroff,trueorfalse.
Thedisplaystateofacheckboxisalwayseithercheckedorunchecked.
Whatisacanvasview?
Acanvasviewisthebackgroundobjectonwhichyoulayouttheinterfaceitems(textitems,checkboxes,radiogroups,andsoon.)
andboilerplateobjectsthatoperatorsseeandinteractwithastheyrunyourform.Atruntime,operatorscanseeonlythoseitems
thathavebeenassignedtoaspecificcanvas.Eachcanvas,interm,mustbedisplayedinaspecificwindow.
Explainthefollowingfileextensionrelatedtolibrary?
.pll,.lib,.pld
Thelibrarypllfilesisaportabledesignfilecomparabletoanfmbformfile
Thelibrarylibfileisaplatformspecific,generatedlibraryfilecomparabletoafmxformfile
ThepldfileisTxtformatfileandcanbeusedforsourcecontrollingyourlibraryfilesParameter

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

69/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
ExplaintheusageofWHERECURRENTOFclauseincursors?
WHERECURRENTOFclauseinanUPDATE,DELETEstatementreferstothelatestrowfetchedfromacursor.DatabaseTriggers
NamethetableswherecharacteristicsofPackage,procedureandfunctionsarestored?
User_objects,User_SourceandUser_error.
ExplainthetwotypeofCursors?
Therearetwotypesofcursors,ImplicitCursorandExplicitCursor.PL/SQLusesImplicitCursorsforqueries.Userdefinedcursors
arecalledExplicitCursors.Theycanbedeclaredandused.
Whataretwopartsofpackage?
ThetwopartsofpackagearePACKAGESPECIFICATION&PACKAGEBODY.PackageSpecificationcontainsdeclarationsthatare
globaltothepackagesandlocaltotheschema.PackageBodycontainsactualproceduresandlocaldeclarationoftheprocedures
andcursordeclarations.
Whataretwovirtualtablesavailableduringdatabasetriggerexecution?
ThetablecolumnsarereferredasOLD.column_nameandNEW.column_name.
FortriggersrelatedtoINSERTonlyNEW.column_namevaluesonlyavailable.
FortriggersrelatedtoUPDATEonlyOLD.column_nameNEW.column_namevaluesonlyavailable.
FortriggersrelatedtoDELETEonlyOLD.column_namevaluesonlyavailable.
WhatisFineGrainedAuditing?
FineGrainedAuditing(DBMS_FGA)allowsauditingrecordstobegeneratedwhencertainrowsareselectedfromatable.Alistof
definedpoliciescanbeobtainedfromDBA_AUDIT_POLICIES.AuditrecordsarestoredinDBA_FGA_AUDIT_TRAIL.Lookatthis
example:
Addpolicyontablewithautitingcondition

executedbms_fga.add_policy(HR,EMP,policy1,deptno>10)
MustANALYZE,thisfeatureworkswithCBO(CostBasedOptimizer)

analyzetableEMPcomputestatistics
select*fromEMPwherec1=11Willtriggerauditing
select*fromEMPwherec1=09Noauditing
Nowwecanseethestatmentsthattriggeredtheauditingcondition

selectsqltextfromsys.fga_log$
deletefromsys.fga_log$
Whatisapackage?Whataretheadvantagesofpackages?WhatisPragmaEXECPTION_INIT?Explaintheusage?
ThePRAGMAEXECPTION_INITtellsthecompliertoassociateanexceptionwithanoracleerror.Togetanerrormessageofa
specificoracleerror.e.g.PRAGMAEXCEPTION_INIT(exceptionname,oracleerrornumber)
WhatisaVirtualPrivateDatabase?
Oracle8iintroducedthenotionofaVirtualPrivateDatabase(VPD).AVPDoffersFineGrainedAccessControl(FGAC)forsecure
separationofdata.Thisensuresthatusersonlyhaveaccesstodatathatpertainstothem.Usingthisoption,onecouldevenstore
multiplecompaniesdatawithinthesameschema,withoutthemknowingaboutit.VPDconfigurationisdoneviatheDBMS_RLS(Row
LevelSecurity)package.SelectfromSYS.V$VPD_POLICYtoseeexistingVPDconfiguration.
WhatisRaise_application_error?
Raise_application_errorisaprocedureofpackageDBMS_STANDARDwhichallowstoissueanuser_definederrormessagesfrom
storedsubprogramordatabasetrigger.
WhatisOracleLabelSecurity?
OracleLabelSecurity(formerlycalledTrustedOracleMLSRDBMS)usestheVPD(VirtualPrivateDatabase)featureofOracle8ito
implementrowlevelsecurity.Accesstorowsarerestrictedaccordingtoauserssecuritysensitivitytagorlabel.OracleLabelSecurity
isconfigured,controlledandmanagedfromthePolicyManager,anEnterpriseManagerbasedGUIutility.
Givethestructureoftheprocedure?
PROCEDUREname(parameterlist..)
is
localvariabledeclarations
BEGIN
Executablestatements.
Exception.
exceptionhandlers
end
WhatisOEM(OracleEnterpriseManager)?(forDBA)
OEMisasetofsystemsmanagementtoolsprovidedbyOracleCorporationformanagingtheOracleenvironment.Itprovidestoolsto
monitortheOracleenvironmentandautomatetasks(bothonetimeandrepetitiveinnature)totakedatabaseadministrationastep
closertoLightsOutmanagement.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

70/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatisPL/SQL?
PL/SQLisaprocedurallanguagethathasbothinteractiveSQLandproceduralprogramminglanguageconstructssuchasiteration,
conditionalbranching.
WhatarethecomponentsofOEM?(forDBA)
OracleEnterpriseManager(OEM)hasthefollowingcomponents:
.ManagementServer(OMS):Middletierserverthathandlescommunicationwiththeintelligentagents.TheOEMConsoleconnects
tothemanagementservertomonitorandconfiguretheOracleenterprise.
.Console:Thisisagraphicalinterfacefromwhereonecanschedulejobs,events,andmonitorthedatabase.Theconsolecanbe
openedfromaWindowsworkstation,UnixXTerm(oemappcommand)orWebbrowsersession(oem_webstage).
.IntelligentAgent(OIA):TheOIArunsonthetargetdatabaseandtakescareoftheexecutionofjobsandeventsscheduledthrough
theConsole.
WhathappensifaprocedurethatupdatesacolumnoftableXiscalledinadatabasetriggerofthesametable?
Mutationoftableoccurs.
IsitpossibletouseTransactioncontrolStatementssuchaROLLBACKorCOMMITinDatabaseTrigger?Why?
Itisnotpossible.Astriggersaredefinedforeachtable,ifyouuseCOMMITofROLLBACKinatrigger,itaffectslogicaltransaction
processing.
Howmanytypesofdatabasetriggerscanbespecifiedonatable?Whatarethey?
InsertUpdateDelete
BeforeRowo.k.o.k.o.k.
AfterRowo.k.o.k.o.k.
BeforeStatemento.k.o.k.o.k.
AfterStatemento.k.o.k.o.k.
IfFOREACHROWclauseisspecified,thenthetriggerforeachRowaffectedbythestatement.
IfWHENclauseisspecified,thetriggerfiresaccordingtothereturnedBooleanvalue.
Whatarethemodesofparametersthatcanbepassedtoaprocedure?
IN,OUT,INOUTparameters.
WherethePre_defined_exceptionsarestored?
Inthestandardpackage.
Procedures,Functions&Packages
Writetheorderofprecedenceforvalidationofacolumninatable?
I.doneusingDatabasetriggers.
ii.doneusingIntegarityConstraints.?
I&ii.
Givethestructureofthefunction?
FUNCTIONname(argumentlist..)Returndatatypeis
localvariabledeclarations
Begin
executablestatements
Exception
executionhandlers
End
ExplainhowproceduresandfunctionsarecalledinaPL/SQLblock?
Functioniscalledaspartofanexpression.
sal:=calculate_sal(a822)
procedureiscalledasaPL/SQLstatement
calculate_bonus(A822)
WhatareadvantagesfoStoredProcedures?
Extensibility,Modularity,Reusability,Maintainabilityandonetimecompilation.
WhatisanException?WhataretypesofException?
ExceptionistheerrorhandlingpartofPL/SQLblock.ThetypesarePredefinedanduserdefined.SomeofPredefinedexceptionsare.
CURSOR_ALREADY_OPEN
DUP_VAL_ON_INDEX
NO_DATA_FOUND
TOO_MANY_ROWS
INVALID_CURSOR
INVALID_NUMBER
LOGON_DENIED
NOT_LOGGED_ON
PROGRAMERROR
STORAGE_ERROR
TIMEOUT_ON_RESOURCE
VALUE_ERROR
ZERO_DIVIDE
OTHERS.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

71/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatarethePL/SQLStatementsusedincursorprocessing?DECLARECURSORname,OPENcursorname,FETCHcursorname
INTOorRecordtypes,CLOSEcursorname.
WhatarethecomponentsofaPL/SQLBlock?
Declarativepart,ExecutablepartandExceptionpart.
DatatypesPL/SQL
Whatisadatabasetrigger?Namesomeusagesofdatabasetrigger?
DatabasetriggerisstoredPL/SQLprogramunitassociatedwithaspecificdatabasetable.UsagesareAuditdatamodifications,Log
eventstransparently,EnforcecomplexbusinessrulesDerivecolumnvaluesautomatically,Implementcomplexsecurity
authorizations.Maintainreplicatetables.
Whatisacursor?WhyCursorisrequired?
CursorisanamedprivateSQLareafromwhereinformationcanbeaccessed.Cursorsarerequiredtoprocessrowsindividuallyfor
queriesreturningmultiplerows.
Whatisacursorforloop?
Cursorforloopimplicitlydeclares%ROWTYPEasloopindex,opensacursor,fetchesrowsofvaluesfromactivesetintofieldsinthe
recordandcloseswhenalltherecordshavebeenprocessed.
e.g..FORemp_recINC1LOOP
salary_total:=salary_total+emp_recsal
ENDLOOP
Whatwillhappenaftercommitstatement?
CursorC1is
Selectempno,
enamefromemp
Begin
openC1loop
FetchC1into
eno.ename
ExitWhen
C1%notfound
commit
endloop
end
ThecursorhavingqueryasSELECT.FORUPDATEgetsclosedafterCOMMIT/ROLLBACK.
ThecursorhavingqueryasSELECT.doesnotgetclosedevenafterCOMMIT/ROLLBACK.
Howpackagedproceduresandfunctionsarecalledfromthefollowing?
a.Storedprocedureoranonymousblock
b.anapplicationprogramsuchaPRC*C,PRO*COBOL
c.SQL*PLUS??

a.PACKAGENAME.PROCEDURENAME(parameters)
variable:=PACKAGENAME.FUNCTIONNAME(arguments)
EXECSQLEXECUTE
b.BEGIN
PACKAGENAME.PROCEDURENAME(parameters)
variable:=PACKAGENAME.FUNCTIONNAME(arguments)
END
ENDEXEC
c.EXECUTEPACKAGENAME.PROCEDUREiftheproceduresdoesnothaveanyout/inoutparameters.Afunctioncannotbe
called.
Whatisastoredprocedure?
Astoredprocedureisasequenceofstatementsthatperformspecificfunction.
WhatarethecomponentsofaPL/SQLblock?
Asetofrelateddeclarationsandproceduralstatementsiscalledblock.
WhatisdifferencebetweenaPROCEDURE&FUNCTION?
AFUNCTIONisalwaysreturnsavalueusingthereturnstatement.
APROCEDUREmayreturnoneormorevaluesthroughparametersormaynotreturnatall.
WhatisdifferencebetweenaCursordeclaredinaprocedureandCursordeclaredinapackagespecification?

Acursordeclaredinapackagespecificationisglobalandcanbeaccessedbyotherproceduresorproceduresinapackage.
Acursordeclaredinaprocedureislocaltotheprocedurethatcannotbeaccessedbyotherprocedures.
WhatarethecursorattributesusedinPL/SQL?
%ISOPENtocheckwhethercursorisopenornot
%ROWCOUNTnumberofrowsfetched/updated/deleted.
%FOUNDtocheckwhethercursorhasfetchedanyrow.Trueifrowsarefetched.
%NOTFOUNDtocheckwhethercursorhasfetchedanyrow.Trueifnorowsarefeatched.
TheseattributesareproceededwithSQLforImplicitCursorsandwithCursornameforExplicitCursors.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

72/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatare%TYPEand%ROWTYPE?Whataretheadvantagesofusingtheseoverdatatypes?
%TYPEprovidesthedatatypeofavariableoradatabasecolumntothatvariable.
%ROWTYPEprovidestherecordtypethatrepresentsaentirerowofatableorvieworcolumnsselectedinthecursor.
Theadvantagesare:
I.Neednotknowaboutvariablesdatatype
ii.Ifthedatabasedefinitionofacolumninatablechanges,thedatatypeofavariablechangesaccordingly.
Whatisdifferencebetween%ROWTYPEandTYPERECORD?%ROWTYPEistobeusedwheneverqueryreturnsaentirerowof
atableorview.
TYPErecRECORDistobeusedwheneverqueryreturnscolumnsofdifferenttableorviewsandvariables.
E.g.TYPEr_empisRECORD(enoemp.empno %type,enameempename%type)
e_recemp%ROWTYPE
cursorc1isselectempno,deptnofromemp
e_recc1%ROWTYPE.
WhatarethedifferenttypesofPL/SQLprogramunitsthatcanbedefinedand
storedinORACLEdatabase?
ProceduresandFunctions,PackagesandDatabaseTriggers.
WhataretheadvantagesofhavingaPackage?
Increasedfunctionality(forexample,globalpackagevariablescanbedeclaredandusedbyanyproecdureinthepackage)and
performance(forexampleallobjectsofthepackageareparsedcompiled,andloadedintomemoryonce)
WhataretheusesofDatabaseTrigger?
Databasetriggerscanbeusedtoautomaticdatageneration,auditdatamodifications,enforcecomplexIntegrityconstraints,and
customizecomplexsecurityauthorizations.
WhatisaProcedure?
AProcedureconsistofasetofSQLandPL/SQLstatementsthataregroupedtogetherasaunittosolveaspecificproblemor
performasetofrelatedtasks.
WhatisaPackage?
APackageisacollectionofrelatedprocedures,functions,variablesandotherpackageconstructstogetherasaunitinthedatabase.
WhatisdifferencebetweenProceduresandFunctions?
AFunctionreturnsavaluetothecallerwhereasaProceduredoesnot.
WhatisDatabaseTrigger?
ADatabaseTriggerisprocedure(setofSQLandPL/SQLstatements)thatisautomaticallyexecutedasaresultofaninsertin,
updateto,ordeletefromatable.
Canthedefaultvaluesbeassignedtoactualparameters?
Yes
Canaprimarykeycontainmorethanonecolumns?
Yes
WhatisanUTL_FILE.Whataredifferentproceduresandfunctionsassociatedwithit?
UTL_FILEisapackagethataddstheabilitytoreadandwritetooperatingsystemfiles.ProceduresassociatedwithitareFCLOSE,
FCLOSE_ALLand5procedurestooutputdatatoafilePUT,PUT_LINE,NEW_LINE,PUTF,FFLUSH.PUT,
FFLUSH.PUT_LINE,FFLUSH.NEW_LINE.FunctionsassociatedwithitareFOPEN,ISOPEN.
WhatareORACLEPRECOMPILERS?
UsingORACLEPRECOMPILERS,SQLstatementsandPL/SQLblockscanbecontainedinside3GLprogramswrittenin
C,C++,COBOL,PASCAL,FORTRAN,PL/1ANDADA.ThePrecompilersareknownasPro*C,Pro*Cobol,ThisformofPL/SQLis
knownasembeddedpl/sql,thelanguageinwhichpl/sqlisembeddedisknownasthehostlanguage.Theprcompilertranslatesthe
embeddedSQLandpl/sqlstatementsintocallstotheprecompilerruntimelibrary.Theoutputmustbecompiledandlinkedwiththis
librarytocreatoranexecutable.
DifferentiatebetweenTRUNCATEandDELETE?
TRUNCATEdeletesmuchfasterthanDELETE
TRUNCATE
DELETE
ItisaDDLstatement
ItisaDMLstatement
Itisaonewaytrip,cannotROLLBACK
OnecanRollback
Doesnthaveselectivefeatures(whereclause)
Has
Doesntfiredatabasetriggers
Does
Itrequiresdisablingofreferentialconstraints.
Whatisdifferencebetweenaformalandanactualparameter?
Thevariablesdeclaredintheprocedureandwhicharepassed,asargumentsarecalledactual,theparametersintheprocedure
declaration.Actualparameterscontainthevaluesthatarepassedtoaprocedureandreceiveresults.Formalparametersarethe

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

73/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
placeholdersforthevaluesofactualparameters
Whatshouldbethereturntypeforacursorvariable.Canweuseascalardatatypeasreturntype?Thereturntypeforacursor
mustbearecordtype.Itcanbedeclaredexplicitlyasauserdefinedor%ROWTYPEcanbeused.egTYPEt_studentsrefISREF
CURSORRETURNstudents%ROWTYPE
WhataredifferentOracledatabaseobjects?
TABLES
VIEWS
INDEXES
SYNONYMS
SEQUENCES
TABLESPACESetc
WhatisdifferencebetweenSUBSTRandINSTR?
SUBSTRreturnsaspecifiedportionofastringegSUBSTR(BCDEF,4)outputBCDEINSTRprovidescharacterpositioninwhicha
patternisfoundinastring.egINSTR(ABCDCF,,2)output7(2ndoccurenceof)
DisplaythenumbervalueinWords?
SQL>selectsal,(to_char(to_date(sal,j),jsp))
fromemp
theoutputlike,
SAL(TO_CHAR(TO_DATE(SAL,J),JSP))

800eighthundred
1600onethousandsixhundred
1250onethousandtwohundredfifty
Ifyouwanttoaddsometextlike,Rs.ThreeThousandonly.
SQL>selectsalSalary,
(Rs.||(to_char(to_date(sal,j),Jsp))||only.))
SalinWordsfromemp
/
SalarySalinWords

800Rs.EightHundredonly.
1600Rs.OneThousandSixHundredonly.
1250Rs.OneThousandTwoHundredFiftyonly.
WhatisdifferencebetweenSQLandSQL*PLUS?
SQL*PLUSisacommandlinetoolwhereasSQLandPL/SQLlanguageinterfaceandreportingtool.Itsacommandlinetoolthat
allowsusertotypeSQLcommandstobeexecuteddirectlyagainstanOracledatabase.SQLisalanguageusedtoquerythe
relationaldatabase(DML,DCL,DDL).SQL*PLUScommandsareusedtoformatqueryresult,Setoptions,EditSQLcommandsand
PL/SQL.
WhatarevariousjoinsusedwhilewritingSUBQUERIES?
SelfjoinItsajoinforeignkeyofatablereferencesthesametable.OuterJoinItsajoinconditionusedwhereOnecanqueryallthe
rowsofoneofthetablesinthejoinconditioneventhoughtheydontsatisfythejoincondition.

EquijoinItsajoinconditionthatretrievesrowsfromoneormoretablesinwhichoneormorecolumnsinonetableareequaltoone
ormorecolumnsinthesecondtable.
WhataSELECTFORUPDATEcursorrepresent.?
SELECTFROMFORUPDATE[OFcolumnreference][NOWAIT]
Theprocessingdoneinafetchloopmodifiestherowsthathavebeenretrievedbythecursor.Aconvenientwayofmodifyingthe
rowsisdonebyamethodwithtwoparts:theFORUPDATEclauseinthecursordeclaration,WHERECURRENTOFCLAUSEinan
UPDATEordeclarationstatement.
Whatarevariousprivilegesthatausercangranttoanotheruser?
SELECT
CONNECT
RESOURCES
Displaytherecordsbetweentworange?
selectrownum,empno,enamefromempwhererowidin(selectrowidfromempwhererownum<=&uptominusselectrowidfrom
empwhererownum<&Start)
minvalue.sqlSelecttheNthlowestvaluefromatable?selectlevel,min(col_name)frommy_tablewherelevel=&nconnectby

prior(col_name)<col_name)
groupbylevel
Example:
Givenatablecalledempwiththefollowingcolumns:
idnumber
namevarchar2(20)
salnumber

Forthesecondlowestsalary:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

74/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
selectlevel,min(sal)fromemp
wherelevel=2
connectbypriorsal<sal
groupbylevel
WhatisdifferencebetweenRenameandAlias?
RenameisapermanentnamegiventoatableorcolumnwhereasAliasisatemporarynamegiventoatableorcolumnwhichdonot
existoncetheSQLstatementisexecuted.
Differencebetweenanimplicit&anexplicitcursor.?
onlyonerow.However,queriesthatreturnmorethanonerowyoumustdeclareanexplicitcursororuseacursorFORloop.Explicit
cursorisacursorinwhichthecursornameisexplicitlyassignedtoaSELECTstatementviatheCURSORISstatement.Animplicit
cursorisusedforallSQLstatementsDeclare,Open,Fetch,Close.AnexplicitcursorsareusedtoprocessmultirowSELECT
statementsAnimplicitcursorisusedtoprocessINSERT,UPDATE,DELETEandsinglerowSELECT..INTOstatements.
WhatisaOUTERJOIN?
OuterJoinItsajoinconditionusedwhereyoucanqueryalltherowsofoneofthetablesinthejoinconditioneventhoughtheydont
satisfythejoincondition.
Whatisacursor?
OracleusesworkareatoexecuteSQLstatementsandstoreprocessinginformationPL/SQLconstructcalledacursorletsyouname
aworkareaandaccessitsstoredinformationAcursorisamechanismusedtofetchmorethanonerowinaPl/SQlblock.
Whatisthepurposeofacluster?
Oracledoesnotallowausertospecificallylocatetables,sincethatisapartofthefunctionoftheRDBMS.However,forthepurpose
ofincreasingperformance,oracleallowsadevelopertocreateaCLUSTER.ACLUSTERprovidesameansforstoringdatafrom
differenttablestogetherforfasterretrievalthanifthetableplacementwerelefttotheRDBMS.
WhatisOCI.Whatareitsuses?
OracleCallInterfaceisamethodofaccesingdatabasefroma3GLprogram.UsesNoprecompilerisrequired,PL/SQLblocksare
executedlikeotherDMLstatements.
TheOCIlibraryprovides
functionstoparseSQLstatemets
bindinputvariables
bindoutputvariables
executestatements
fetchtheresults
Howyouopenandcloseacursorvariable.Whyitisrequired?
OPENcursorvariableFORSELECTStatement
CLOSEcursorvariableInordertoassociateacursorvariablewithaparticularSELECTstatementOPENsyntaxisused.Inorderto
freetheresourcesusedforthequeryCLOSEstatementisused.
DisplayOdd/Evennumberofrecords?
Oddnumberofrecords:
select*fromempwhere(rowid,1)in(selectrowid,mod(rownum,2)fromemp)
Output:
1
3
5
Evennumberofrecords:
select*fromempwhere(rowid,0)in(selectrowid,mod(rownum,2)fromemp)
Output:
2
4
6
WhatarevariousconstraintsusedinSQL?
NULL
NOTNULL
CHECK
DEFAULT
CancursorvariablesbestoredinPL/SQLtables.Ifyeshow.Ifnotwhy?
No,acursorvariablepointsarowwhichcannotbestoredinatwodimensionalPL/SQLtable.
DifferencebetweenNODATAFOUNDand%NOTFOUND?
NODATAFOUNDisanexceptionraisedonlyfortheSELECT.INTOstatementswhenthewhereclauseofthequerydoesnotmatch
anyrows.Whenthewhereclauseoftheexplicitcursordoesnotmatchanyrowsthe%NOTFOUNDattributeissettoTRUEinstead.
Canyouuseacommitstatementwithinadatabasetrigger?
No
WhatWHERECURRENTOFclausedoesinacursor?
LOOP
SELECTnum_creditsINTOv_numcreditsFROMclasses
WHEREdept=123andcourse=101

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

75/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
UPDATEstudents
FHKOSETcurrent_credits=current_credits+v_numcredits
WHERECURRENTOFX
Thereisastring120000120.125,howyouwillfindthepositionofthedecimalplace?
INSTR(120000120.125,1,.)
output13
Whataredifferentmodesofparametersusedinfunctionsandprocedures?
INOUTINOUT
HowyouwerepassingcursorvariablesinPL/SQL2.2?
InPL/SQL2.2cursorvariablescannotbedeclaredinapackage.Thisisbecausethestorageforacursorvariablehastobeallocated
usingPro*CorOCIwithversion2.2,theonlymeansofpassingacursorvariabletoaPL/SQLblockisviabindvariableoraprocedure
parameter.
WhendoyouuseWHEREclauseandwhendoyouuseHAVINGclause?
HAVINGclauseisusedwhenyouwanttospecifyaconditionforagroupfunctionanditiswrittenafterGROUPBYclause.The
WHEREclauseisusedwhenyouwanttospecifyaconditionforcolumns,singlerowfunctionsexceptgroupfunctionsanditiswritten
beforeGROUPBYclauseifitisused.
Differencebetweenprocedureandfunction.?
FunctionsarenamedPL/SQLblocksthatreturnavalueandcanbecalledwithargumentsprocedureanamedblockthatcanbe
calledwithparameter.AprocedureallisaPL/SQLstatementbyitself,whileaFunctioncalliscalledaspartofanexpression.
WhichismorefasterINorEXISTS?
EXISTSismorefasterthanINbecauseEXISTSreturnsaBooleanvaluewhereasINreturnsavalue.
Whatissyntaxfordroppingaprocedureandafunction.Aretheseoperationspossible?DropProcedureprocedure_name
DropFunctionfunction_name
Howwillyoudeleteduplicatingrowsfromabasetable?
deletefromtable_namewhererowidnotin(selectmax(rowid)fromtablegroupbyduplicate_values_field_name)ordelete
duplicate_values_field_namedvfromtable_nametawhererowid<(selectmin(rowid)fromtable_nametbwhereta.dv=tb.dv)
Differencebetweendatabasetriggersandformtriggers?
Databasetrigger(DBT)fireswhenaDMLoperationisperformedonadatabasetable.Formtrigger(FT)Fireswhenuserpressesa
keyornavigatesbetweenfieldsonthescreen
CanberowlevelorstatementlevelNodistinctionbetweenrowlevelandstatementlevel.
CanmanipulatedatastoredinOracletablesviaSQLCanmanipulatedatainOracletablesaswellasvariablesinforms.
CanbefiredfromanysessionexecutingthetriggeringDMLstatements.Canbefiredonlyfromtheformthatdefinethetrigger.
Cancauseotherdatabasetriggerstofire.Cancauseotherdatabasetriggerstofire,butnototherformtriggers.
Whatisacursorforloop?
CursorForLoopisaloopwhereoracleimplicitlydeclaresaloopvariable,theloopindexthatofthesamerecordtypeasthecursors
record.
Howyouwillavoidduplicatingrecordsinaquery?
ByusingDISTINCT
Whatisaview?
Aviewisstoredprocedurebasedononeormoretables,itsavirtualtable.
WhatisdifferencebetweenUNIQUEandPRIMARYKEYconstraints?
AtablecanhaveonlyonePRIMARYKEYwhereastherecanbeanynumberofUNIQUEkeys.ThecolumnsthatcomposePKare
automaticallydefineNOTNULL,whereasacolumnthatcomposeaUNIQUEisnotautomaticallydefinedtobemandatorymustalso
specifythecolumnisNOTNULL.
Whatisuseofacursorvariable?Howitisdefined?
Acursorvariableisassociatedwithdifferentstatementsatruntime,whichcanholddifferentvaluesatruntime.Staticcursorscan
onlybeassociatedwithoneruntimequery.Acursorvariableisreferencetype(likeapointerinC).
Declaringacursorvariable:
TYPEtype_nameISREFCURSORRETURNreturn_typetype_nameisthenameofthereferencetype,return_typeisarecordtype
indicatingthetypesoftheselectlistthatwilleventuallybereturnedbythecursorvariable.
HowdoyoufindthenumbertofrowsinaTable?
Abadansweriscountthem(SELECTCOUNT(*)FROMtable_name)
Agoodansweris:
BygeneratingSQLtoANALYZETABLEtable_nameCOUNTSTATISTICSbyqueryingOracleSystemCatalogues(e.g.
USER_TABLESorALL_TABLES).
ThebestansweristorefertotheutilitywhichOraclereleasedwhichmakesitunnecessarytodoANALYZETABLEforeachTable
individually.
WhatisthemaximumbuffersizethatcanbespecifiedusingtheDBMS_OUTPUT.ENABLEfunction?
1,000,00

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

76/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatarecursorattributes?
%ROWCOUNT
%NOTFOUND
%FOUND
%ISOPEN
Thereisa%signinonefieldofacolumn.Whatwillbethequerytofindit?
Shouldbeusedbefore%.
WhatisONDELETECASCADE?
WhenONDELETECASCADEisspecifiedORACLEmaintainsreferentialintegritybyautomaticallyremovingdependentforeignkey
valuesifareferencedprimaryoruniquekeyvalueisremoved.
Whatisthefastestwayofaccessingarowinatable?
UsingROWID.CONSTRAINTS
WhatisdifferencebetweenTRUNCATE&DELETE?
TRUNCATEcommitsafterdeletingentiretablei.e.,cannotberolledback.DatabasetriggersdonotfireonTRUNCATEDELETE
allowsthefiltereddeletion.Deletedrecordscanberolledbackorcommitted.DatabasetriggersfireonDELETE.
Whatisatransaction?
Transactionislogicalunitbetweentwocommitsandcommitandrollback.
WhataretheadvantagesofVIEW?Toprotectsomeofthecolumnsofatablefromotherusers.To hidecomplexityofaquery.To
hidecomplexityofcalculations.
Howwillyouaactivate/deactivateintegrityconstraints?
TheintegrityconstraintscanbeenabledordisabledbyALTERTABLEENABLEconstraint/DISABLEconstraint.
WheretheintegrityconstraintsarestoredinDataDictionary?
TheintegrityconstraintsarestoredinUSER_CONSTRAINTS.
WhatistheSubquery?
Subqueryisaquerywhosereturnvaluesareusedinfilteringconditionsofthemainquery.
Howtoaccessthecurrentvalueandnextvaluefromasequence?Isitpossibletoaccessthecurrentvalueinasessionbefore
accessingnextvalue?
SequencenameCURRVAL,SequencenameNEXTVAL.Itisnotpossible.Onlyifyouaccessnextvalueinthesession,currentvalue
canbeaccessed.
WhataretheusageofSAVEPOINTS?valueinasessionbeforeaccessingnextvalue?
SAVEPOINTSareusedtosubdivideatransactionintosmallerparts.Itenablesrollingbackpartofatransaction.Maximumoffive
savepointsareallowed.
WhatisROWID?inasessionbeforeaccessingnextvalue?
ROWIDisapseudocolumnattachedtoeachrowofatable.Itis18characterlong,blockno,rownumberarethecomponentsof
ROWID.
ExplainConnectbyPrior?inasessionbeforeaccessingnextvalue?
Retrievesrowsinhierarchicalorder.e.g.selectempno,enamefromempwhere.
HowmanyLONGcolumnsareallowedinatable?IsitpossibletouseLONGcolumnsinWHEREclauseorORDERBY?
OnlyoneLONGcolumnsisallowed.ItisnotpossibletouseLONGcolumninWHEREorORDERBYclause.
WhatisReferentialIntegrity?
Maintainingdataintegritythroughasetofrulesthatrestrictthevaluesofoneormorecolumnsofthetablesbasedonthevaluesof
primarykeyoruniquekeyofthereferencedtable.
Whatisajoin?Explainthedifferenttypesofjoins?
Joinisaquerywhichretrievesrelatedcolumnsorrowsfrommultipletables.SelfJoinJoiningthetablewithitself.EquiJoinJoining
twotablesbyequatingtwocommoncolumns.NonEquiJoinJoiningtwotablesbyequatingtwocommoncolumns.Outer Join
Joiningtwotablesinsuchawaythatquerycanalsoretrieverowsthatdonothavecorrespondingjoinvalueintheothertable.
IfanuniquekeyconstraintonDATEcolumniscreated,willitvalidatetherowsthatareinsertedwithSYSDATE?
Itwont,BecauseSYSDATEformatcontainstimeattachedwithit.
HowdoesonestopandstarttheOMS?(forDBA) UsethefollowingcommandsequencetostopandstarttheOMS(Oracle
ManagementServer):
oemctlstartoms
oemctlstatusomssysman/oem_temp
oemctlstopomssysman/oem_temp
WindowsNT/2000userscanjuststopandstarttherequiredservices.ThedefaultOEMadministratorissysmanwithapasswordof
oem_temp.
NOTE:UsecommandoemctrlinsteadofoemctlforOracle8iandbelow.
WhatisanIntegrityConstraint?
Integrityconstraintisarulethatrestrictsvaluestoacolumninatable.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

77/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Howdoesonecreatearepository?(forDBA)
ForOEMv2andabove,starttheOracleEnterpriseManagerConfigurationAssistant(emcaonUnix)tocreateandconfigurethe
managementserverandrepository.Remembertosetupabackupfortherepositorydatabaseaftercreatingit.
IfaViewonasinglebasetableismanipulatedwillthechangesbereflectedonthebasetable?
Ifchangesaremadetothetableswhicharebasetablesofaviewwillthechangesbereferenceontheview.

ThefollowingdescribesmeanstocreateaOEMV1.x(veryold!!!)repositoryonWindowsNT:
.Createatablespacethatwouldholdtherepositorydata.Asizebetween200250MBwouldbeideal.LetuscallitDummy_Space.
.CreateanOracleuserwhowouldownthisrepository.AssignDBA,SNMPAgent,Exp_Full_database,Imp_Full_databaserolesto
thisuser.LetscallthisuserDummy_user.AssignDummy_Spaceasthedefaulttablespace.
.CreateanoperatingsystemuserwiththesamenameastheOracleusername.I.e.Dummy_User.AddLogonasabatchjobunder
advancedrightsinUsermanager.
.FireupEnterprisemanagerandloginasDummy_Userandenterthepassword.Thiswouldtriggerthecreationoftherepository.
Fromnowon,Enterprisemanagerisreadytoacceptjobs.
Whatisadatabaselink?
DatabaseLinkisanamedpaththroughwhicharemotedatabasecanbeaccessed.
HowdoesonelistonesdatabasesintheOEMConsole?(forDBA)
FollowthesestepstodiscoverdatabasesandotherservicesfromtheOEMConsole:
1.EnsuretheGLOBAL_DBNAMEparameterissetforalldatabasesinyourLISTENER.ORAfile(optional).Thesenameswillbelisted
intheOEMConsole.Pleasenotethatnamesenteredarecasesensitive.Aportionofalistener.ora file:
(SID_DESC=
(GLOBAL_DBNAME=DB_name_for_OEM)
(SID_NAME=
2.StarttheOracleIntelligentAgentonthemachineyouwanttodiscover.SeesectionHowdoesonestarttheOracleIntelligent
Agent?.
3.StarttheOEMConsole,navigatetomenuNavigator/DiscoverNodes.TheOEMDiscoveryWizardwillguideyouthroughthe
processofdiscoveringyourdatabasesandotherservices.
WhatisCYCLE/NOCYCLEinaSequence?
CYCLEspecifiesthatthesequencecontinuestogeneratevaluesafterreachingeithermaximumorminimumvalue.Afterpan
ascendingsequencereachesitsmaximumvalue,itgeneratesitsminimumvalue.Afteradescendingsequencereachesitsminimum,
itgeneratesitsmaximum.NO CYCLEspecifiesthatthesequencecannotgeneratemorevaluesafterreachingitsmaximumor
minimumvalue.
Whatiscorrelatedsubquery?
Correlatedsubqueryisasubquerywhichhasreferencetothemainquery.
Whatarethedatatypesallowedinatable?
CHAR,VARCHAR2,NUMBER,DATE,RAW,LONGandLONGRAW.
WhatisdifferencebetweenCHARandVARCHAR2?WhatisthemaximumSIZEallowedforeachtype?
CHARpadsblankspacestothemaximumlength.VARCHAR2doesnotpadblankspaces.ForCHARitis255and2000for
VARCHAR2.
Canaviewbeupdated/inserted/deleted?IfYesunderwhatconditions?
AViewcanbeupdated/deleted/insertedifithasonlyonebasetableiftheviewisbasedoncolumnsfromoneormoretablesthen
insert,updateanddeleteisnotpossible.
WhatarethedifferenttypesofCoordinationsoftheMasterwiththeDetailblock?
POPULATE_GROUP(function)
POPULATE_GROUP_WITH_QUERY(function)
SET_GROUP_CHAR_CELL(procedure)
SET_GROUPCELL(procedure)
SET_GROUP_NUMBER_CELL(procedure)
UsetheADD_GROUP_COLUMNfunctiontoaddacolumntoarecordgroupthatwascreatedatdesigntime?
I)TRUEII)FALSE
II)FALSE
UsetheADD_GROUP_ROWproceduretoaddarowtoastaticrecordgroup?
I)TRUEII)FALSE
I)FALSE
maxvalue.sqlSelecttheNthHighestvaluefromatable?

selectlevel,max(col_name)frommy_tablewherelevel=&nconnectbyprior(col_name)>col_name)
groupbylevel
Example:
Givenatablecalledempwiththefollowingcolumns:
idnumber
namevarchar2(20)
salnumber

Forthesecondhighestsalary:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

78/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
selectlevel,max(sal)fromemp
wherelevel=2
connectbypriorsal>sal
groupbylevel
Findoutnthhighestsalaryfromemptable?
SELECTDISTINCT(a.sal)FROMEMPAWHERE&N=(SELECTCOUNT(DISTINCT(b.sal))FROMEMPBWHEREa.sal<=b.sal)
ForE.g.:
Entervalueforn:2
SAL

3700
Supposeacustomertableishavingdifferentcolumnslikecustomerno,payments.Whatwillbethequerytoselecttopthreemax
payments?
SELECTcustomer_no,paymentsfromcustomerC1
WHERE3<=(SELECTCOUNT(*)fromcustomerC2
WHEREC1.payment<=C2.payment)
Howyouwillavoidyourqueryfromusingindexes?
SELECT*FROMemp
Whereemp_no+=12345
i.eyouhavetoconcatenatethecolumnnamewithspacewithincodesinthewherecondition.
SELECT/*+FULL(a)*/ename,emp_nofromemp
whereemp_no=1234
i.eusingHINTS
Whatutilityisusedtocreateaphysicalbackup?
Eitherrmanoraltertablespacebeginbackupwilldo..
WhataretheBackgroundprocessesinOracleandwhatarethey.
Thisisoneofthemostfrequentlyaskedquestion.There arebasically9Processesbutinageneralsystemweneedtomentionthe
firstfivebackgroundprocesses.TheydothehousekeepingactivitiesfortheOracleandarecommoninanysystem.
Thevariousbackgroundprocessesinoracleare
a)DataBaseWriter(DBWR)::DataBaseWriterWritesModifiedblocksfromDatabasebuffercachetoDataFiles.Thisisrequired
sincethedataisnotwrittenwheneveratransactioniscommitted.
b)LogWriter(LGWR)::LogWriterwritestheredologentriestodisk.RedoLogdataisgeneratedinredologbufferofSGA.As
transactioncommitsandlogbufferfills,LGWRwriteslogentriesintoaonlineredologfile.
c)SystemMonitor(SMON)::TheSystemMonitorperformsinstancerecoveryatinstancestartup.Thisisusefulforrecoveryfrom
systemfailure
d)ProcessMonitor(PMON)::TheProcessMonitorperformsprocessrecoverywhenuserProcessfails.PmonClearsandFrees
resourcesthatprocesswasusing.
e)CheckPoint(CKPT)::AtSpecifiedtimes,allmodifieddatabasebuffersinSGAarewrittentodatafilesbyDBWRatCheckpointsand
Updatingalldatafilesandcontrolfilesofdatabasetoindicatethemostrecentcheckpoint
f)Archieves(ARCH)::TheArchivercopiesonlineredologfilestoarchivalstoralwhentheyarebusy.
g)Recoveror(RECO)::TheRecoverorisusedtoresolvethedistributedtransactioninnetwork
h)Dispatcher(Dnnn)::TheDispatcherisusefulinMultiThreadedArchitecture
i)Lckn::Wecanhaveupto10lockprocessesforinterinstancelockinginparallelsql.
HowmanytypesofSqlStatementsarethereinOracle
Therearebasically6typesofsqlstatments.Theyare
a)DataDefinitionLanguage(DDL)::TheDDLstatementsdefineandmaintainobjectsanddropobjects.
b)DataManipulationLanguage(DML)::TheDMLstatementsmanipulatedatabasedata.
c)TransactionControlStatements::ManagechangebyDML
d)SessionControl::Usedtocontrolthepropertiesofcurrentsessionenablinganddisablingrolesandchanging.e.g.::Alter
Statements,SetRole
e)SystemControlStatements::ChangePropertiesofOracleInstance.e.g.::AlterSystem
f)EmbeddedSql::IncorporateDDL,DMLandT.C.SinProgrammingLanguage.e.g::UsingtheSqlStatementsinlanguagessuchas
C,Open,Fetch,executeandclose
WhatisaTransactioninOracle
AtransactionisaLogicalunitofworkthatcompromisesoneormoreSQLStatementsexecutedbyasingleUser.AccordingtoANSI,
atransactionbeginswithfirstexecutablestatementandendswhenitisexplicitlycommittedorrolledback.
KeyWordsUsedinOracle
TheKeywordsthatareusedinOracleare::
a)Committing::AtransactionissaidtobecommittedwhenthetransactionmakespermanentchangesresultingfromtheSQL
statements.
b)Rollback::AtransactionthatretractsanyofthechangesresultingfromSQLstatementsinTransaction.
c)SavePoint::ForlongtransactionsthatcontainmanySQLstatements,intermediatemarkersorsavepointsaredeclared.
Savepointscanbeusedtodivideatransactionintosmallerpoints.
d)RollingForward::Processofapplyingredologduringrecoveryiscalledrollingforward.
e)Cursor::Acursorisahandle(nameorapointer)forthememoryassociatedwithaspecificstamen.Acursorisbasicallyanarea
allocatedbyOracleforexecutingtheSqlStatement.OracleusesanimplicitcursorstatementforSinglerowqueryandUsesExplicit

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

79/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
cursorforamultirowquery.
f)SystemGlobalArea(SGA)::TheSGAisasharedmemoryregionallocatedbytheOraclethatcontainsDataandcontrolinformation
foroneOracleInstance.ItconsistsofDatabaseBufferCacheandRedologBuffer.
g)ProgramGlobalArea(PGA)::ThePGAisamemorybufferthatcontainsdataandcontrolinformationforserverprocess.
g)DatabaseBufferCache::DatabaseBufferofSGAstoresthemostrecentlyusedblocksofdatabasedata.Thesetofdatabase
buffersinaninstanceiscalledDatabaseBufferCache.
h)RedologBuffer::RedologBufferofSGAstoresalltheredologentries.
i)RedoLogFiles::RedologfilesaresetoffilesthatprotectaltereddatabasedatainmemorythathasnotbeenwrittentoDataFiles.
Theyarebasicallyusedforbackupwhenadatabasecrashes.
j)Process::AProcessisathreadofcontrolormechanisminOperatingSystemthatexecutesseriesofsteps.
WhatareProcedure,functionsandPackages?ProceduresandfunctionsconsistofsetofPL/SQLstatementsthataregrouped
togetherasaunittosolveaspecificproblemorperformsetofrelatedtasks.
ProceduresdonotReturnvalueswhileFunctionsreturnoneOneValuePackages::PackagesProvideamethodofencapsulating
andstoringrelatedprocedures,functions,variablesandotherPackageContents
WhatareDatabaseTriggersandStoredProcedures
DatabaseTriggers::DatabaseTriggersareProceduresthatareautomaticallyexecutedasaresultofinsertin,updateto,ordelete
fromtable.
Databasetriggershavethevaluesoldandnewtodenotetheoldvalueinthetablebeforeitisdeletedandthenewindicatedthenew
valuethatwillbeused.DTareusefulforimplementingcomplexbusinessruleswhichcannotbeenforcedusingtheintegrityrules.We
canhavethetriggerasBeforetriggerorAfterTriggerandatStatementorRowlevel.e.g::operationsinsert,update,delete3before
,after3*2Atotalof6combinatons
Atstatmentlevel(onceforthetrigger)orrowlevel(foreveryexecution)6*2Atotalof12.Thusatotalof12combinationsarethere
andtherestrictionofusageof12triggershasbeenliftedfromOracle7.3Onwards.
StoredProcedures::StoredProceduresareProceduresthatarestoredinCompiledforminthedatabase.The advantageofusingthe
storedproceduresisthatmanyuserscanusethesameprocedureincompiledandreadytouseformat.
HowmanyIntegrityRulesarethereandwhatarethey
ThereareThreeIntegrityRules.Theyareasfollows::
a)EntityIntegrityRule::TheEntityIntegrityRuleenforcesthatthePrimarykeycannotbeNull
b)ForeignKeyIntegrityRule::TheFKIRdenotesthattherelationshipbetweentheforeignkeyandtheprimarykeyhastobe
enforced.When thereisdatainChildTablestheMastertablescannotbedeleted.
c)BusinessIntegrityRules::TheThirdIntigrityruleisaboutthecomplexbusinessprocesseswhichcannotbeimplementedbythe
above2rules.
WhataretheVariousMasterandDetailRelationships.
ThevariousMasterandDetailRelationshipare
a)NonIsolated::TheMastercannotbedeletedwhenachildisexisiting
b)Isolated::TheMastercanbedeletedwhenthechildisexisiting
c)Cascading::ThechildgetsdeletedwhentheMasterisdeleted.
WhataretheVariousBlockCoordinationProperties
ThevariousBlockCoordinationPropertiesare
a)ImmediateDefaultSetting.TheDetailrecordsareshownwhentheMasterRecordareshown.
b)DefferedwithAutoQueryOracleFormsdeferfetchingthedetailrecordsuntiltheoperatornavigatestothedetailblock.
c)DefferedwithNoAutoQueryTheoperatormustnavigatetothedetailblockandexplicitlyexecuteaquery
WhataretheDifferentOptimizationTechniques
TheVariousOptimisationtechniquesare
a)ExecutePlan::wecanseetheplanofthequeryandchangeitaccordinglybasedontheindexes
b)Optimizer_hint::
set_item_property(DeptBlock,OPTIMIZER_HINT,FIRST_ROWS)
Select/*+First_Rows*/Deptno,Dname,Loc,Rowidfromdept
where(Deptno>25)
c)Optimize_Sql::
BysettingtheOptimize_Sql=No,OracleFormsassignsasinglecursorforallSQLstatements.Thisslowdownstheprocessing
becauseforevertimetheSQLmustbeparsedwhenvertheyareexecuted.
f45runmodule=my_firstformuserid=scott/tigeroptimize_sql=No
d)Optimize_Tp::
BysettingtheOptimize_Tp=No,OracleFormsassignsseperatecursoronlyforeachquerySELECTstatement.AllotherSQL
statementsreusethecursor.
f45runmodule=my_firstformuserid=scott/tigeroptimize_Tp=No
HowdoesonechangeanOracleuserspassword?(forDBA)
IssuethefollowingSQLcommand:
ALTERUSER<username>IDENTIFIEDBY<new_password>
FromOracle8youcanjusttypepasswordfromSQL*Plus,orifyouneedtochangeanotheruserspassword,typepassword
user_name.Lookatthisexample:
SQL>password
ChangingpasswordforSCOTT
Oldpassword:
Newpassword:
Retypenewpassword:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

80/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Howdoesonecreateanddropdatabaseusers?
Lookattheseexamples:
CREATEUSERscott
IDENTIFIEDBYtigerAssignpassword
DEFAULTTABLESACEtoolsAssignspacefortableandindexsegments
TEMPORARYTABLESPACEtempAssignsortspace
DROPUSERscottCASCADERemoveuser
Aftercreatinganewuser,assigntherequiredprivileges:
GRANTCONNECT,RESOURCETOscott
GRANTDBATOscottMakeuseraDBAdministrator
Remembertogivetheusersomespacequotaonitstablespaces:
ALTERUSERscottQUOTAUNLIMITEDONtools
Whocreatedalltheseusersinmydatabase?/CanIdropthisuser?(forDBA)
Oraclecreatesanumberofdefaultdatabaseusersorschemaswhenanewdatabaseiscreated.Belowareafewofthem:
SYS/CHANGE_ON_INSTALLorINTERNAL
OracleDataDictionary/Catalog
Createdby:?/rdbms/admin/sql.bsq andvariouscat*.sqlscripts
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
SYSTEM/MANAGER
ThedefaultDBAusername(pleasedonotuseSYS)
Createdby:?/rdbms/admin/sql.bsq
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
OUTLN/OUTLN
Storedoutlinesforoptimizerplanstability
Createdby:?/rdbms/admin/sql.bsq
Canpasswordbechanged:Yes(Dosorightafterthedatabasewascreated)
Canuserbedropped:NO
SCOTT/TIGER,ADAMS/WOOD,JONES/STEEL,CLARK/CLOTHandBLAKE/PAPER.
Training/demonstrationuserscontainingthepopularEMPandDEPTtables
Createdby:?/rdbms/admin/utlsampl.sql
Canpasswordbechanged:Yes
Canuserbedropped:YESDropuserscascadefromallproductionenvironments
HR/HR(HumanResources),OE/OE(OrderEntry),SH/SH(SalesHistory).
Training/demonstrationuserscontainingthepopularEMPLOYEESandDEPARTMENTStables
Createdby:?/demo/schema/mksample.sql
Canpasswordbechanged:Yes
Canuserbedropped:YESDropuserscascadefromallproductionenvironments
CTXSYS/CTXSYS
OracleinterMedia(ConTextCartridge)administratoruser
Createdby:?/ctx/admin/dr0csys.sql
TRACESVR/TRACE
OracleTraceserver
Createdby:?/rdbms/admin/otrcsvr.sql
DBSNMP/DBSNMP
OracleIntelligentagent
Createdby:?/rdbms/admin/catsnmp.sql,calledfromcatalog.sql
Canpasswordbechanged:Yesputthenewpasswordinsnmp_rw.ora file
Canuserbedropped:YESOnlyifyoudonotusetheIntelligentAgents
ORDPLUGINS/ORDPLUGINS
ObjectRelationalData(ORD)UserusedbyTimeSeries,etc.
Createdby:?/ord/admin/ordinst.sql
ORDSYS/ORDSYS
ObjectRelationalData(ORD)UserusedbyTimeSeries,etc
Createdby:?/ord/admin/ordinst.sql
DSSYS/DSSYS
OracleDynamicServicesandSyndicationServer
Createdby:?/ds/sql/dssys_init.sql
MDSYS/MDSYS
OracleSpatialadministratoruser
Createdby:?/ord/admin/ordinst.sql
AURORA$ORB$UNAUTHENTICATED/INVALID
UsedforuserswhodonotauthenticateinAurora/ORB
Createdby:?/javavm/install/init_orb.sqlcalledfrom?/javavm/install/initjvm.sql
PERFSTAT/PERFSTAT
OracleStatisticsPackage(STATSPACK)thatsupersedesUTLBSTAT/UTLESTAT
Createdby:?/rdbms/admin/statscre.sql
RemembertochangethepasswordsfortheSYSandSYSTEMusersimmediatelyafterinstallation!
ExceptfortheuserSYS,thereshouldbenoproblemalteringtheseuserstouseadifferentdefaultandtemporarytablespace.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

81/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Howdoesoneenforcestrictpasswordcontrol?(forDBA)
BydefaultOraclessecurityisnotextremelygood.Forexample,Oraclewillallowuserstochoosesinglecharacterpasswordsand
passwordsthatmatchtheirnamesanduserids.Also,passwordsdonteverexpire.Thismeansthatonecanhackanaccountfor
yearswithouteverlockingtheuser.
FromOracle8onecanmanagepasswordsthroughprofiles.Someofthethingsthatonecanrestrict:
.FAILED_LOGIN_ATTEMPTSfailedloginattemptsbeforetheaccountislocked
.PASSWORD_LIFE_TIMElimitsthenumberofdaysthesamepasswordcanbeusedforauthentication
.PASSWORD_REUSE_TIMEnumberofdaysbeforeapasswordcanbereused
.PASSWORD_REUSE_MAXnumberofpasswordchangesrequiredbeforethecurrentpasswordcanbereused
.PASSWORD_LOCK_TIMEnumberofdaysanaccountwillbelockedaftermaximumfailedloginattempts
.PASSWORD_GRACE_TIMEnumberofdaysafterthegraceperiodbeginsduringwhichawarningisissuedandloginisallowed
.PASSWORD_VERIFY_FUNCTIONpasswordcomplexityverificationscript
Lookatthissimpleexample:
CREATEPROFILEmy_profileLIMIT
PASSWORD_LIFE_TIME30
ALTERUSERscottPROFILEmy_profile
HowdoesoneswitchtoanotheruserinOracle?(forDBA)
Usersnormallyusetheconnectstatementtoconnectfromonedatabaseusertoanother.However,DBAscanswitchfromoneuser
toanotherwithoutapassword.OfcourseitisnotadvisabletobridgeOraclessecurity,butlookatthisexample:SQL>select
passwordfromdba_userswhereusername=SCOTT'
PASSWORD
F894844C34402B67
SQL>alteruserscottidentifiedbylion
Useraltered.

SQL>connectscott/lion
Connected.
REMDowhateveryoulike
SQL>connectsystem/manager
Connected.
SQL>alteruserscottidentifiedbyvaluesF894844C34402B67
Useraltered.
SQL>connectscott/tiger
Connected.
Note:Alsoseethesu.sqlscriptintheUsefulScriptsandSampleProgramsPage.
Whataresnapshotsandviews Snapshotsaremirrororreplicasoftables.Viewsarebuiltusingthecolumnsfromoneormore
tables.TheSingleTableViewcanbeupdatedbuttheviewwithmultitablecannotbeupdated
WhataretheOOPSconceptsinOracle.
OracledoesimplementtheOOPSconcepts.ThebestexampleisthePropertyClasses.Wecancategorizethepropertiesbysetting
thevisualattributesandthenattachthepropertyclassesfortheobjects.OOPSsupportstheconceptsofobjectsandclassesandwe
canconsiderthepropertyclassesasclassesandtheitemsasobjects
Whatisthedifferencebetweencandidatekey,uniquekeyandprimarykey
Candidatekeysarethecolumnsinthetablethatcouldbetheprimarykeysandtheprimarykeyisthekeythathasbeenselectedto
identifytherows.Uniquekeyisalsousefulforidentifyingthedistinctrowsinthetable.)
Whatisconcurrency
Concurrencyisallowingsimultaneousaccessofsamedatabydifferentusers.Locksusefulforaccesingthedatabaseare
a)Exclusive
Theexclusivelockisusefulforlockingtherowwhenaninsert,updateordeleteisbeingdone.Thislockshouldnotbeappliedwhenwe
doonlyselectfromtherow.
b)Sharelock
WecandothetableasShare_Lockasmanyshare_lockscanbeputonthesameresource.
PrevilegesandGrants
PrevilegesaretherighttoexecuteaparticularetypeofSQLstatements.e.g::RighttoConnect,Righttocreate,Righttoresource
Grantsaregiventotheobjectssothattheobjectmightbeaccessedaccordingly.The granthastobegivenbytheowneroftheobject
TableSpace,DataFiles,ParameterFile,ControlFiles
TableSpace::Thetablespaceisusefulforstoringthedatainthedatabase.When adatabaseiscreatedtwotablespacesare
created.
a)SystemTablespace::Thisdatafilestoresallthetablesrelatedtothesystemanddbatables
b)UserTablespace::Thisdatafilestoresalltheuserrelatedtables
Weshouldhaveseperatetablespacesforstoringthetablesandindexessothattheaccessisfast.
DataFiles::EveryOracleDataBasehasoneormorephysicaldatafiles.Theystorethedataforthedatabase.Everydatafileis
associatedwithonlyonedatabase.Once theDatafileiscreatedthesizecannotchange.To increasethesizeofthedatabasetostore
moredatawehavetoadddatafile.
ParameterFiles::Parameterfileisneededtostartaninstance.Aparameterfilecontainsthelistofinstanceconfigurationparameters
e.g.::
db_block_buffers=500

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

82/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
db_name=ORA7
db_domain=u.s.acmelang
ControlFiles::Controlfilesrecordthephysicalstructureofthedatafilesandredologfiles
TheycontaintheDbname,nameandlocationofdbs,datafiles,redologfilesandtimestamp.
PhysicalStorageoftheData
Thefinestlevelofgranularityofthedatabasearethedatablocks.
DataBlock::OneDataBlockcorrespondtospecificnumberofphysicaldatabasespace
Extent::Extentisthenumberofspecificnumberofcontigiousdatablocks.
Segments::SetofExtentsallocatedforExtents.TherearethreetypesofSegments
a)DataSegment::NonClusteredTablehasdatasegmentdataofeverytableisstoredinclusterdatasegment
b)IndexSegment::EachIndexhasindexsegmentthatstoresdata
c)RollBackSegment::Temporarilystoreundoinformation
WhatarethePctFreeandPctUsed
PctFreeisusedtodenotethepercentageofthefreespacethatistobeleftwhencreatingatable.SimilarlyPctUsedisusedto
denotethepercentageoftheusedspacethatistobeusedwhencreatingatable
eg.::Pctfree20,Pctused40
WhatisRowChaining
Thedataofarowinatablemaynotbeabletofitthesamedatablock.Data forrowisstoredinachainofdatablocks.
Whatisa2PhaseCommit
TwoPhasecommitisusedindistributeddatabasesystems.Thisisusefultomaintaintheintegrityofthedatabasesothatallthe
usersseethesamevalues.ItcontainsDMLstatementsorRemoteProceduralcallsthatreferencearemoteobject.Thereare
basically2phasesina2phasecommit.
a)PreparePhase::Globalcoordinatorasksparticipantstoprepare
b)CommitPhase::CommitallparticipantstocoordinatortoPrepared,ReadonlyorabortReply
Whatisthedifferencebetweendeletingandtruncatingoftables
DeletingatablewillnotremovetherowsfromthetablebutentryisthereinthedatabasedictionaryanditcanberetrievedBut
truncatingatabledeletesitcompletelyanditcannotberetrieved.
Whataremutatingtables
Whenatableisinstateoftransitionitissaidtobemutating.eg::Ifarowhasbeendeletedthenthetableissaidtobemutatingand
nooperationscanbedoneonthetableexceptselect.
WhatareCoddRules
CoddRulesdescribetheidealnatureofaRDBMS.NoRDBMSsatisfiesallthe12coddrulesandOracleSatisfies11ofthe12rules
andistheonlyRdbmstosatisfythemaximumnumberofrules.
WhatisNormalisation
Normalisationistheprocessoforganisingthetablestoremovetheredundancy.There aremainly5Normalisationrules.
a)1NormalForm::Atableissaidtobein1stNormalFormwhentheattributesareatomic
b)2NormalForm::Atableissaidtobein2ndNormalFormwhenallthecandidatekeysaredependantontheprimarykey
c)3rdNormalForm::AtableissaidtobethirdNormalformwhenitisnotdependanttransitively
WhatistheDifferencebetweenapostqueryandaprequery
Apostquerywillfireforeveryrowthatisfetchedbuttheprequerywillfireonlyonce.
DeletingtheDuplicaterowsinthetable
WecandeletetheduplicaterowsinthetablebyusingtheRowid
CanUdisabledatabasetrigger?How?
Yes.Withrespecttotable
ALTERTABLETABLE
[[DISABLEall_trigger]]
Whatispseudocolumns?Namethem?
Apseudocolumnbehaveslikeatablecolumn,butisnotactuallystoredinthetable.Youcanselectfrompseudocolumns,butyou
cannotinsert,update,ordeletetheirvalues.Thissectiondescribesthesepseudocolumns:
CURRVAL
NEXTVAL
LEVEL
ROWID
ROWNUM
Howmanycolumnscantablehave?
Thenumberofcolumnsinatablecanrangefrom1to254.
Isspaceacquiredinblocksorextents?
Inextents.
Whatisclusteredindex?
Inanindexedcluster,rowsarestoredtogetherbasedontheirclusterkeyvalues.CannotappliedforHASH.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

83/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatarethedatatypessupportedByoracle(INTERNAL)?
Varchar2,Number,Char,MLSLABEL.
Whatareattributesofcursor?
%FOUND,%NOTFOUND,%ISOPEN,%ROWCOUNT
CanyouuseselectinFROMclauseofSQLselect?Yes.
Whichtriggerarecreatedwhenmasterdetailrelay?masterdeleteproperty
NONISOLATED(default)

a)oncheckdeletemaster
b)oncleardetails
c)onpopulatedetails
ISOLATED

a)oncleardetails
b)onpopulatedetails
CASCADE

a)perdelete
b)oncleardetails
c)onpopulatedetails
whichsystemvariablescanbesetbyusers?
SYSTEM.MESSAGE_LEVEL
SYSTEM.DATE_THRESHOLD
SYSTEM.EFFECTIVE_DATE
SYSTEM.SUPPRESS_WORKING
Whatareobjectgroup?
Anobjectgroupisacontainerforagroupofobjects.Youdefineanobjectgroupwhenyouwanttopackagerelatedobjectssoyou
cancopyorreferencetheminanothermodule.
Whatarereferencedobjects?
Referencingallowsyoutocreateobjectsthatinherittheirfunctionalityandappearancefromotherobjects.Referencinganobjectis
similartocopyinganobject,exceptthattheresultingreferenceobjectmaintainsalinktoitssourceobject.Areferenceobject
automaticallyinheritsanychangesthathavebeenmadetothesourceobjectwhenyouopenorregeneratethemodulethatcontains
thereferenceobject.
Canyoustoreobjectsinlibrary?
Referencingallowsyoutocreateobjectsthatinherittheirfunctionalityandappearancefromotherobjects.Referencinganobjectis
similartocopyinganobject,exceptthattheresultingreferenceobjectmaintainsalinktoitssourceobject.Areferenceobject
automaticallyinheritsanychangesthathavebeenmadetothesourceobjectwhenyouopenorregeneratethemodulethatcontains
thereferenceobject.
Isforms4.5objectorientedtool?why?
yes,partially.1)PROPERTYCLASSinheritanceproperty2)OVERLOADING:proceduresandfunctions.
CanyouissueDDLinforms?
yes,butyouhavetouseFORMS_DDL.
Referencingallowsyoutocreateobjectsthatinherittheirfunctionalityandappearancefromotherobjects.Referencinganobjectis
similartocopyinganobject,exceptthattheresultingreferenceobjectmaintainsalinktoitssourceobject.Areferenceobject
automaticallyinheritsanychangesthathavebeenmadetothesourceobjectwhenyouopenorregeneratethemodulethatcontains
thereferenceobject.Anystringexpressionupto32K:
aliteral
anexpressionoravariablerepresentingthetextofablockofdynamicallycreatedPL/SQLcode
aDMLstatementor
aDDLstatement

Restrictions:
ThestatementyoupasstoFORMS_DDLmaynotcontainbindvariablereferencesinthestring,butthevaluesofbindvariablescan
beconcatenatedintothestringbeforepassingtheresulttoFORMS_DDL.
WhatisSECUREproperty?
Hidescharactersthattheoperatortypesintothetextitem.Thissettingistypicallyusedforpasswordprotection.
Whatarethetypesoftriggersandhowthesequenceoffiringintextitem
TriggerscanbeclassifiedasKeyTriggers,MouseTriggers,NavigationalTriggers.
KeyTriggers::KeyTriggersarefiredasaresultofKeyaction.e.g::Keynextfield,Keyup,KeyDown
MouseTriggers::MouseTriggersarefiredasaresultofthemousenavigation.e.g.Whenmousebuttonpresed,whenmouse

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

84/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
doubleclicked,etc
NavigationalTriggers::TheseTriggersarefiredasaresultofNavigation.E.g.:PostTextitem,Pretextitem.
Wealsohaveeventtriggerslikewhen?newforminstanceandwhennewblockinstance.
Wecannotcallrestrictedprocedureslikego_to(?my_block.first_item?)intheNavigationaltriggers
ButcanusethemintheKeynextitem.
TheDifferencebetweenKeynextandPostTextisanveryimportantquestion.Thekeynextisfiredasaresultofthekeyactionwhile
theposttextisfiredasaresultofthemousemovement.Keynextwillnotfireunlessthereisakeyevent.Thesequenceoffiringina
textitemareasfollows::
a)pretext
b)whennewitem
c)keynext
d)whenvalidate
e)posttext
Canyoustorepicturesindatabase?How?
Yes,inlongRawdatatype.
Whatarepropertyclasses?Canpropertyclasseshavetrigger?
Propertyclassinheritanceisapowerfulfeaturethatallowsyoutoquicklydefineobjectsthatconformtoyourowninterfaceand
functionalitystandards.Propertyclassesalsoallowyoutomakeglobalchangestoapplicationsquickly.Bysimplychangingthe
definitionofapropertyclass,youcanchangethedefinitionofallobjectsthatinheritpropertiesfromthatclass.
Yes.Alltypeoftriggers.
Ifyouhavepropertyclassattachedtoanitemandyouhavesametriggerwrittenfortheitem.Whichwillfirefirst?
Itemleveltriggerfires,Ifitemleveltriggerfires,propertyleveltriggerwontfire.Triggersatthelowestlevelarealwaysgiventhefirst
preference.TheitemleveltriggerfiresfirstandthentheblockandthentheFormleveltrigger.
Whatarerecordgroups?*Canrecordgroupscreatedatruntime?
ArecordgroupisaninternalOracleFormsdatastructurethathasacolumn/rowframeworksimilartoadatabasetable.However,
unlikedatabasetables,recordgroupsareseparateobjectsthatbelongtotheformmoduleinwhichtheyaredefined.Arecordgroup
canhaveanunlimitednumberofcolumnsoftypeCHAR,LONG,NUMBER,orDATEprovidedthatthetotalnumberofcolumnsdoes
notexceed64K.Recordgroupcolumnnamescannotexceed30characters.
Programmatically,recordgroupscanbeusedwheneverthefunctionalityofferedbyatwodimensionalarrayofmultipledatatypesis
desirable.
TYPESOFRECORDGROUP:
QueryRecordGroupAqueryrecordgroupisarecordgroupthathasanassociatedSELECTstatement.Thecolumnsinaquery
recordgroupderivetheirdefaultnames,datatypes,andlengthsfromthedatabasecolumnsreferencedintheSELECTstatement.
Therecordsinaqueryrecordgrouparetherowsretrievedbythequeryassociatedwiththatrecordgroup.
NonqueryRecordGroupAnonqueryrecordgroupisagroupthatdoesnothaveanassociatedquery,butwhosestructureand
valuescanbemodifiedprogrammaticallyatruntime.
StaticRecordGroupAstaticrecordgroupisnotassociatedwithaqueryrather,youdefineitsstructureandrowvaluesatdesign
time,andtheyremainfixedatruntime.
WhatareALERT?
AnALERTisamodalwindowthatdisplaysamessagenotifyingoperatorofsomeapplicationcondition.
Canabuttonhaveiconandlabelatthesametime?
NO
Whatismousenavigatepropertyofbutton?
WhenMouseNavigateisTrue(thedefault),OracleFormsperformsstandardnavigationtomovethefocustotheitemwhenthe
operatoractivatestheitemwiththemouse.
WhenMouseNavigateissettoFalse,OracleFormsdoesnotperformnavigation(andtheresultingvalidation)tomovetotheitem
whenanoperatoractivatestheitemwiththemouse.
WhatisFORMS_MDI_WINDOW?
formsruninsidetheMDIapplicationwindow.Thispropertyisusefulforcallingaformfromanotherone.
Whataretimers?whenwhentimerexpireddoesnotfire?
TheWhenTimerExpiredtriggercannotfireduringtrigger,navigation,ortransactionprocessing.
Canobjectgrouphaveablock?
Yes,objectgroupcanhaveblockaswellasprogramunits.
Howmanytypesofcanvasesarethere.
Thereare2typesofcanvasescalledasContentandStackCanvas.Contentcanvasisthedefaultandtheonethatisusedmostlyfor
givingthebaseeffect.Itslikeaplateonwhichweadditemsandstackedcanvasisusedforgiving3dimensionaleffect.
Whatareuserexits?
Itinvokes3GLprograms.
Canyoupassvaluestoandfrofromforeignfunction?how?
Yes.YouobtainareturnvaluefromaforeignfunctionbyassigningthereturnvaluetoanOracleFormsvariableoritem.Makesure
thattheOracleFormsvariableoritemisthesamedatatypeasthereturnvaluefromtheforeignfunction.
AfterassigninganOracleFormsvariableoritemvaluetoaPL/SQLvariable,passthePL/SQLvariableasaparametervalueinthe
PL/SQLinterfaceoftheforeignfunction.ThePL/SQLvariablethatispassedasaparametermustbeavalidPL/SQLdatatypeit
mustalsobetheappropriateparametertypeasdefinedinthePL/SQLinterface.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

85/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatisIAPXTBstructure?
TheentriesofPro*Canduserexitsandtheformwhichsimulatetheprocoruser_exitarestoredinIAPXTBtableind/b.
CanyoucallWINSDKthruuserexits?
YES.
DoesuserexitssupportsDLLonMSWINDOWS?YES.
WhatispathsettingforDLL?
MakesureyouincludethenameoftheDLLintheFORMS45_USEREXITvariableoftheORACLE.INIfile,orrenametheDLLto
F45XTB.DLL.IfyourenametheDLLtoF45XTB.DLL,replacetheexistingF45XTB.DLLintheORAWINBINdirectorywiththenew
F45XTB.DLL.
HowismappingofnameofDLLandfunctiondone?
ThedllcanbecreatedusingtheVisualC++/VisualBasicToolsandthenthedllisputinthepaththatisdefinedtheregistry.
Whatisprecompiler?
ItissimilartoCprecompilerdirectives.
Canyouconnecttononoracledatasource?
Yes.
Whatarekeymodeandlockingmodeproperties?level?
KeyMode:Specifieshoworacleformsuniquelyidentifiesrowsinthedatabase.Thisispropertyincludesforapplicationthatwillrun
againstNONORACLEdatasources.
Keysettingunique(default.)
dateable
nupdateable.

Lockingmode:
SpecifieswhenOracleFormsshouldattempttoobtaindatabaselocksonrowsthatcorrespondtoqueriedrecordsintheform.a)
immediateb)delayed
Whataresavepointmodeandcursormodeproperties?level?
SpecifieswhetherOracleFormsshouldissuesavepointsduringasession.Thispropertyisincludedprimarilyforapplicationsthatwill
runagainstnonORACLEdatasources.ForapplicationsthatwillrunagainstORACLE,usethedefaultsetting.
CursormodedefinecursorstateacrosstransactionOpen/close.
Whatistransactionaltriggerproperty?
Identifiesablockastransactionalcontrolblock.i.e.nondatabaseblockthatoracleformsshouldmanageastransactionalblock.
(NONORACLEdatasource)defaultFALSE.
WhatisOLEautomation?
OLEautomationallowsanOLEserverapplicationtoexposeasetofcommandsandfunctionsthatcanbeinvokedfromanOLE
containerapplication.OLEautomationprovidesawayforanOLEcontainerapplicationtousethefeaturesofanOLEserver
applicationtomanipulateanOLEobjectfromtheOLEcontainerenvironment.(FORMS_OLE)
Whatdoesinvokebuiltindo?
Thisprocedureinvokesamethod.
Syntax:
PROCEDUREOLE2.INVOKE
(objectobj_type,
methodVARCHAR2,
listlist_type:=0)
Parameters:
objectIsanOLE2AutomationObject.
methodIsamethod(procedure)oftheOLE2object.
listIsthenameofanargumentlistassignedtotheOLE2.CREATE_ARGLISTfunction.
WhatareOPEN_FORM,CALL_FORM,NEW_FORM?diff?
CALL_FORM:Itcallstheotherform.butparentremainsactive,whencalledformcompletestheoperation,itreleaseslockand
controlgoesbacktothecallingform.
Whenyoucallaform,OracleFormsissuesasavepointforthecalledform.IftheCLEAR_FORMfunctioncausesarollbackwhenthe
calledformiscurrent,OracleFormsrollsbackuncommittedchangestothissavepoint.
OPEN_FORM:Whenyoucallaform,OracleFormsissuesasavepointforthecalledform.IftheCLEAR_FORMfunctioncausesa
rollbackwhenthecalledformiscurrent,OracleFormsrollsbackuncommittedchangestothissavepoint.
NEW_FORM:Exitsthecurrentformandenterstheindicatedform.Thecallingformisterminatedastheparentform.Ifthecalling
formhadbeencalledbyahigherform,OracleFormskeepsthehighercallactiveandtreatsitasacalltothenewform.Oracle
Formsreleasesmemory(suchasdatabasecursors)thattheterminatedformwasusing.
OracleFormsrunsthenewformwiththesameRunformoptionsastheparentform.Iftheparentformwasacalledform,Oracle
Formsrunsthenewformwiththesameoptionsastheparentform.
Whatiscallformstack?
WhensuccessiveformsareloadedviatheCALL_FORMprocedure,theresultingmodulehierarchyisknownasthecallformstack.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

86/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Canuportapplictionsacrosstheplatforms?how?
Yeswecanportapplicationsacrossplatforms.Considertheformdevelopedinawindowssystem.The formwouldbegeneratedin
unixsystembyusingf45genmy_form.fmb scott/tiger
Whatisavisualattribute?
Visualattributesarethefont,color,andpatternpropertiesthatyousetforformandmenuobjectsthatappearinyourapplications
interface.
Diff.betweenVATandPropertyClass?
Namedvisualattributesdefineonlyfont,color,andpatternattributespropertyclassescancontaintheseandanyotherproperties.
Youcanchangetheappearanceofobjectsatruntimebychangingthenamedvisualattributeprogrammaticallypropertyclass
assignmentcannotbechangedprogrammatically.Whenanobjectisinheritingfrombothapropertyclassandanamedvisual
attribute,thenamedvisualattributesettingstakeprecedence,andanyvisualattributepropertiesintheclassareignored.
Whichtriggerrelatedtomouse?
WhenMouseClick
WhenMouseDoubleClick
WhenMouseDown
WhenMouseEnter
WhenMouseLeave
WhenMouseMove
WhenMouseUp
WhatisCurrentrecordattributeproperty?
Specifiesthenamedvisualattributeusedwhenanitemispartofthecurrentrecord.CurrentRecordAttributeisfrequentlyusedatthe
blockleveltodisplaythecurrentrowinamultirecordIfyoudefineanitemlevelCurrentRecordAttribute,youcandisplayapre
determinediteminaspecialcolorwhenitispartofthecurrentrecord,butyoucannotdynamicallyhighlightthecurrentitem,asthe
inputfocuschanges.
CanuchangeVATatruntime?
Yes.Youcanprogrammaticallychangeanobjectsnamedvisualattributesettingtochangethefont,color,andpatternoftheobject
atruntime.
Canusetdefaultfontinforms?
Yes.Changewindowsregistry(regedit).Setform45_fonttothedesiredfont.
_break
WhatisLogSwitch?
ThepointatwhichORACLEendswritingtooneonlineredologfileandbeginswritingtoanotheriscalledalogswitch.
WhatisOnlineRedoLog?
TheOnlineRedoLogisasetoftowormoreonlineredofilesthatrecordallcommittedchangesmadetothedatabase.Whenevera
transactioniscommitted,thecorrespondingredoentriestemporarilystoresinredologbuffersoftheSGAarewrittentoanonline
redologfilebythebackgroundprocessLGWR.Theonlineredologfilesareusedincyclicalfashion.
WhichparameterspecifiedintheDEFAULTSTORAGEclauseofCREATETABLESPACEcannotbealteredaftercreatingthe
tablespace?
AllthedefaultstorageparametersdefinedforthetablespacecanbechangedusingtheALTERTABLESPACEcommand.When
objectsarecreatedtheirINITIALandMINEXTENSvaluescannotbechanged.
WhatarethestepsinvolvedinDatabaseStartup?
Startaninstance,MounttheDatabaseandOpentheDatabase.
Rollingforwardtorecoverdatathathasnotbeenrecordedindatafiles,yethasbeenrecordedintheonlineredolog,includingthe
contentsofrollbacksegments.Rollingbacktransactionsthathavebeenexplicitlyrolledbackorhavenotbeencommittedas
indicatedbytherollbacksegmentsregeneratedinstepa.Releasinganyresources(locks)heldbytransactionsinprocessatthetime
ofthefailure.Resolvinganypendingdistributedtransactionsundergoingatwophasecommitatthetimeoftheinstancefailure.
CanFullBackupbeperformedwhenthedatabaseisopen?
No.
WhatarethedifferentmodesofmountingaDatabasewiththeParallelServer?
ExclusiveModeIfthefirstinstancethatmountsadatabasedoessoinexclusivemode,onlythatInstancecanmountthedatabase.
ParallelModeIfthefirstinstancethatmountsadatabaseisstartedinparallelmode,otherinstancesthatarestartedinparallelmode
canalsomountthedatabase.
WhataretheadvantagesofoperatingadatabaseinARCHIVELOGmodeoveroperatingitinNOARCHIVELOGmode?
CompletedatabaserecoveryfromdiskfailureispossibleonlyinARCHIVELOGmode.Onlinedatabasebackupispossibleonlyin
ARCHIVELOGmode.
WhatarethestepsinvolvedinDatabaseShutdown?
ClosetheDatabase,DismounttheDatabaseandShutdowntheInstance.
WhatisArchivedRedoLog?
ArchivedRedoLogconsistsofRedoLogfilesthathavearchivedbeforebeingreused.
WhatisRestrictedModeofInstanceStartup?
Aninstancecanbestartedin(orlateralteredtobein)restrictedmodesothatwhenthedatabaseisopenconnectionsarelimited
onlytothosewhoseuseraccountshavebeengrantedtheRESTRICTEDSESSIONsystemprivilege.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

87/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
CanuhaveOLEobjectsinforms?Yes.
CanuhaveVBXandOCXcontrolsinforms?
Yes.
Whatrthetypesofwindows(Windowstyle)?
SpecifieswhetherthewindowisaDocumentwindoworaDialogwindow.
WhatisOLEActivationstyleproperty?
SpecifiestheeventthatwillactivatetheOLEcontainingitem.
Canuchangethemousepointer?How?
Yes.Specifiesthemousecursorstyle.Usethispropertytodynamicallychangetheshapeofthecursor.
Howmanytypesofcolumnsarethereandwhatarethey
Formulacolumns::FordoingmathematicalcalculationsandreturningonevalueSummaryColumns::Fordoingsummary
calculationssuchassummationsetc.PlaceholderColumns::Thesecolumnsareusefulforstoringthevalueinavariable
Canuhavemorethanonelayoutinreport
Itispossibletohavemorethanonelayoutinareportbyusingtheadditionallayoutoptioninthelayouteditor.
Canurunthereportwithoutaparameterform
YesitispossibletorunthereportwithoutparameterformbysettingthePARAMvaluetoNull
Whatisthelockoptioninreportslayout
Byusingthelockoptionwecannotmovethefieldsinthelayouteditoroutsidetheframe.Thisisusefulformaintainingthefields.
WhatisFlex
Flexisthepropertyofmovingtherelatedfieldstogetherbysettingtheflexpropertyon
Whataretheminimumnumberofgroupsrequiredforamatrixreport
Theminimumofgroupsrequiredforamatrixreportare4e
WhatisaSynonym?
Asynonymisanaliasforatable,view,sequenceorprogramunit.
WhatisaSequence?
Asequencegeneratesaseriallistofuniquenumbersfornumericalcolumnsofadatabasestables.
WhatisaSegment?
Asegmentisasetofextentsallocatedforacertainlogicalstructure.
Whatisschema?
AschemaiscollectionofdatabaseobjectsofaUser.
DescribeReferentialIntegrity?
Aruledefinedonacolumn(orsetofcolumns)inonetablethatallowstheinsertorupdateofarowonlyifthevalueforthecolumnor
setofcolumns(thedependentvalue)matchesavalueinacolumnofarelatedtable(thereferencedvalue).Italsospecifiesthetype
ofdatamanipulationallowedonreferenceddataandtheactiontobeperformedondependentdataasaresultofanyactionon
referenceddata.
WhatisHashCluster?
Arowisstoredinahashclusterbasedontheresultofapplyingahashfunctiontotherowsclusterkeyvalue.Allrowswiththesame
hashkeyvaluearestorestogetherondisk.
WhatisaPrivateSynonyms?
APrivateSynonymscanbeaccessedonlybytheowner.
WhatisDatabaseLink?
Adatabaselinkisanamedobjectthatdescribesapathfromonedatabasetoanother.
Whatisindexcluster?
Aclusterwithanindexontheclusterkey.
Whatishashcluster?
Arowisstoredinahashclusterbasedontheresultofapplyingahashfunctiontotherowsclusterkeyvalue.Allrowswiththesame
hashkeyvaluearestorestogetherondisk.
Whencanhashclusterused?
Hashclustersarebetterchoicewhenatableisoftenqueriedwithequalityqueries.Forsuchqueriesthespecifiedclusterkeyvalueis
hashed.Theresultinghashkeyvaluepointsdirectlytotheareaondiskthatstoresthespecifiedrows.
Whencanhashclusterused?
Hashclustersarebetterchoicewhenatableisoftenqueriedwithequalityqueries.Forsuchqueriesthespecifiedclusterkeyvalueis
hashed.Theresultinghashkeyvaluepointsdirectlytotheareaondiskthatstoresthespecifiedrows.
Whatarethetypesofdatabaselinks?
Privatedatabaselink,publicdatabaselink&networkdatabaselink.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

88/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisprivatedatabaselink?
Privatedatabaselinkiscreatedonbehalfofaspecificuser.Aprivatedatabaselinkcanbeusedonlywhentheownerofthelink
specifiesaglobalobjectnameinaSQLstatementorinthedefinitionoftheownersviewsorprocedures.
Whatispublicdatabaselink?
PublicdatabaselinkiscreatedforthespecialusergroupPUBLIC.Apublicdatabaselinkcanbeusedwhenanyuserinthe
associateddatabasespecifiesaglobalobjectnameinaSQLstatementorobjectdefinition.
Whatisnetworkdatabaselink?
Networkdatabaselinkiscreatedandmanagedbyanetworkdomainservice.Anetworkdatabaselinkcanbeusedwhenanyuserof
anydatabaseinthenetworkspecifiesaglobalobjectnameinaSQLstatementorobjectdefinition.
Whatisdatablock?
Oracledatabasesdataisstoredindatablocks.Onedatablockcorrespondstoaspecificnumberofbytesofphysicaldatabasespace
ondisk.
Howtodefinedatablocksize?
AdatablocksizeisspecifiedforeachOracledatabasewhenthedatabaseiscreated.Adatabaseusersandallocatedfreedatabase
spaceinOracledatablocks.Blocksizeisspecifiedininit.ora fileandcannotbechangedlatter.
Whatisrowchaining?
Incircumstances,allofthedataforarowinatablemaynotbeabletofitinthesamedatablock.Whenthisoccurs,thedataforthe
rowisstoredinachainofdatablock(oneormore)reservedforthatsegment.
Whatisanextent?
Anextentisaspecificnumberofcontiguousdatablocks,obtainedinasingleallocationandusedtostoreaspecifictypeof
information.
Whatarethedifferenttypesofsegments?Datasegment,indexsegment,rollbacksegmentandtemporarysegment.
Whatisadatasegment?
Eachnonclusteredtablehasadatasegment.Allofthetablesdataisstoredintheextentsofitsdatasegment.Eachclusterhasa
datasegment.Thedataofeverytableintheclusterisstoredintheclustersdatasegment.
Whatisanindexsegment?
Eachindexhasanindexsegmentthatstoresallofitsdata.
Whatisrollbacksegment?
Adatabasecontainsoneormorerollbacksegmentstotemporarilystoreundoinformation.
Whataretheusesofrollbacksegment?
Togeneratereadconsistentdatabaseinformationduringdatabaserecoveryandtorollbackuncommittedtransactionsbytheusers.
Whatisatemporarysegment?
TemporarysegmentsarecreatedbyOraclewhenaSQLstatementneedsatemporaryworkareatocompleteexecution.Whenthe
statementfinishesexecution,thetemporarysegmentextentsarereleasedtothesystemforfutureuse.
Whatisadatafile?
EveryOracledatabasehasoneormorephysicaldatafiles.Adatabasesdatafilescontainallthedatabasedata.Thedataoflogical
databasestructuressuchastablesandindexesisphysicallystoredinthedatafilesallocatedforadatabase.
Whatarethecharacteristicsofdatafiles?
Adatafilecanbeassociatedwithonlyonedatabase.Oncecreatedadatafilecantchangesize.Oneormoredatafilesformalogical
unitofdatabasestoragecalledatablespace.
Whatisaredolog?
Thesetofredologfilesforadatabaseiscollectivelyknownasthedatabaseredolog.
Whatisthefunctionofredolog?
Theprimaryfunctionoftheredologistorecordallchangesmadetodata.
Whatistheuseofredologinformation?
Theinformationinaredologfileisusedonlytorecoverthedatabasefromasystemormediafailurepreventsdatabasedatafrom
beingwrittentoadatabasesdatafiles.
Whatdoesacontrolfilecontains?
Databasename
Namesandlocationsofadatabasesfilesandredologfiles.
Timestampofdatabasecreation.
Whatistheuseofcontrolfile?
WhenaninstanceofanOracledatabaseisstarted,itscontrolfileisusedtoidentifythedatabaseandredologfilesthatmustbe
openedfordatabaseoperationtoproceed.Itisalsousedindatabaserecovery.
Isitpossibletosplittheprintreviewerintomorethanoneregion?
Yes
Isitpossibletocenteranobjecthorizontallyinarepeatingframethathasavariablehorizontalsize?Yes

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

89/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Forafieldinarepeatingframe,canthesourcecomefromthecolumnwhichdoesnotexistinthedatagroupwhichformsthe
basefortheframe?
Yes
Canafieldbeusedinareportwithoutitappearinginanydatagroup?
Yes
Thejoindefinedbythedefaultdatalinkisanouterjoinyesorno?
Yes
Canaformulacolumnreferredtocolumnsinhighergroup?
Yes
Canaformulacolumnbeobtainedthroughaselectstatement?
Yes
Isitpossibletoinsertcommentsintosqlstatementsreturninthedatamodeleditor?
Yes
Isitpossibletodisabletheparameterfromwhilerunningthereport?
Yes
Whenaformisinvokedwithcall_form,Doesoracleformsissuesasavepoint?
Yes
Explainthedifferencebetweenahotbackupandacoldbackupandthebenefitsassociatedwitheach.
Ahotbackupisbasicallytakingabackupofthedatabasewhileitisstillupandrunninganditmustbeinarchivelogmode.Acold
backupistakingabackupofthedatabasewhileitisshutdownanddoesnotrequirebeinginarchivelogmode.Thebenefitoftaking
ahotbackupisthatthedatabaseisstillavailableforusewhilethebackupisoccurringandyoucanrecoverthedatabasetoanypoint
intime.Thebenefitoftakingacoldbackupisthatitistypicallyeasiertoadministerthebackupandrecoveryprocess.Inaddition,
sinceyouaretakingcoldbackupsthedatabasedoesnotrequirebeinginarchivelogmodeandthustherewillbeaslight
performancegainasthedatabaseisnotcuttingarchivelogstodisk.
Youhavejusthadtorestorefrombackupanddonothaveanycontrolfiles.Howwouldyougoaboutbringingupthisdatabase?
Iwouldcreateatextbasedbackupcontrolfile,stipulatingwhereondiskallthedatafileswhereandthenissuetherecovercommand
withtheusingbackupcontrolfileclause.
Howdoyouswitchfromaninit.orafiletoaspfile?
Issuethecreatespfilefrompfilecommand.
Explainthedifferencebetweenadatablock,anextentandasegment.
Adatablockisthesmallestunitoflogicalstorageforadatabaseobject.Asobjectsgrowtheytakechunksofadditionalstoragethat
arecomposedofcontiguousdatablocks.Thesegroupingsofcontiguousdatablocksarecalledextents.Alltheextentsthatanobject
takeswhengroupedtogetherareconsideredthesegmentofthedatabaseobject.
GivetwoexamplesofhowyoumightdeterminethestructureofthetableDEPT.
Usethedescribecommandorusethedbms_metadata.get_ddlpackage.
Wherewouldyoulookforerrorsfromthedatabaseengine?
Inthealertlog.
CompareandcontrastTRUNCATEandDELETEforatable.Boththetruncateanddeletecommandhavethedesiredoutcomeof
gettingridofalltherowsinatable.ThedifferencebetweenthetwoisthatthetruncatecommandisaDDLoperationandjustmoves
thehighwatermarkandproducesanowrollback.Thedeletecommand,ontheotherhand,isaDMLoperation,whichwillproducea
rollbackandthustakelongertocomplete.
Givethereasoningbehindusinganindex.
Fasteraccesstodatablocksinatable.
Givethetwotypesoftablesinvolvedinproducingastarschemaandthetypeofdatatheyhold.
Facttablesanddimensiontables.Afacttablecontainsmeasurementswhiledimensiontableswillcontaindatathatwillhelpdescribe
thefacttables.
Whattypeofindexshouldyouuseonafacttable?
ABitmapindex.
Givetwoexamplesofreferentialintegrityconstraints.
Aprimarykeyandaforeignkey.
Atableisclassifiedasaparenttableandyouwanttodropandrecreateit.Howwouldyoudothiswithoutaffectingthe
childrentables?
Disabletheforeignkeyconstrainttotheparent,dropthetable,recreatethetable,enabletheforeignkeyconstraint.
ExplainthedifferencebetweenARCHIVELOGmodeandNOARCHIVELOGmodeandthebenefitsanddisadvantagestoeach.
ARCHIVELOGmodeisamodethatyoucanputthedatabaseinforcreatingabackupofalltransactionsthathaveoccurredinthe
databasesothatyoucanrecovertoanypointintime.NOARCHIVELOGmodeisbasicallytheabsenceofARCHIVELOGmodeand
hasthedisadvantageofnotbeingabletorecovertoanypointintime.NOARCHIVELOGmodedoeshavetheadvantageofnot
havingtowritetransactionstoanarchivelogandthusincreasestheperformanceofthedatabaseslightly.
Whatcommandwouldyouusetocreateabackupcontrolfile?Alterdatabasebackupcontrolfiletotrace.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

90/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Givethestagesofinstancestartuptoausablestatewherenormalusersmayaccessit.
STARTUPNOMOUNTInstancestartup
STARTUPMOUNTThedatabaseismounted
STARTUPOPENThedatabaseisopened
WhatcolumndifferentiatestheV$viewstotheGV$viewsandhow?
TheINST_IDcolumnwhichindicatestheinstanceinaRACenvironmenttheinformationcamefrom.
HowwouldyougoaboutgeneratinganEXPLAINplan?
Createaplantablewithutlxplan.sql.
Usetheexplainplansetstatement_id=tst1intoplan_tableforaSQLstatement
Lookattheexplainplanwithutlxplp.sqlorutlxpls.sql
Howwouldyougoaboutincreasingthebuffercachehitratio?
Usethebuffercacheadvisoryoveragivenworkloadandthenquerythev$db_cache_advicetable.IfachangewasnecessarythenI
wouldusethealtersystemsetdb_cache_sizecommand.
ExplainanORA01555
Yougetthiserrorwhenyougetasnapshottoooldwithinrollback.Itcanusuallybesolvedbyincreasingtheundoretentionor
increasingthesizeofrollbacks.Youshouldalsolookatthelogicinvolvedintheapplicationgettingtheerrormessage.
Explainthedifferencebetween$ORACLE_HOMEand$ORACLE_BASE.
ORACLE_BASEistherootdirectoryfororacle.ORACLE_HOMElocatedbeneathORACLE_BASEiswheretheoracleproducts
reside.
Howwouldyoudeterminethetimezoneunderwhichadatabasewasoperating?
selectDBTIMEZONEfromdual
ExplaintheuseofsettingGLOBAL_NAMESequaltoTRUE.
SettingGLOBAL_NAMESdictateshowyoumightconnecttoadatabase.ThisvariableiseitherTRUEorFALSEandifitissetto
TRUEitenforcesdatabaselinkstohavethesamenameastheremotedatabasetowhichtheyarelinking.
WhatcommandwouldyouusetoencryptaPL/SQLapplication?
WRAP
ExplainthedifferencebetweenaFUNCTION,PROCEDUREandPACKAGE.
AfunctionandprocedurearethesameinthattheyareintendedtobeacollectionofPL/SQLcodethatcarriesasingletask.Whilea
proceduredoesnothavetoreturnanyvaluestothecallingapplication,afunctionwillreturnasinglevalue.Apackageontheother
handisacollectionoffunctionsandproceduresthataregroupedtogetherbasedontheircommonalitytoabusinessfunctionor
application.
Explaintheuseoftablefunctions.
TablefunctionsaredesignedtoreturnasetofrowsthroughPL/SQLlogicbutareintendedtobeusedasanormaltableorviewina
SQLstatement.TheyarealsousedtopipelineinformationinanETLprocess.
Namethreeadvisorystatisticsyoucancollect.
BufferCacheAdvice,SegmentLevelStatistics,&TimedStatistics
WhereintheOracledirectorytreestructureareaudittracesplaced?
Inunix$ORACLE_HOME/rdbms/audit,inWindowstheeventviewer
Explainmaterializedviewsandhowtheyareused.
Materializedviewsareobjectsthatarereducedsetsofinformationthathavebeensummarized,grouped,oraggregatedfrombase
tables.Theyaretypicallyusedindatawarehouseordecisionsupportsystems.
Whenauserprocessfails,whatbackgroundprocesscleansupafterit?
PMON
Whatbackgroundprocessrefreshesmaterializedviews?
TheJobQueueProcesses.
Howwouldyoudeterminewhatsessionsareconnectedandwhatresourcestheyarewaitingfor?
UseofV$SESSIONandV$SESSION_WAIT
Describewhatredologsare.
Redologsarelogicalandphysicalstructuresthataredesignedtoholdallthechangesmadetoadatabaseandareintendedtoaidin
therecoveryofadatabase.
Howwouldyouforcealogswitch?
ALTERSYSTEMSWITCHLOGFILE
GivetwomethodsyoucouldusetodeterminewhatDDLchangeshavebeenmade.
YoucoulduseLogminerorStreams
Whatdoescoalescingatablespacedo?
Coalescingisonlyvalidfordictionarymanagedtablespacesanddefragmentsspacebycombiningneighboringfreeextentsinto
largesingleextents.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

91/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatisthedifferencebetweenaTEMPORARYtablespaceandaPERMANENTtablespace?
Atemporarytablespaceisusedfortemporaryobjectssuchassortstructureswhilepermanenttablespacesareusedtostorethose
objectsmeanttobeusedasthetrueobjectsofthedatabase.
Nameatablespaceautomaticallycreatedwhenyoucreateadatabase.
TheSYSTEMtablespace.
Whencreatingauser,whatpermissionsmustyougranttoallowthemtoconnecttothedatabase?
GranttheCONNECTtotheuser.
Howdoyouaddadatafiletoatablespace
ALTERTABLESPACE<tablespace_name>ADDDATAFILE<datafile_name>SIZE
Howdoyouresizeadatafile?
ALTERDATABASEDATAFILE<datafile_name>RESIZE<new_size>
Whatviewwouldyouusetolookatthesizeofadatafile?
DBA_DATA_FILES
Whatviewwouldyouusetodeterminefreespaceinatablespace?
DBA_FREE_SPACE
Howwouldyoudeterminewhohasaddedarowtoatable?
Turnonfinegrainauditingforthetable.
Howcanyourebuildanindex?
ALTERINDEX<index_name>REBUILD
Explainwhatpartitioningisandwhatitsbenefitis.
Partitioningisamethodoftakinglargetablesandindexesandsplittingthemintosmaller,moremanageablepieces.
YouhavejustcompiledaPL/SQLpackagebutgoterrors,howwouldyouviewtheerrors?
SHOWERRORS
Howcanyougatherstatisticsonatable?
TheANALYZEcommand.
Howcanyouenableatraceforasession?
UsetheDBMS_SESSION.SET_SQL_TRACEor
UseALTERSESSIONSETSQL_TRACE=TRUE
WhatisthedifferencebetweentheSQL*LoaderandIMPORTutilities?
ThesetwoOracleutilitiesareusedforloadingdataintothedatabase.Thedifferenceisthattheimportutilityreliesonthedatabeing
producedbyanotherOracleutilityEXPORTwhiletheSQL*Loaderutilityallowsdatatobeloadedthathasbeenproducedbyother
utilitiesfromdifferentdatasourcesjustsolongasitconformstoASCIIformattedordelimitedfiles.
Nametwofilesusedfornetworkconnectiontoadatabase.
TNSNAMES.ORAandSQLNET.ORA
WhatisthefunctionofOptimizer?ThegoaloftheoptimizeristochoosethemostefficientwaytoexecuteaSQLstatement.
WhatisExecutionPlan?
Thecombinationsofthestepstheoptimizerchoosestoexecuteastatementiscalledanexecutionplan.
Canoneresizetablespacesanddatafiles?
OnecanmanuallyincreaseordecreasethesizeofadatafilefromOracle7.2usingthecommand.
ALTERDATABASEDATAFILEfilename2RESIZE100M
Becauseyoucanchangethesizesofdatafiles,youcanaddmorespacetoyourdatabasewithoutaddingmoredatafiles.Thisis
beneficialifyouareconcernedaboutreachingthemaximumnumberofdatafilesallowedinyourdatabase.
Manuallyreducingthesizesofdatafilesallowsyoutoreclaimunusedspaceinthedatabase.Thisisusefulforcorrectingerrorsin
estimationsofspacerequirements.
Also,datafilescanbeallowedtoautomaticallyextendifmorespaceisrequired.Lookatthefollowingcommand:
CREATETABLESPACEpcs_data_ts
DATAFILEc:\ora_apps\pcs\pcsdata1.dbfSIZE3M
AUTOEXTENDONNEXT1MMAXSIZEUNLIMITED
DEFAULTSTORAGE(INITIAL10240
NEXT10240
MINEXTENTS1
MAXEXTENTSUNLIMITED
PCTINCREASE0)
ONLINE
PERMANENT
WhatisSAVEPOINT?
ForlongtransactionsthatcontainmanySQLstatements,intermediatemarkersorsavepointscanbedeclaredwhichcanbeusedto
divideatransactionintosmallerparts.Thisallowstheoptionoflaterrollingbackallworkperformedfromthecurrentpointinthe
transactiontoadeclaredsavepointwithinthetransaction.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

92/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatarethevaluesthatcanbespecifiedforOPTIMIZERMODEParameter?
COSTandRULE.
Canonerenameatablespace?(forDBA)
No,thisislistedasEnhancementRequest148742.Workaround:
Exportalloftheobjectsfromthetablespace
Dropthetablespaceincludingcontents
Recreatethetablespace
Importtheobjects
WhatisRULEbasedapproachtooptimization?
Choosinganexecutingplanbasedontheaccesspathsavailableandtheranksoftheseaccesspaths.
WhatarethevaluesthatcanbespecifiedforOPTIMIZER_GOALparameteroftheALTERSESSIONCommand?
CHOOSE,ALL_ROWS,FIRST_ROWSandRULE.
Howdoesonecreateastandbydatabase?
Whileyourproductiondatabaseisrunning,takean(imagecopy)backupandrestoreitonduplicatehardware.Notethatanexportwill
notwork!!!
Onyourstandbydatabase,issuethefollowingcommands:
ALTERDATABASECREATESTANDBYCONTROLFILEASfilename'
ALTERDATABASEMOUNTSTANDBYDATABASE
RECOVERSTANDBYDATABASE
OnsystemspriortoOracle8i,writeajobtocopyarchivedredologfilesfromtheprimarydatabasetothestandbysystem,andapply
theredologfilestothestandbydatabase(pipeit).Rememberthedatabaseisrecoveringandwillpromptyouforthenextlogfileto
apply.
Oracle8ionwardsprovideanAutomatedStandbyDatabasefeature,whichwillsendarchived,logfilestotheremotesiteviaNET8,
andapplythentothestandbydatabase.
Whenoneneedstoactivatethestandbydatabase,stoptherecoveryprocessandactivateit:
ALTERDATABASEACTIVATESTANDBYDATABASE
Howdoesonegivedevelopersaccesstotracefiles(requiredasinputtotkprof)?
Thealtersessionsetsql_trace=truecommandgeneratestracefilesinUSER_DUMP_DESTthatcanbeusedbydevelopersasinput
totkprof.OnUnixthedefaultfilemaskforthesefilesarerwxr.
ThereisanundocumentedINIT.ORAparameterthatwillalloweveryonetoread(rwxrr)thesetracefiles:
_trace_files_public=true
IncludethisinyourINIT.ORAfileandbounceyourdatabaseforittotakeeffect.
WhataretheresponsibilitiesofaDatabaseAdministrator?
InstallingandupgradingtheOracleServerandapplicationtools.Allocatingsystemstorageandplanningfuturestoragerequirements
forthedatabasesystem.Managingprimarydatabasestructures(tablespaces)Managingprimaryobjects(table,views,indexes)
Enrollingusersandmaintainingsystemsecurity.EnsuringcompliancewithOralcelicenseagreementControllingandmonitoringuser
accesstothedatabase.Monitoringandoptimizingtheperformanceofthedatabase.Planningforbackupandrecoveryofdatabase
information.MaintainarchiveddataontapeBackingupandrestoringthedatabase.ContactingOracleCorporationfortechnical
support.
Whatisatracefileandhowisitcreated?
Eachserverandbackgroundprocesscanwriteanassociatedtracefile.Whenaninternalerrorisdetectedbyaprocessoruser
process,itdumpsinformationabouttheerrortoitstrace.Thiscanbeusedfortuningthedatabase.
Whataretherolesanduseraccountscreatedautomaticallywiththedatabase?
DBAroleContainsalldatabasesystemprivileges.
SYSuseraccountTheDBArolewillbeassignedtothisaccount.Allofthebasetablesandviewsforthedatabasesdictionaryare
storeinthisschemaandaremanipulatedonlybyORACLE.SYSTEMuseraccountIthasallthesystemprivilegesforthedatabase
andadditionaltablesandviewsthatdisplayadministrativeinformationandinternaltablesandviewsusedbyoracletoolsarecreated
usingthisusername.
Whataretheminimumparametersshouldexistintheparameterfile( init.ora)?
DBNAMEMustsettoatextstringofnomorethan8charactersanditwillbestoredinsidethedatafiles,redologfilesandcontrol
filesandcontrolfilewhiledatabasecreation.
DB_DOMAINItisstringthatspecifiesthenetworkdomainwherethedatabaseiscreated.Theglobaldatabasenameisidentifiedby
settingtheseparameters
(DB_NAME&DB_DOMAIN)CONTORLFILESListofcontrolfilenamesofthedatabase.Ifnameisnotmentionedthendefault
namewillbeused.
DB_BLOCK_BUFFERSTodeterminethenoofbuffersinthebuffercacheinSGA.
PROCESSESTodeterminenumberofoperatingsystemprocessesthatcanbeconnectedtoORACLEconcurrently.Thevalue
shouldbe5(backgroundprocess)andadditional1foreachuser.
ROLLBACK_SEGMENTSListofrollbacksegmentsanORACLEinstanceacquiresatdatabasestartup.Alsooptionally
LICENSE_MAX_SESSIONS,LICENSE_SESSION_WARNINGandLICENSE_MAX_USERS.
WhyandwhenshouldIbackupmydatabase?
BackupandrecoveryisoneofthemostimportantaspectsofaDBAsjob.Ifyouloseyourcompanysdata,youcouldverywelllose
yourjob.Hardwareandsoftwarecanalwaysbereplaced,butyourdatamaybeirreplaceable!
Normallyonewouldscheduleahierarchyofdaily,weeklyandmonthlybackups,howeverconsultwithyourusersbeforedecidingona
backupschedule.Backupfrequencynormallydependsonthefollowingfactors:

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

93/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
.Rateofdatachange/transactionrate
.Databaseavailability/Canyoushutdownforcoldbackups?
.Criticalityofthedata/Valueofthedatatothecompany
.Readonlytablespaceneedsbackingupjustoncerightafteryoumakeitreadonly
.Ifyouarerunninginarchivelogmodeyoucanbackuppartsofadatabaseoveranextendedcycleofdays
.Ifarchiveloggingisenabledoneneedstobackuparchivedlogfilestimeouslytopreventdatabasefreezes
.Etc.
Carefullyplanbackupretentionperiods.Ensureenoughbackupmedia(tapes)areavailableandthatoldbackupsareexpiredintime
tomakemediaavailablefornewbackups.Offsitevaultingisalsohighlyrecommended.
Frequentlytestyourabilitytorecoveranddocumentallpossiblescenarios.Remember,itsthelittlethingsthatwillgetyou.Most
failedrecoveriesarearesultoforganizationalerrorsandmiscommunications.
WhatstrategiesareavailableforbackingupanOracledatabase?
ThefollowingmethodsarevalidforbackingupanOracledatabase:
Export/ImportExportsarelogicaldatabasebackupsinthattheyextractlogicaldefinitionsanddatafromthedatabasetoafile.
ColdorOfflineBackupsShutthedatabasedownandbackupupALLdata,log,andcontrolfiles.
HotorOnlineBackupsIfthedatabasesareavailableandinARCHIVELOGmode,setthetablespacesintobackupmodeand
backuptheirfiles.Alsoremembertobackupthecontrolfilesandarchivedredologfiles.
RMANBackupsWhilethedatabaseisofflineoronline,usethermanutilitytobackupthedatabase.
Itisadvisabletousemorethanoneofthesemethodstobackupyourdatabase.Forexample,ifyouchoosetodoonlinedatabase
backups,alsocoveryourselfbydoingdatabaseexports.AlsotestALLbackupandrecoveryscenarioscarefully.Itisbettertobesave
thansorry.
Regardlessofyourstrategy,alsoremembertobackupallrequiredsoftwarelibraries,parameterfiles,passwordfiles,etc.Ifyour
databaseisinARCGIVELOGmode,youalsoneedtobackuparchivedlogfiles.
Whatisthedifferencebetweenonlineandofflinebackups?
Ahotbackupisabackupperformedwhilethedatabaseisonlineandavailableforread/write.ExceptforOracleexports,onecanonly
doonlinebackupswhenrunninginARCHIVELOGmode.
Acoldbackupisabackupperformedwhilethedatabaseisofflineandunavailabletoitsusers.
Whatisthedifferencebetweenrestoringandrecovering?
Restoringinvolvescopyingbackupfilesfromsecondarystorage(backupmedia)todisk.Thiscanbedonetoreplacedamagedfiles
ortocopy/moveadatabasetoanewlocation.
Recoveryistheprocessofapplyingredologstothedatabasetorollitforward.Onecanrollforwarduntilaspecificpointintime
(beforethedisasteroccurred),orrollforwarduntilthelasttransactionrecordedinthelogfiles.Sql>connectSYSasSYSDBA
Sql>RECOVERDATABASEUNTILTIME20010306:16:00:00USINGBACKUPCONTROLFILE
Howdoesonebackupadatabaseusingtheexportutility?
Oracleexportsarelogicaldatabasebackups(notphysical)astheyextractdataandlogicaldefinitionsfromthedatabaseintoafile.
Otherbackupstrategiesnormallybackupthephysicaldatafiles.
Oneoftheadvantagesofexportsisthatonecanselectivelyreimporttables,howeveronecannotrollforwardfromanrestored
exportfile.Tocompletelyrestoreadatabasefromanexportfileonepracticallyneedstorecreatetheentiredatabase.
Alwaysdofullsystemlevelexports(FULL=YES).Fullexportsincludemoreinformationaboutthedatabaseintheexportfilethanuser
levelexports.
Whatarethebuilt_insusedthedisplaytheLOV?
Show_lov
List_values
HowdoyoucallotherOracleProductsfromOracleForms?
Run_productisabuiltin,Usedtoinvokeoneofthesupportedoracletoolsproductsandspecifiesthenameofthedocumentor
moduletoberun.Ifthecalledproductisunavailableatthetimeofthecall,OracleFormsreturnsamessagetotheoperator.
Whatisthemaindiff.bet.Reports2.0&Reports2.5?
Report2.5isobjectoriented.
WhataretheBuiltinstodisplaytheusernamededitor?
AusernamededitorcanbedisplayedprogrammaticallywiththebuiltinprocedureSHOWEDITOR,EDIT_TETITEMindependentof
anyparticulartextitem.
Howmanynumberofcolumnsarecordgroupcanhave?
ArecordgroupcanhaveanunlimitednumberofcolumnsoftypeCHAR,LONG,NUMBER,orDATEprovidedthatthetotalnumberof
columndoesnotexceed64K.
WhatisaQueryRecordGroup?
AqueryrecordgroupisarecordgroupthathasanassociatedSELECTstatement.Thecolumnsinaqueryrecordgroupderivetheir
defaultnames,datatypes,hadlengthsfromthedatabasecolumnsreferencedintheSELECTstatement.Therecordsinqueryrecord
grouparetherowsretrievedbythequeryassociatedwiththatrecordgroup.
Whatdoesthetermpanelrefertowithregardtopages?
Apanelistheno.ofphysicalpagesneededtoprintonelogicalpage.
Whatisamasterdetailrelationship?
Amasterdetailrelationshipisanassociationbetweentwobasetableblocksamasterblockandadetailblock.Therelationship
betweentheblocksreflectsaprimarykeytoforeignkeyrelationshipbetweenthetablesonwhichtheblocksarebased.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

94/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Whatisalibrary?
Alibraryisacollectionofsubprogramsincludingusernamedprocedures,functionsandpackages.
Whatisananchoringobject&whatisitsuse?Whatarethevarioussubeventsamousedoubleclickeventinvolves?An
anchoringobjectisaprintconditionobjectwhichusedtoexplicitlyorimplicitlyanchorotherobjectstoitself.
Usetheadd_group_columnfunctiontoaddacolumntorecordgroupthatwascreatedatadesigntime?
False
Whatarethevarioussubeventsamousedoubleclickeventinvolves?Whatarethevarioussubeventsamousedoubleclick
eventinvolves?
Doubleclickingthemouseconsistsofthemousedown,mouseup,mouseclick,mousedown&mouseupevents.
Whatistheuseofbreakgroup?Whatarethevarioussubeventsamousedoubleclickeventinvolves?Abreakgroupisusedto
displayonerecordforonegroupones.Whilemultiplerelatedrecordsinothergroupcanbedisplayed.
Whattuningindicatorscanoneuse?
Thefollowinghighleveltuningindicatorscanbeusedtoestablishifadatabaseisperformingoptimallyornot:
.BufferCacheHitRatio
Formula:HitRatio=(LogicalReadsPhysicalReads)/LogicalReads
Action:IncreaseDB_CACHE_SIZE(DB_BLOCK_BUFFERSpriorto9i)toincreasehitratio
.LibraryCacheHitRatio
Action:IncreasetheSHARED_POOL_SIZEtoincreasehitratio
Whattools/utilitiesdoesOracleprovidetoassistwithperformancetuning?
Oracleprovidethefollowingtools/utilitiestoassistwithperformancemonitoringandtuning:
.TKProf
.UTLBSTAT.SQL andUTLESTAT.SQL Beginandendstatsmonitoring
.Statspack
.OracleEnterpriseManagerTuningPack
WhatisSTATSPACKandhowdoesoneuseit?
StatspackisasetofperformancemonitoringandreportingutilitiesprovidedbyOraclefromOracle8iandabove.Statspackprovides
improvedBSTAT/ESTATfunctionality,thoughtheoldBSTAT/ESTATscriptsarestillavailable.Formoreinformationabout
STATSPACK,readthedocumentationinfile$ORACLE_HOME/rdbms/admin/spdoc.txt.
InstallStatspack:
cd$ORACLE_HOME/rdbms/admin
sqlplus/assysdba@spdrop.sqlInstallStatspack
sqlplus/assysdba@spcreate.sqlEntertablespacenameswhenprompted
UseStatspack:
sqlplusperfstat/perfstat
execstatspack.snap Takeaperformancesnapshots
execstatspack.snap
Getalistofsnapshots

selectSNAP_ID,SNAP_TIMEfromSTATS$SNAPSHOT
@spreport.sqlEntertwosnapshotidsfordifferencereport
OtherStatspackScripts:
.sppurge.sqlPurgearangeofSnapshotIdsbetweenthespecifiedbeginandendSnapIds
.spauto.sqlScheduleadbms_jobtoautomatethecollectionofSTATPACKstatistics
.spcreate.sqlInstallstheSTATSPACKuser,tablesandpackageonadatabase(RunasSYS).
.spdrop.sqlDeinstallSTATSPACKfromdatabase(RunasSYS)
.sppurge.sqlDeletearangeofSnapshotIdsfromthedatabase
.spreport.sqlReportondifferencesbetweenvaluesrecordedintwosnapshots
.sptrunc.sqlTruncatesalldatainStatspacktables
WhatarethecommonRMANerrors(withsolutions)?
SomeofthecommonRMANerrorsare:
RMAN20242:Specificationdoesnotmatchanyarchivelogintherecoverycatalog.
AddtoRMANscript:sqlaltersystemarchivelogcurrent'
RMAN06089:archivedlogxyznotfoundoroutofsyncwithcatalog
ExecutefromRMAN:changearchivelogallvalidate
Howcanyouexecutetheuserdefinedtriggersinforms3.0?
ExecuteTrigger(triggername)
WhatERASEpackageproceduredoes?
Eraseremovesanindicatedglobalvariable.
WhatisthedifferencebetweenNAME_INandCOPY?
Copyispackageprocedureandwritesvaluesintoafield.
Nameinisapackagefunctionandreturnsthecontentsofthevariabletowhichyouapply.
Whatpackageprocedureisusedforcallinganotherform?
Call(E.g.Call(formname)

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

95/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhentheformisrunninginDEBUGmode,Ifyouwanttoexaminethevaluesofglobalvariablesandotherformvariables,What
packageprocedurecommandyouwoulduseinyourtriggertext?
Break.
SYSTEMVARIABLES
Thevaluerecordedinsystem.last_recordvariableisoftype
a.Number
b.Boolean
c.Character.?
b.Boolean.
WhatismeanbyProgramGlobalArea(PGA)?
ItisareainmemorythatisusedbyaSingleOracleUserProcess.
Whatishitratio?
Itisameasureofwellthedatacachebufferishandlingrequestsfordata.HitRatio=(LogicalReadsPhysicalReadsHitsMisses)/
LogicalReads.
HowdouimplementtheIfstatementintheSelectStatement
WecanimplementtheifstatementintheselectstatementbyusingtheDecodestatement.e.g.selectDECODE
(EMP_CAT,1,First,2,SecondNull)HeretheNullistheelsestatementwherenullisdone.
HowmanytypesofExceptionsarethere
Thereare2typesofexceptions.Theyare
a)SystemExceptions
e.g.Whenno_data_found,Whentoo_many_rows
b)UserDefinedExceptions
e.g.My_exceptionexception
WhenMy_exceptionthen
Whataretheinlineandtheprecompilerdirectives
Theinlineandprecompilerdirectivesdetectthevaluesdirectly
Howdoyouusethesamelovfor2columns
Wecanusethesamelovfor2columnsbypassingthereturnvaluesinglobalvaluesandusingtheglobalvaluesinthecode
Howmanyminimumgroupsarerequiredforamatrixreport
Theminimumnumberofgroupsinmatrixreportare4
Whatisthedifferencebetweenstaticanddynamiclov
Thestaticlovcontainsthepredeterminedvalueswhilethedynamiclovcontainsvaluesthatcomeatruntime
HowdoesonemanageOracledatabaseusers?
Oracleuseraccountscanbelocked,unlocked,forcedtochoosenewpasswords,etc.Forexample,allaccountsexceptSYSand
SYSTEMwillbelockedaftercreatinganOracle9iDBdatabaseusingtheDBConfigurationAssistant(dbca).DBAsmustunlockthese
accountstomakethemavailabletousers.
Lookattheseexamples:
ALTERUSERscottACCOUNTLOCKlockauseraccount
ALTERUSERscottACCOUNTUNLOCKunlocksalockedusersaccount
ALTERUSERscottPASSWORDEXPIREForceusertochooseanewpassword
WhatisthedifferencebetweenDBFileSequentialandScatteredReads?
BothdbfilesequentialreadanddbfilescatteredreadeventssignifytimewaitedforI/Oreadrequeststocomplete.Timeis
reportedin100sofasecondforOracle8ireleasesandbelow,and1000sofasecondforOracle9iandabove.Mostpeopleconfuse
theseeventswitheachotherastheythinkofhowdataisreadfromdisk.InsteadtheyshouldthinkofhowdataisreadintotheSGA
buffercache.
dbfilesequentialread:
Asequentialreadoperationreadsdataintocontiguousmemory(usuallyasingleblockreadwithp3=1,butcanbemultipleblocks).
SingleblockI/Osareusuallytheresultofusingindexes.Thiseventisalsousedforrebuildingthecontrolfileandreadingdatafile
headers(P2=1).Ingeneral,thiseventisindicativeofdiskcontentiononindexreads.
dbfilescatteredread:
Similartodbfilesequentialreads,exceptthatthesessionisreadingmultipledatablocksandscattersthemintodifferent
discontinuousbuffersintheSGA.ThisstatisticisNORMALLYindicatingdiskcontentiononfulltablescans.Rarely,datafromfulltable
scanscouldbefittedintoacontiguousbufferarea,thesewaitswouldthenshowupassequentialreadsinsteadofscatteredreads.
Thefollowingqueryshowsaveragewaittimeforsequentialversusscatteredreads:
promptAVERAGEWAITTIMEFORREADREQUESTS
selecta.average_waitSEQREAD,b.average_waitSCATREAD
fromsys.v_$system_eventa,sys.v_$system_eventb
wherea.event=dbfilesequentialread
andb.event=dbfilescatteredread'
WhatistheuseofPARFILEoptioninEXPcommand?
Nameoftheparameterfiletobepassedforexport.
WhatistheuseofTABLESoptioninEXPcommand?
Listoftablesshouldbeexported.ze )

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

96/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
WhatistheOPTIMALparameter?
Itisusedtosettheoptimallengthofarollbacksegment.
HowdoesoneuseORADEBUGfromServerManager/SQL*Plus?
ExecutetheORADEBUGHELPcommandfromsvrmgrlorsqlplustoobtainalistofvalidORADEBUGcommands.Lookatthese
examples:
SQLPLUS>REMTraceSQLstatementswithbindvariables
SQLPLUS>oradebugsetospid10121
Oraclepid:91,Unixprocesspid:10121,image:oracleorcl
SQLPLUS>oradebugEVENT10046tracenamecontextforever,level12
Statementprocessed.
SQLPLUS>!vi/app/oracle/admin/orcl/bdump/ora_10121.trc
SQLPLUS>REMTraceProcessStatistics
SQLPLUS>oradebugsetorapid2
Unixprocesspid:1436,image:ora_pmon_orcl
SQLPLUS>oradebugprocstat
Statementprocessed.
SQLPLUS>>oradebugTRACEFILE_NAME
/app/oracle/admin/orcl/bdump/pmon_1436.trc
SQLPLUS>REMListsemaphoresandsharedmemorysegmentsinuse
SQLPLUS>oradebugipc
SQLPLUS>REMDumpErrorStack
SQLPLUS>oradebugsetospid<pid>
SQLPLUS>oradebugeventimmediatetracenameerrorstacklevel3
SQLPLUS>REMDumpParallelServerDLMlocks
SQLPLUS>oradebuglkdebugaconvlock
SQLPLUS>oradebuglkdebugaconvres
SQLPLUS>oradebuglkdebugr<resourcehandle>(i.e0x8066d338fromconvresdump)
ArethereanyundocumentedcommandsinOracle?
Surethereare,butitishardtofindthem.Lookattheseexamples:
FromServerManager(Oracle7.3andabove):ORADEBUGHELP
ItlookslikeonecanchangememorylocationswiththeORADEBUGPOKEcommand.Anyonebraveenoughtotestthisoneforus?
PreviouslythisfunctionalitywasavailablewithORADBX(lsl$ORACLE_HOME/rdbms/lib/oradbx.omakeforacle.mkoradbx)
SQL*Plus:ALTERSESSIONSETCURRENT_SCHEMA=SYS
Ifthemaximumrecordretrievedpropertyofthequeryissetto10thenasummaryvaluewillbecalculated?Onlyfor10records.
Whatarethedifferentobjectsthatyoucannotcopyorreferenceinobjectgroups?
Objectsofdifferentmodules
Anotherobjectgroups
Individualblockdependentitems
Programunits.
WhatisanOLE?
ObjectLinking&EmbeddingprovidesyouwiththecapabilitytointegrateobjectsfrommanyMsWindowsapplicationsintoasingle
compounddocumentcreatingintegratedapplicationsenablesyoutousethefeaturesform.
Canarepeatingframebecreatedwithoutadatagroupasabase?
No
Isitpossibletosetafilterconditioninacrossproductgroupinmatrixreports?
No
WhatisOverloadingofprocedures?
TheSameprocedurenameisrepeatedwithparametersofdifferentdatatypesandparametersindifferentpositions,varyingnumber
ofparametersiscalledoverloadingofprocedures.e.g.DBMS_OUTPUTput_line
WhatarethereturnvaluesoffunctionsSQLCODEandSQLERRM?WhatisPragmaEXECPTION_INIT?Explaintheusage?
SQLCODEreturnsthelatestcodeoftheerrorthathasoccurred.
SQLERRMreturnstherelevanterrormessageoftheSQLCODE.
WhatarethedatatypesaavailableinPL/SQL?
SomescalardatatypessuchasNUMBER,VARCHAR2,DATE,CHAR,LONG,BOOLEAN.Somecompositedatatypessuchas
RECORD&TABLE.
Whatarethetwopartsofaprocedure?
ProcedureSpecificationandProcedureBody.
WhatisthebasicstructureofPL/SQL?
PL/SQLusesblockstructureasitsbasicstructure.AnonymousblocksornestedblockscanbeusedinPL/SQL
WhatisPL/SQLtable?
ObjectsoftypeTABLEarecalledPL/SQLtables,whicharemodeledas(butnotthesameas)databasetables,PL/SQLtablesusea
primaryPL/SQLtablescanhaveonecolumnandaprimarykey.Cursors

HopethisHelps..

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

97/98

4/30/2015

EssentialDBAInterviewQuestions|TechnologyLearning
Cheers!!

About these ads

alamshaikh19:37 onNovember21,2014
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment5)

amazingcollectionofinterviewquestions!!
cheers!

MohammedFareedHussain16:51 onNovember23,2014
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment36)

FantasticJobsGuys!

Arun19:24 onNovember23,2014
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment37)

SuperbSachinItwillhelpsfresherslots

Bhavik15:27 onJanuary1,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment49)

ThankYouVeryMuchSir..
AJ11:26 onFebruary1,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment50)

ItwilmakeEasytounderstandeverytng..goodcollection,,

rishi21:41 onFebruary18,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment54)

amazingcollection..

vamsi23:24 onFebruary24,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment69)

thisisonehellofablog!toogood.
SachinThapa23:27 onFebruary24,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment70)

Cheers!!
SachinThapa18:42 onFebruary25,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment71)

Kindlyshare!

Vinay11:27 onApril16,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment72)

Verymuchusefulinallessenceandthankstoeachandeveryonewhohasworkedonthispresentation.
SachinThapa02:14 onApril17,2015
Permalink(https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/commentpage1/#comment73)

cheers!!

CreateafreewebsiteorblogatWordPress.com.Theme:P2byWordPress.com.

https://techknowledgeworld.wordpress.com/2014/11/20/essentialdbainterviewquestions/

98/98

Vous aimerez peut-être aussi