SQL DBA Interview Questions
SQL DBA Interview Questions
A1)
Master
Records all the system-level information for an instance of SQL Server.
Database
Msdb
Is used by SQL Server Agent for scheduling alerts and jobs.
Database
Is used as the template for all databases created on the instance of SQL Server.
Model
Modifications made to the model database, such as database size, collation, recovery
Database
model, and other database options, are applied to any databases created afterward.
Is a read-only database that contains system objects that are included with SQL
Resource
Server. System objects are physically persisted in the Resource database, but they
Database
logically appear in the sys schema of every database.
Tempdb
Is a workspace for holding temporary objects or intermediate result sets.
Database
A2)
• Copy-only backup: A special-use backup that is independent of the regular sequence of
SQL Server backups.
• Differential backup: A data backup that is based on the latest full backup of a complete
or partial database or a set of data files or filegroups (the differential base) and that
contains only the data extents that have changed since the differential base.
• Full back up: A data backup that contains all the data in a specific database or set of
filegroups or files, and also enough log to allow for recovering that data.
• Log backup: A backup of transaction logs that includes all log records that were not
backed up in a previous log backup. (full recovery model)
• File backup: A backup of one or more database files or filegroups.
• Partial backup: Contains data from only some of the filegroups in a database, including
the data in the primary filegroup, every read/write filegroup, and any optionally-
specified read-only files.
A3)
a. You can use TSQL command BACKUP Database.
b. You can use SSMS to right click on a database and then take backup.
c. You can use 3 party utilities to take backups of database or even take snapshot backups
rd
of database.
Q4) If a stored procedure is running slow then what are the basics things you will check
to fix it?
A4)
a. Check whether it is blocked by some session.
b. Check if the statistics are updated on the underlying tables.
c. Check if the tables do not have a missing index.
d. Check if the indexes are not fragmented.
e. Check if the stored procedure follows common best practices such not using
SELECT *, DISTINCT, UNION and unnecessary joins.
A5) Delete command removes the rows from a table based on the condition that we provide with a
WHERE clause. Truncate will actually remove all the rows from a table and there will be no data in
the table after we run the truncate command.
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
A6) An identity column is one with value being generated automatically based on the initial SEED
value & increment.
Q15) Can you take transaction log backup in Simple recovery model?
A15) No
Q16. Which activity in SQL server you can relate with Durability property of ACID property? "Check
all that apply"
(a) Running Checkdb and confirming that database has no issue
(b) DCCC opentran
(c) Instance or Media Recovery
(d) Checkpoint
Ans : C
Q17 : Name some isolation level which follows pessimistic concurrency model?
Ans : A) Read committed
b) Repeatable Read
c) Read Uncommitted
d) Serializable
Q18) How can we migrate master database from one disk location to another (say C:\
drive to D:\ drive)
A18) Stop the SQL instance, manually copy the data and log files (mdf and ldf) to the new
location, edit the startup parameters –d and –l to the new path and start the SQL instance.
Q19) How can we migrate temp database from one disk location to another (say C:\
drive to D:\ drive)
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
A19) Use the ALTER DATABASE command to change the location of tempdb files to the new
location and simply restart the SQL instance.
Q20) How can we change the port of SQL instance? ...Does it require a restart of the
service?
A20) Port of a SQL instance can be changed from SQL Server Configuration Manager tool. Yes it
requires a restart of the SQL service.
Q21) If the Resource database files gets damaged or corrupted then how do we fix this
issue?
A21) If we have another SQL instance of the exact same version then we can simply copy the mdf
file of Resource database from that instance and replace it in place of the damaged file.
If we do not have a SQL instance of the same version then we need to rebuild the instance.
Q22) Which isolation level causes Phantom reads in SQL and which other isolation level
can we use to prevent it?
A21) Repeatable Read isolation level can result in Phantom reads and Serializable isolation level
can help prevent it.
Q23) How will you troubleshoot if some error is encountered during installation or
patching of SQL instances?
A23) Need to check the error thrown during the installation activity. Summary of installation of
patching is logged into a file named Summary.txt in Bootstrap folder of SQL installation path.
The Details.txt path gives more details about the installation logs. Depending upon the errors seen
in these files we will take our next step of troubleshooting.
Q24) Can you state at least one reason for which SQL patching can fail?
A24) Missing MSI and MSP files, damaged installation media, permission issues
Q26) What is the difference between High Availability offered by Failover Clustered
instances (FCI) and AlwaysOn?
A26) FCI offers HA at the SQL instance level and AlwaysON offers it at the database level.
Q27) Since which version of SQL Server the Alwayson feature was added?
A27) Starting with SQL Server 2012 the Alwayson feature was added.
Q30) What is the default ports of SQL instance, SQL Browser service and SQL mirroring
endpoint?
A30) SQL instance = 1433, SQL Browser service = 1434, Mirroring Endpoint = 5022.
Q31) What is the easiest way to determine the SQL instance installed on the server ?
(the numbers of instances and their names)
A31) From services.msc we can see all the installed SQL instances. The same can be done from
SQL Server Configuration Manager and Registry keys.
Q32) What different types of Query Joins are available in SQL Server?
A32) Nested Loops, Merge Joins, Hash Joins.
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
A1. Log File Growth will be slower as it cannot take advantage of Instant File Initialization.
Q2. Will SQL SERVER Service start If model database corrupted? NO, because to create tempdb we
need model database which act like a template.
Will SQL SERVER Service start If someone deleted tempdb data & log files? Yes because SQL
SERVER will recreate files again.
Q3. You have database mirroring configured between Server1 & Server2 in High Safety mode. For
example if we have failover and now Server2 become Principal then how application will connect to
new Principal Server?
A3. In Connection string we need to specify Failover Partner so application can connect to Server2 if
Server1 not responding.
Q4. Consider this scenario, we have AlwaysOn configured between ServerA and ServerB in
asynchronous-commit mode. Customer is complaining that after ServerA crashed they don't see
ServerB taking over as new Primary. How do you help customer?
A4. Automatic failover requires that both the primary replica and the target secondary replica are
running under synchronous-commit mode with the failover mode set to "Automatic".
PREPARATION CONCEPTS:
-----------------------------------------------------------------------
Checkpoint:
Lazy Writer:
Recovery phase :
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
----------------------------------------------------------------------------------------------
Check point :
Lazy write :
Log shipping :
============
Tuff file :
Installation :
=============
----------------------------------------------------
====================
Deadlock :
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
Performance :
============
What is CXPACKETS ?
High memory :
===========
MDF =
LDF =
• GAM/SGAM page?
[
• What is extent?
• AlwaysOn
• Resource Database.
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)
Rajasekhar Reddy Bolla WhatsApp: +91 9966246368
(find me in LinkedIn & YouTube)
New 56Th batch on: 17th Jan 2022(Monday) | 2 weeks | Daily 2 hours | Monday to Saturday 7.30 AM
to 9.30 AM IST | WhatsApp me +91-9966246368
Demo video: https://youtu.be/4FNsoL0fueo
Reach us on any help and support (Job & Interview) on SQL Server (On-premise &Azure)