Sunteți pe pagina 1din 11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

SQLServerDBAQandA
ThispagecontainsSQLServerDatabaseAdminInterviewQuestionsforexperienced,I
amsureyoumusthavereadfundamentalquestionslikeWhatisRDBMS,Whatisa
view, What is a database etc etc This list of SQL Server DBA Questions and
Answers has less of those questions and more stuff that is expected to be asked in
DBAinterviews
Im sure you will find plenty of new Interview Questions and Answers for SQL Server
2008and2008R2thatareusefulforyourInterviewpreparation.
1.ExplainaboutyourSQLServerDBAExperience.
Thisisagenericquestionoftenaskedbymanyinterviewers.Explainwhatarethe
differentSQLServerVersionsyouhaveworkedon,whatkindofadministrationof
thoseinstanceshasbeendonebyyou.Yourroleandresponsibilitiescarriedoutin
yourearlierprojectsthatwouldbeofsignificancetothepotentialemployer.Thisis
theanswerthatletstheinterviewerknowhowsuitableareyouforthepositionto
whichyouarebeinginterviewed.
2.WhatarethedifferentSQLServerVersionsyouhaveworkedon?
Theanswerwouldbedependingontheversionsyouhaveworkedon,Iwouldsay
IhaveexperienceworkinginSQLServer7,SQLServer2000,2005and2008.If
you have worked only the some version be honest in saying that, remember, no
onewouldbeworkingonallversions,itvariesfromindividualtoindividual.
3.WhatarethedifferenttypesofIndexesavailableinSQLServer?
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

1/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

ThesimplestanswertothisisClusteredandNonClusteredIndexes.Thereare
othertypesofIndexeswhatcanbementionedsuchasUnique,XML,Spatialand
FilteredIndexes.MoreontheseIndexeslater.
4.WhatisthedifferencebetweenClusteredandNonClusteredIndex?
In a clustered index, the leaf level pages are the actual data pages of the table.
When a clustered index is created on a table, the data pages are arranged
accordingly based on the clustered index key. There can only be one
Clusteredindexonatable.
In a NonClustered index, the leaf level pages does not contain data pages
instead it contains pointers to the data pages. There can multiple non
clusteredindexesonasingletable.
5.WhatarethenewfeaturesinSQLServer2005whencomparedtoSQLServer
2000?
TherearequitealotofchangesandenhancementsinSQLServer2005.Fewofthem
arelistedhere:
DatabasePartitioning
DynamicManagementViews
SystemCatalogViews
ResourceDatabase
DatabaseSnapshots
SQLServerIntegrationServices
SupportforAnalysisServicesonaaFailoverCluster.
ProfilerbeingabletotracetheMDXqueriesoftheAnalysisServer.
PeertoPeerReplication
DatabaseMirroring
6.WhataretheHighAvailabilitysolutionsinSQLServeranddifferentiatethem
briefly.
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

2/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

Failover Clustering, Database Mirroring, Log Shipping and Replication are the
HighAvailabilityfeaturesavailableinSQLServer.Iwouldrecommendreadingthis
blog of mine which explains the differences between these 4 features.
ComparingtheHighAvailabilityFeaturesinSQLServer2005
7.HowdoyoutroubleshooterrorsinaSQLServerAgentJob?
Inside SSMS, in Object explorer under SQL Server Agent look for Job Activity
Monitor.Thejobactivitymonitordisplaysthecurrentstatusofallthejobsonthe
instance. Choose the particular job which failed, right click and choose
view history from the drop down menu. The execution history of the job is
displayedandyoumaychoosetheexecutiontime(ifthejobfailedmultipletimes
duringthesameday).Therewouldinformationsuchasthetimeittooktoexecute
thatJobanddetailsabouttheerroroccurred.
8.WhatisthedefaultPortNoonwhichSQLServerlistens?
1433
9.HowmanyfilescanaDatabasecontaininSQLServer?Howmanytypesofdata
files exists in SQL Server? How many of those files can exist for a single
database?
ADatabasecancontainamaximumof32,767files.
TherearePrimarily2typesofdatafilesPrimarydatafileandSecondarydata
file(s)
TherecanbeonlyonePrimarydatafileandmultiplesecondarydatafilesaslong
asthetotal#offilesislessthan32,767files
AddedonDec30th2010
10.WhatisDCL?
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

3/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

DCLstandsforDataControlLanguage.
11.WhatarethecommandsusedinDCL?
GRANT,DENYandREVOKE.
12.WhatisFillFactor?
Fill Factor is a setting that is applicable to Indexes in SQL Server. The fill
factor value determines how much data is written to an index page when it is
created/rebuilt.
13.Whatisthedefaultfillfactorvalue?
Bydefaultthefillfactorvalueissetto0.
14.WheredoyoufindthedefaultIndexfillfactorandhowtochangeit?
The easiest way to find and change the default fill factor value is from
Management Studio, rightclick the SQL Server and choose properties. In the
ServerProperties,chooseDatabaseSettings,youshouldseethedefaultfillfactor
valueinthetopsection.YoucanchangetoadesiredvaluethereandclickOKto
savethechanges.
Theotheroptionofviewingandchangingthisvalueisusingsp_configure.
AddedonOct29th2011
15.Whatisasystemdatabaseandwhatisauserdatabase?
System databases are the default databases that are installed when the SQL
Server is installed. Basically there are 4 system databases: Master, MSDB,
TempDB and Model. It is highly recommended that these databases are not
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

