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