DBAquestions.docx
- 文档编号:7406603
- 上传时间:2023-05-11
- 格式:DOCX
- 页数:28
- 大小:28.64KB
DBAquestions.docx
《DBAquestions.docx》由会员分享,可在线阅读,更多相关《DBAquestions.docx(28页珍藏版)》请在冰点文库上搜索。
DBAquestions
MikeAult’sInterviewQuestionsforOracle,DBA,DeveloperCandidates
Scoreeachquestionona1-5or1-10scale.
DBASections:
SQL/SQLPLUS,PL/SQL,Tuning,Configuration,Troubleshooting
DeveloperSections:
SQL/SQLPLUS,PL/SQL,DataModeling
DataModeler:
DataModeling
AllcandidatesforUNIXshop:
UNIX
PL/SQLQuestions:
1.Describethedifferencebetweenaprocedure,functionandanonymouspl/sqlblock.
Level:
Low
Expectedanswer:
CandidateshouldmentionuseofDECLAREstatement,afunctionmustreturnavaluewhileaproceduredoesn’thaveto.
Score:
____________Comment:
________________________________________________________
2.Whatisamutatingtableerrorandhowcanyougetaroundit?
Level:
Intermediate
Expectedanswer:
Thishappenswithtriggers.Itoccursbecausethetriggeristryingtoupdatearowitiscurrentlyusing.Theusualfixinvolveseitheruseofviewsortemporarytablessothedatabaseisselectingfromonewhileupdatingtheother.
Score:
____________Comment:
________________________________________________________
3.Describetheuseof%ROWTYPEand%TYPEinPL/SQL
Level:
Low
Expectedanswer:
%ROWTYPEallowsyoutoassociateavariablewithanentiretablerow.The%TYPEassociatesavariablewithasinglecolumntype.
Score:
____________Comment:
________________________________________________________
4.Whatpackages(ifany)hasOracleprovidedforusebydevelopers?
Level:
Intermediatetohigh
Expectedanswer:
OracleprovidestheDBMS_seriesofpackages.TherearemanywhichdevelopersshouldbeawareofsuchasDBMS_SQL,DBMS_PIPE,DBMS_TRANSACTION,DBMS_LOCK,DBMS_ALERT,DBMS_OUTPUT,DBMS_JOB,DBMS_UTILITY,DBMS_DDL,UTL_FILE.Iftheycanmentionafewoftheseanddescribehowtheyusedthem,evenbetter.IftheyincludetheSQLroutinesprovidedbyOracle,great,butnotreallywhatwasasked.
Score:
____________Comment:
________________________________________________________
5.DescribetheuseofPL/SQLtables
Level:
Intermediate
Expectedanswer:
PL/SQLtablesarescalararraysthatcanbereferencedbyabinaryinteger.Theycanbeusedtoholdvaluesforuseinlaterqueriesorcalculations.InOracle8theywillbeabletobeofthe%ROWTYPEdesignation,orRECORD.
Score:
____________Comment:
________________________________________________________
6.Whenisadeclarestatementneeded?
Level:
Low
TheDECLAREstatementisusedinPL/SQLanonymousblockssuchaswithstandalone,non-storedPL/SQLprocedures.ItmustcomefirstinaPL/SQLstandalonefileifitisused.
Score:
____________Comment:
________________________________________________________
7.Inwhatordershouldaopen/fetch/loopsetofcommandsinaPL/SQLblockbeimplementedifyouusethe%NOTFOUNDcursorvariableintheexitwhenstatement?
Why?
Level:
Intermediate
Expectedanswer:
OPENthenFETCHthenLOOPfollowedbytheexitwhen.Ifnotspecifiedinthisorderwillresultinthefinalreturnbeingdonetwicebecauseofthewaythe%NOTFOUNDishandledbyPL/SQL.
Score:
____________Comment:
________________________________________________________
8.WhatareSQLCODEandSQLERRMandwhyaretheyimportantforPL/SQLdevelopers?
Level:
Intermediate
Expectedanswer:
SQLCODEreturnsthevalueoftheerrornumberforthelasterrorencountered.TheSQLERRMreturnstheactualerrormessageforthelasterrorencountered.Theycanbeusedinexceptionhandlingtoreport,or,storeinanerrorlogtable,theerrorthatoccurredinthecode.TheseareespeciallyusefulfortheWHENOTHERSexception.
Score:
____________Comment:
________________________________________________________
9.HowcanyoufindwithinaPL/SQLblock,ifacursorisopen?
Level:
Low
Expectedanswer:
Usethe%ISOPENcursorstatusvariable.
Score:
____________Comment:
________________________________________________________
10.HowcanyougeneratedebuggingoutputfromPL/SQL?
Level:
Intermediatetohigh
Expectedanswer:
UsetheDBMS_OUTPUTpackage.AnotherpossiblemethodistojustusetheSHOWERRORcommand,butthisonlyshowserrors.TheDBMS_OUTPUTpackagecanbeusedtoshowintermediateresultsfromloopsandthestatusofvariablesastheprocedureisexecuted.ThenewpackageUTL_FILEcanalsobeused.
Score:
____________Comment:
________________________________________________________
11.Whatarethetypesoftriggers?
Level:
Intermediatetohigh
ExpectedAnswer:
Thereare12typesoftriggersinPL/SQLthatconsistofcombinationsoftheBEFORE,AFTER,ROW,TABLE,INSERT,UPDATE,DELETEandALLkeywords:
BEFOREALLROWINSERT
AFTERALLROWINSERT
BEFOREINSERT
AFTERINSERT
etc.
Score:
____________Comment:
________________________________________________________
Sectionaveragescore:
__________________________________Level:
__________________________
DBA:
1.Giveonemethodfortransferringatablefromoneschematoanother:
Level:
Intermediate
ExpectedAnswer:
Thereareseveralpossiblemethods,export-import,CREATETABLE...ASSELECT,orCOPY.
Score:
____________Comment:
________________________________________________________
2.WhatisthepurposeoftheIMPORToptionIGNORE?
Whatisit’sdefaultsetting?
Level:
Low
ExpectedAnswer:
TheIMPORTIGNOREoptiontellsimporttoignore“alreadyexists”errors.Ifitisnotspecifiedthetablesthatalreadyexistwillbeskipped.Ifitisspecified,theerrorisignoredandthetablesdatawillbeinserted.ThedefaultvalueisN.
Score:
____________Comment:
________________________________________________________
3.Youhavearollbacksegmentinaversion7.2databasethathasexpandedbeyondoptimal,howcanitberestoredtooptimal?
Level:
Low
Expectedanswer:
UsetheALTERTABLESPACE.....SHRINKcommand.
Score:
____________Comment:
________________________________________________________
4.IftheDEFAULTandTEMPORARYtablespaceclausesareleftoutofaCREATEUSERcommandwhathappens?
Isthisbadorgood?
Why?
Level:
Low
Expectedanswer:
TheuserisassignedtheSYSTEMtablespaceasadefaultandtemporarytablespace.ThisisbadbecauseitcausesuserobjectsandtemporarysegmentstobeplacedintotheSYSTEMtablespaceresultinginfragmentationandimpropertableplacement(onlydatadictionaryobjectsandthesystemrollbacksegmentshouldbeinSYSTEM).
Score:
____________Comment:
________________________________________________________
5.WhataresomeoftheOracleprovidedpackagesthatDBAsshouldbeawareof?
Level:
IntermediatetoHigh
Expectedanswer:
OracleprovidesanumberofpackagesintheformoftheDBMS_packagesownedbytheSYSuser.ThepackagesusedbyDBAsmayinclude:
DBMS_SHARED_POOL,DBMS_UTILITY,DBMS_SQL,DBMS_DDL,DBMS_SESSION,DBMS_OUTPUTandDBMS_SNAPSHOT.TheymayalsotrytoanswerwiththeUTL*.SQLorCAT*.SQLseriesofSQLprocedures.Thesecanbeviewedasextracreditbutaren’tpartoftheanswer.
Score:
____________Comment:
________________________________________________________
6.Whathappensiftheconstraintnameisleftoutofaconstraintclause?
Level:
Low
Expectedanswer:
TheOraclesystemwillusethedefaultnameofSYS_Cxxxxwherexxxxisasystemgeneratednumber.Thisisbadsinceitmakestrackingwhichtabletheconstraintbelongstoorwhattheconstraintdoesharder.
Score:
____________Comment:
________________________________________________________
7.Whathappensifatablespaceclauseisleftoffofaprimarykeyconstraintclause?
Level:
Low
Expectedanswer:
Thisresultsintheindexthatisautomaticallygeneratedbeingplacedinthenusersdefaulttablespace.Sincethiswillusuallybethesametablespaceasthetableisbeingcreatedin,thiscancauseseriousperformanceproblems.
Score:
____________Comment:
________________________________________________________
8.Whatisthepropermethodfordisablingandre-enablingaprimarykeyconstraint?
Level:
Intermediate
Expectedanswer:
YouusetheALTERTABLEcommandforboth.However,fortheenableclauseyoumustspecifytheUSINGINDEXandTABLESPACEclauseforprimarykeys.
Score:
____________Comment:
________________________________________________________
9.Whathappensifaprimarykeyconstraintisdisabledandthenenabledwithoutfullyspecifyingtheindexclause?
Level:
Intermediate
Expectedanswer:
Theindexiscreatedintheuser’sdefaulttablespaceandallsizinginformationislost.Oracledoesn’tstorethisinformationasapartoftheconstraintdefinition,butonlyaspartoftheindexdefinition,whentheconstraintwasdisabledtheindexwasdroppedandtheinformationisgone.
Score:
____________Comment:
________________________________________________________
10.(OnUNIX)WhenshouldmorethanoneDBwriterprocessbeused?
Howmanyshouldbeused?
Level:
High
Expectedanswer:
IftheUNIXsystembeingusediscapableofasynchronousIOthenonlyoneisrequired,ifthesystemisnotcapableofasynchronousIOthenuptotwicethenumberofdisksusedbyOraclenumberofDBwritersshouldbespecifiedbyuseofthedb_writersinitializationparameter.
Score:
____________Comment:
________________________________________________________
11.Youareusinghotbackupwithoutbeinginarchivelogmode,canyourecoverintheeventofafailure?
Whyorwhynot?
Level:
High
Expectedanswer:
Youcan’tusehotbackupwithoutbeinginarchivelogmode.Sono,youcouldn’trecover.
Score:
____________Comment:
________________________________________________________
12.Whatcausesthe“snapshottooold”error?
Howcanthisbepreventedormitigated?
Level:
Intermediate
Expectedanswer:
Thisiscausedbylargeorlongrunningtransactionsthathaveeitherwrappedontotheirownrollbackspaceorhavehadanothertransactionwriteonpartoftheirrollbackspace.Thiscanbeprevent
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- DBAquestions