4/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

modifiedoralteredforsmoothfunctioningoftheSQLSystem.
Auserdatabaseisadatabasethatwecreatetostoredataandstartworkingwith
thedata.
16.Whataretherecoverymodelsforadatabase?
Thereare3recoverymodelsavailableforadatabase.Full,BulkLoggedand
Simplearethethreerecoverymodelsavailable.
17.Whatistheimportanceofarecoverymodel?
Primarily,recoverymodelischosenkeepinginviewtheamountofdatalossone
can afford to. If one expects to have minimal or no data loss, choosing the Full
recoverymodelisagoodchoice.Dependingontherecoverymodelofadatabase,
the behavior of database log file changes. I would recommend you read
more material on log backups and log file behavior and so on to understand in
depth.
AddedonNov9th2011
18.WhatisReplication?
ReplicationisafeatureinSQLServerthathelpsuspublishdatabaseobjectsand
data and copy (replicate) it to one or more destinations.Itisoftenconsideredas
oneoftheHighAvailabilityoptions.OneoftheadvantageswithReplicationisthat
itcanbeconfiguredondatabaseswhichareinsimplerecoverymodel.
19.WhatthedifferenttypesofReplicationandwhyaretheyused?
There are basically 3 types of replication: Snapshot, Transactional and Merge
Replication. The type of Replication you choose, depends on the requirements
and/or the goals one is trying to achieve. For example Snapshot Replication is
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

5/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

useful only when the data inside the tables does not change frequently and the
amountofdataisnottoolarge,suchasamonthlysummarytableoraproductlist
table etc. Transactional Replication would useful when maintaining a copy of a
transactional table such as sales order tables etc. Merge Replication is more
useful in case of remote / distributed systems where the data flow can be from
multiplesites,forexamplesalesdoneatapromotionaleventswhichmightnotbe
connectedtothecentralserversalways..
20.WhatthedifferentcomponentsinReplicationandwhatistheiruse?
The 3 main components in Replication are Publisher, Distributor and Subscriber.
Publisher is the data source of a publication. Distributor is responsible for
distributing the database objects to one or more destinations. Subscriber is the
destinationwherethepublishersdataiscopied/replicated.
21.WhatthedifferentTopologiesinwhichReplicationcanbeconfigured?
Replication can be configured in any topology depending keeping in view of the
complexity and the workload of the entire Replication. It can be any of the
following:
Publisher,DistributorandSubscriberonthesameSQLInstance.
PublisherandDistributoronthesameSQLInstanceandSubscriberonaseparate
Instance.
Publisher,DistributorandSubscriberonindividualSQLInstances.
AddedonNov12th2011
22.IfyouaregivenaccesstoaSQLServer,howdoyoufindiftheSQLInstanceis
anamedinstanceoradefaultinstance?
IwouldgototheSQLServerConfigurationManager.Intheleftpaneofthetool,I
would select SQL Server Services, the right side pane displays all of the SQL
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

6/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

ServerServices/componentsthatareinstalledonthatmachine.IftheServiceis
displayed as (MSSQLSERVER), then it indicates it is a default instance, else
therewillbetheInstancenamedisplayed.
23. What are the different Authentication modes in SQL Server and how can you
changeauthenticationmode?
SQL Server has 2 Authentication modes Windows Authentication and SQL
Server and Windows Authentication mode also referred as Mixed Mode. To
change the Authentication mode, read one of my blogs Changing SQL Server
AuthenticationMode.
The following Question and Answers on SQL Server High Availability were
AddedonNov28th2011
24. What are the differences in Clustering in SQL Server 2005 and 2008 or 2008
R2?
On SQL Server 2005, installing SQL Server failover cluster is a single step
processwhereasonSQLServer2008oraboveitisamultistepprocess.Thatis,
inSQLServer2005,theInstallationprocessitselfinstallsonallofthenodes(beit
2nodesor3nodes).In2008orabovethishaschanged,wewouldneedtoinstall
separatelyonallthenodes.2timesifitisa2nodeclusteror3timesina3node
clusterandsoon
25.WhatismeantbyActivePassiveandActiveActiveclusteringsetup?
AnActivePassiveclusterisafailoverclusterconfiguredinawaythatonlyone
clusternodeisactiveatanygiventime.Theothernode,calledasPassivenode
is always online but in an idle condition, waiting for a failure of the Active Node,
upon which the Passive Node takes over the SQL Server Services and this
becomestheActiveNode,thepreviousActiveNodenowbeingaPassiveNode.
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

7/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

AnActiveActive cluster is a failover cluster configured in a way that both the


