Oracle DBA Interview Questions and Answers - Backup and Recovery
Oracle DBA Interview Questions and Answers - Backup and Recovery
Recovery
OracleBackupandRecoveryInterviewQuestionsandAnswers
Howwouldyoudecideyourbackupstrategyandtimingforbackup?Infactbackupstrategyispurely
dependsuponyourorganizationbusinessneed.
Ifnodowntimethendatabasemustberunonarchivelogmodeandyouhavetotakefrequentlyordailybackup.
Ifsufficientdowntimeisthereandlossofdatawouldnotaffectyourbusinessthenyoucanrunyourdatabasein
noarchivelogmodeandbackupcanbetakeninfrequentlyorweeklyormonthly.
Inmostofthecaseinanorganizationwhennodowntimethenfrequentinconsistentbackupneeded(daily
backup),multiplexonlineredologfiles(multiplecopies),differentlocationforredologfiles,databasemustrun
inarchivelogmodeanddataguardcanbeimplementedforextrabitofprotection.
WhatisdifferencebetweenRestoringandRecoveryofdatabase?
Restoringmeanscopyingthedatabaseobjectfromthebackupmediatothedestinationwhereactuallyitis
requiredwhereasrecoverymeanstoapplythedatabaseobjectcopiedearlier(rollforward)inordertobring
thedatabaseintoconsistentstate.
Whatisthedifferencebetweencompleteandincompleterecovery?Anincompletedatabaserecoveryisa
recoverythatitdoesnotreachtothepointoffailure.TherecoverycanbeeitherpointoftimeorparticularSCN
orParticulararchivelogspeciallyincaseofmissingarchivelogorredologfailurewhereasacompleterecovery
recoverstothepointoffailurepossiblywhenhavingallarchivelogbackup.
WhatisthebenefitofrunningtheDBinarchivelogmodeovernoarchivelogmode?
Whenadatabaseisinnoarchivelogmodewheneverlogswitchhappenstherewillbealossofsomeredoes
loginformationinordertoavoidthis,redologsmustbearchived.Thiscanbeachievedbyconfiguringthe
databaseinarchivelogmode.
Ifanoracledatabaseiscrashed?Howwouldyourecoverthattransactionwhichisnotinbackup?Ifthe
databaseisinarchivelogwecanrecoverthattransactionotherwisewecannotrecoverthattransactionwhichis
notinbackup.
WhatisthedifferencebetweenHOTBACKUPandRMANbackup?
Forhotbackupwehavetoputdatabaseinbeginbackupmode,thentakebackupwhereasRMANwouldnot
putdatabaseinbeginbackupmode.RMANisfastercanperformincremental(changesonly)backup,anddoes
notplacetablespaceinhotbackupmode.
CanweuseSametargetdatabaseasCatalogdatabase?
No,therecoverycatalogshouldnotresideinthetargetdatabase(databasetobebackedup)becausethe
databasecannotberecoveredinthemountedstate.
Incrementalbackuplevels:
Level0fullbackupthatcanbeusedforsubsequentincrementals
RMAN>backupincrementallevel0database
DifferentialLevel1onlytheblocksthathavechangedsincethelastbackup(whetheritislevel0orlevel1)
RMAN>backupincrementallevel1differentialdatabase
CumulativeLevel1allchangessincethelastlevel0incrementalbackup
RMAN>backupincrementallevel1cumulativedatabase
Afullbackupcannotbeusedforacumulativelevel1backup.
Acumulativelevel1backupmustbedoneontopofanincrementallevel0backup.
WhyRMANincrementalbackupfailseventhoughfullbackupexists?IfyouhavetakentheRMANfull
backupusingthecommandBackupdatabase,whereasalevel0backupisphysicallyidenticaltoafullbackup.
Theonlydifferenceisthatthelevel0backupisrecordedasanincrementalbackupintheRMANrepositorysoit
canbeusedastheparentforalevel1backup.Simplythefullbackupwithoutlevel0cannotbeconsideredas
aparentbackupfromwhichyoucantakelevel1backup.
CanweperformRMANlevel1backupwithoutlevel0?Ifnolevel0isavailable,thenthebehaviordepends
uponthecompatibilitymodesetting(oracleversion).
Ifthecompatibilitymodelessthan10.0.0,RMANgeneratesalevel0backupoffilescontentsatthetimeof
backup.
Ifthecompatibilityisgreaterthan10.0.0,RMANcopiesallblockchangessincethefilewascreated,andstores
theresultsaslevel1backup.
HowtoputManual/UsermanagedbackupinRMAN?Incaseofrecoverycatalog,youcanputbyusing
catalogcommand:
RMAN>CATALOGSTARTWITH/oracle/backup.ctl
HowtocheckRMANversioninoracle?IfyouwanttocheckRMANcatalogversionthenusethebelowquery
fromSQL*plus
SQL>Select*fromrcver
WhathappensactuallyincaseofinstanceRecovery?WhileOracleinstancefails,Oracleperformsan
InstanceRecoverywhentheassociateddatabaseisbeingrestarted.Instancerecoveryoccursin2steps:
Cacherecovery:Changesbeingmadetoadatabasearerecordedinthedatabasebuffercacheaswellas
redologfilessimultaneously.Whenthereareenoughdatainthedatabasebuffercache,theyarewrittento
datafiles.IfanOracleinstancefailsbeforethesedataarewrittentodatafiles,Oracleusesonlineredologfiles
torecoverthelostdatawhentheassociateddatabaseisrestarted.Thisprocessiscalledcacherecovery.
Transactionrecovery:Whenatransactionmodifiesdatainadatabase(thebeforeimageofthemodifieddata
isstoredinanundosegmentwhichisusedtorestoretheoriginalvaluesincasethetransactionisrolledback).
Atthetimeofaninstancefailure,thedatabasemayhaveuncommittedtransactions.Itispossiblethatchanges
madebytheseuncommittedtransactionshavegottensavedindatafiles.Tomaintainreadconsistency,Oracle
rollsbackalluncommittedtransactionswhentheassociateddatabaseisrestarted.Oracleusestheundodata
storedinundosegmentstoaccomplishthis.Thisprocessiscalledtransactionrecovery.
MyDatabasehasLevel1backup,tellmewhatareallbackedup?withExample?
DatabaseisUPandhastakenLevel0backup,isthebackuptakenisConsistentorInconsistent?
HowdoyousayabackupisConsistentorInconsistent,OracleTerminology?
CanwetakebackupwhentheDatabaseisdown?
IfihaveaRMANfullbackupLevel0ofSun@9PM,onMon9PMtakenincrementalLevel1
backup.Whattypeofbackupdoyougetandwhatisactuallybackedup?
IfihaveaRMANfullbackupofSun@9PM,onMon9PMtakenincrementalLevel1backup.OnTuesday
DatabaseCrashed.Whattypeofbackupdoyougetandwhatisactuallybackedup?
ThereisnoBackupavailable,CanwetakeaLevel1backup?
Atablegotdroppedbetween9AM11AMhowtogettheTablebackupusingRMAN,
DBsize500GBavailablemountpointspacefortablerecoveryis15GB?
SysAdminhaschangedthetimefrom10:00AMto9:30AM,tabledropped,Howdoyourecoverthe
Table?
ADATAFILEiscorruptedandthereisnobackup,Howtorecoverthedatafile?
AllControlfilesarecorrupted,Howtorecoverthecontrolfile?