clusternodesareactiveatanygivenpointoftime.Thatis,oneInstanceofSQL
Server is running on each of the nodes always when one of the nodes has a
failure,boththeInstancesrunontheonlyonenodeuntilthefailednodeisbrought
up(afterfixingtheissuethatcausedthenodefailure).Theinstanceisthenfailed
overbacktoitsdesignatednode.
26.ListoutsomeoftherequirementstosetupaSQLServerfailovercluster.
Virtual network name for the SQL Server, Virtual IP address for SQL Server, IP
addressesforthePublicNetworkandPrivateNetwork(alsoreferredasHearbeat)
for each node in the failover cluster, shared drives for SQL Server Data and Log
files,QuorumDiskandMSDTCDisk.
27.OnaWindowsServer2003ActivePassivefailovercluster,howdoyoufind
thenodewhichisactive?
Using Cluster Administrator, connect to the cluster and select the SQL Server
cluster.OnceyouhaveselectedtheSQLServergroup,intherighthandsideof
theconsole,thecolumnOwner gives us the information of the node on which
theSQLServergroupiscurrentlyactive.
28.HowdoyouopenaClusterAdministrator?
From Start > Run and type CluAdmin (case insensitive) and the Cluster
AdministratorconsoleisdisplayedORyoucanalsogotoStart>Allprograms>
AdministrativeTools>ClusterAdministrator.
29.Duetosomemaintenancebeingdone,theSQLServeronafailovercluster
needstobebroughtdown.HowdoyoubringtheSQLServerdown?
IntheClusterAdministrator,rickclickontheSQLServerGroupandfromthe
popupmenuitemchooseTakeOffline.
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

8/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

ThefollowingQuestionandAnswerswereaddedrecently.(onDec14th2011)
30.WhatarethedifferentwaysyoucancreateDatabasesinSQLServer?
TSQLCreateDatabasecommand.
UsingManagementStudio
Restoringadatabasebackup
CopyDatabasewizard
31. When setting Replication, can you have Distributor on SQL Server 2005,
PublisheronSQLServer2008?
NoyoucannothaveaDistributoronapreviousversionthanthePublisher.
32. When setting Replication, is it possible to have a Publisher as 64 Bit SQL
ServerandDistributororSubscribersasa32BitSQLServer.
YesitispossibletohavevariousconfigurationsinaReplicationenvironment.
33. What is the difference between dropping a database and taking a database
offline?
Dropdatabasedeletesthedatabasealongwiththephysicalfiles,itisnotpossible
tobringbackthedatabaseunlessyouhaveabackupofthedatabase.Whenyou
take a database offline, you the database is not available for users, it is not
deletedphysically,itcanbebroughtbackonline.
34.Whichautogrowthdatabasesettingisgood?
SettinganautogrowthinmultiplesofMBisabetteroptionthansettingautogrowth
inpercentage(%).
35. What are the different types of database compression introduced in SQL
Server2008?
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

9/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

RowcompressionandPagecompression.
36.WhatarethedifferenttypesofUpgradesthatcanbeperformedinSQLServer?
InplaceupgradeandSidebySideUpgrade.
37.WhatisTransparentDataEncryption?
Introduced in SQL Server 2008 Transparent Data Encryption (TDE) is a
mechanism through which you can protect the SQL Server Database files from
unauthorized access through encryption. Also, TDE can protect the database
backupsoftheinstanceonwhichTDEwassetup.
38. Does Transparent Data Encryption provide encryption when transmitting data
acrossnetwork?
No,TransparentDataEncryption(TDE)doesnotencryptthedataduringtransfer
overacommunicationchannel.
39.WhataretheoperatingmodesinwhichDatabaseMirroringruns?
Database Mirroring runs in 2 operating modes HighSafety Mode and High
PerformanceMode.
40. What is the difference between the 2 operating modes of Database Mirroring
(mentionedinaboveanswer)?
HighSafety Mode is to ensure that the Principal and Mirrored database are
synchronized state, that is the transactions are committed at the same time on
bothserverstoensureconsistency,butthereis/mightbeatimelag.
HighPerformanceModeistoensurethatthePrincipaldatabaserunfaster,bynot
waiting for the Mirrored database to commit the transactions. There is a slight
http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

10/11

11/6/2015

SQLServerDBAQandA|LearnSQLWithBru

chance of data loss and also the Mirrored database can be lagging behind (in
terms being up to date with Principal database) if there is a heavy load on the
MirroredServer.
Doyoulikethissite?LikeourFBpage@Facebook.com\LearnSQLWithBrusothat,
youknowwhenthereisanewblogpost.
BruMedishetty

42THOUGHTSONSQLSERVERDBAQANDA

sam
onMay14,2014at2:00AMsaid:

Broreallygood,imlearningalotfromthissitereally.
expectingmorefromu.thankusomuch

sam
onMay14,2014at2:04AMsaid:

canuexplainbrieflyaboutclusteredindexandnonclustered
indexbecozimafresher,coursedonehavingsomedoubt

http://learnsqlwithbru.com/sqlserverinterviewquestionsandanswers/sqlserverdbaqanda/

11/11