SlideShare a Scribd company logo
3
Most read
4
Most read
SQL Server DBA interview questions
What are the steps to take to improve performance of a poor
performing query?
• Maximum use of indexes, stored procures should be done.
• Avoid excessive use of complicated joins and cursors.
• Avoid using conditional operators using columns of different tables.
• Make use of computed columns and rewriting the query.
What is a deadlock and what is a live lock? How will you go about
resolving deadlocks?
A deadlock occurs when two or more processes waits for a resource that is
acquired by or is under the control of another process. A live lock is similar to
a deadlock except the process states keeps changing. The result of such
state is that none of the process will be complete.
Deadlock detection finds and resolves deadlocks. A WFG strategy is followed.
WFG is wait for graph. In WFG, processes are represented by nodes while
dependencies are represented by edges. Thus, if process A is waiting for a
resource held by process B, there is an edge in the WFG from the node for
process A to the node for process B. a cycle is this graph is a deadlock. WFG
constantly checks for cycles or when a process is blocked and adds a new
edge to the WFG. When a cycle is found, a victim is selected and aborted.
What is blocking and how would you troubleshoot it?
Blocking occurs when two or more rows are locked by one SQL connection
and a second connection to the SQL server requires a conflicting on lock on
those rows. This results in the second connection to wait until the first lock is
released.
Troubleshooting blocking:
• SQL scripts can be written that constantly monitor the state of locking
and blocking on SQL Server
• The common blocking scenarios must be identified and resolved.
• The scripts output must be checked constantly,
• The SQL profilers data must be examined regularly to detect blocking.
Explain the different types of BACKUPs available in SQL Server.
Complete database backup: This type of backup will backup all the
information in the database. Used most commonly for disaster recovery and
takes the longest time to backup.
Differential databse backup: The database is divided into partitions that have
been modified since last complete backup. Most suitable for large databases.
The most recent differential backup contains the changes from previous
backups.
Transaction log backups: Backups only the changes logged in the transaction
log. The transaction log has all changes logged about a database. Once the
changes are accommodated on the database, the log is truncated or backed
up.
File/File Group backups: used to recover individual files or file groups. Each
filegroup can be individually backed up. This helps in recovery only the
required file or filegroup for disaster recovery.
What is database isolation in SQL Server?
Isolation in database defines how and when changes made by one
transaction can be visible to other transactions. Different isolation levels are:
• Serializable
• Repeatable read
• Read committed
• Read uncommitted
What is a Schema in SQL Server 2005? Explain how to create a new
Schema in a Database?
A schema is used to create database objects. It can be created using CREATE
SCHEMA statement. The objects created can be moved between schemas.
Multiple database users can share a single default schema.
CREATE SCHEMA sample;
Table creation
Create table sample.sampleinfo
{
id int primary key,
name varchar(20)
}
Explain how to create a Scrollable Cursor with the SCROLL Option.
Using the SCROLL keyword while declaring a cursor allows fetching of rows in
any sequence
Example:
DECLARE employee_curs SCROLL CURSOR FOR SELECT * FROM employee;
The active set of the cursor is stored can be accessed in any order without
the need of opening and closing the cursor. The Scroll cursors can be set for
select and function cursors but not insert or update statements.
Explain how to create a Dynamic Cursor with the DYNAMIC Option.
When a cursor is declared as DYNAMIC, the cursor reflects all changes made
to the base tables as the cursor is scrolled around.
Declare cursor_name cursor
[ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ]
FOR select_statement
The dynamic option does not support ABSOLUTE FETCH.
What are database files and filegroups?
Database files are used for mapping the database over some operating
system files. Data and log information are separate. SQL server database has
three types of database files:
Primary: starting point of a database. It also points to other files in database.
Extension: .mdf
Secondary: All data files except primary data file is a part of secondary files.
Extension: .ndf
Log files: All log information used to recover database. Extension: .ldf
Describe in brief Databases and SQL Server Databases Architecture.
SQL Server consists of a set of various components which fulfill data storage
and data analysis needs for enterprise applications. Database architecture:
All the data is stored in databases which is organized into logical components
visible to the end users. It’s only the administrator who needs to actually
deal with the physical storage aspect of the databases, whereas users only
deal with database tables.
Every SQL Server instance has primarily 4 system database i.e. master,
model, tempdb and msdb. All other databases are user created databases as
per their needs and requirements.
A single SQL Server instance is capable of handling thousands of users
working on multiple databases.
For more questions with answers, follow the link below:
http://www.careerride.com/SQLServer-Interview-Questions.aspx
We do not warrant the correctness of content. The risk from using it lies entirely with the user. While
using this document, you agree to have read and accepted the terms of use and privacy policy.

More Related Content

PPTX
1 extreme performance - part i
PPTX
Introducing ms sql_server_updated
PPTX
SQL Server Blocking Analysis
ODP
Introduction4 SQLite
PDF
Database Fundamental
DOCX
Android project (1)
PDF
Datastage Online Training
PPT
Sqlite
1 extreme performance - part i
Introducing ms sql_server_updated
SQL Server Blocking Analysis
Introduction4 SQLite
Database Fundamental
Android project (1)
Datastage Online Training
Sqlite

What's hot (14)

PDF
MS-SQL SERVER ARCHITECTURE
DOCX
Dbcc.doc
PDF
NonStop SQL/MX DBS Explained
PPTX
Sqlite
PDF
153680 sqlinterview
PDF
SQLite 3
PDF
SQL server Backup Restore Revealed
PPT
MYSQL.ppt
PDF
Bt0066 database management system1
PPTX
PDF
Sql interview questions and answers
PDF
Graduate Project Summary
PPTX
Oracle Database | Computer Science
PPT
MS-SQL SERVER ARCHITECTURE
Dbcc.doc
NonStop SQL/MX DBS Explained
Sqlite
153680 sqlinterview
SQLite 3
SQL server Backup Restore Revealed
MYSQL.ppt
Bt0066 database management system1
Sql interview questions and answers
Graduate Project Summary
Oracle Database | Computer Science
Ad

Viewers also liked (12)

PPTX
SQL Server 2012 Certifications
DOCX
Sql Server Interview Question
PDF
Sql server 2008 interview questions answers
PDF
Top 5 TSQL Improvements in SQL Server 2014
PPTX
Sql server 2012 dba online training
PPTX
New T-SQL Features in SQL Server 2012
PDF
Data Quality Services in SQL Server 2012
PPTX
70-461 Querying Microsoft SQL Server 2012
PDF
Good sql server interview_questions
PPTX
Introduction to Master Data Services in SQL Server 2012
PPTX
Best MCSA - SQL SERVER 2012 Training Institute in Delhi
PPTX
Always on in SQL Server 2012
SQL Server 2012 Certifications
Sql Server Interview Question
Sql server 2008 interview questions answers
Top 5 TSQL Improvements in SQL Server 2014
Sql server 2012 dba online training
New T-SQL Features in SQL Server 2012
Data Quality Services in SQL Server 2012
70-461 Querying Microsoft SQL Server 2012
Good sql server interview_questions
Introduction to Master Data Services in SQL Server 2012
Best MCSA - SQL SERVER 2012 Training Institute in Delhi
Always on in SQL Server 2012
Ad

Similar to Sql server-dba (20)

DOC
Sql server
PPTX
Sql Sever Presentation.pptx
PPTX
MODULE 5.pptx
PPTX
SQL PPT.pptx
PPTX
Sql vs no sql
PPTX
Introduction to query Processing and sql language.pptx
PPTX
Kaashiv SQL Server Interview Questions Presentation
PPTX
Ebook6
PPTX
Sql interview-question-part-6
PPTX
Ebook6
PPTX
Sql interview-question-part-6
PPTX
Sql interview question part 6
PDF
Introduction to sql server
PDF
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
PDF
SQL EXCLUSIVE NOTES .pdf
ODP
Handling Database Deployments
PPTX
Store procedures
PDF
Mysql
PDF
Troubleshooting sql server
PPT
Ebook7
Sql server
Sql Sever Presentation.pptx
MODULE 5.pptx
SQL PPT.pptx
Sql vs no sql
Introduction to query Processing and sql language.pptx
Kaashiv SQL Server Interview Questions Presentation
Ebook6
Sql interview-question-part-6
Ebook6
Sql interview-question-part-6
Sql interview question part 6
Introduction to sql server
Compare the capabilities of the Microsoft Access, Microsoft SQL Serv.pdf
SQL EXCLUSIVE NOTES .pdf
Handling Database Deployments
Store procedures
Mysql
Troubleshooting sql server
Ebook7

Recently uploaded (20)

PPTX
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
PPT
Quality review (1)_presentation of this 21
PPTX
STUDY DESIGN details- Lt Col Maksud (21).pptx
PPTX
Introduction to Knowledge Engineering Part 1
PDF
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
PPTX
climate analysis of Dhaka ,Banglades.pptx
PDF
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
PDF
.pdf is not working space design for the following data for the following dat...
PPTX
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
PPTX
Introduction to machine learning and Linear Models
PPTX
SAP 2 completion done . PRESENTATION.pptx
PDF
Introduction to Data Science and Data Analysis
PDF
Fluorescence-microscope_Botany_detailed content
PDF
annual-report-2024-2025 original latest.
PPTX
IB Computer Science - Internal Assessment.pptx
PDF
Galatica Smart Energy Infrastructure Startup Pitch Deck
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPT
Miokarditis (Inflamasi pada Otot Jantung)
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PPTX
Introduction-to-Cloud-ComputingFinal.pptx
mbdjdhjjodule 5-1 rhfhhfjtjjhafbrhfnfbbfnb
Quality review (1)_presentation of this 21
STUDY DESIGN details- Lt Col Maksud (21).pptx
Introduction to Knowledge Engineering Part 1
22.Patil - Early prediction of Alzheimer’s disease using convolutional neural...
climate analysis of Dhaka ,Banglades.pptx
BF and FI - Blockchain, fintech and Financial Innovation Lesson 2.pdf
.pdf is not working space design for the following data for the following dat...
Market Analysis -202507- Wind-Solar+Hybrid+Street+Lights+for+the+North+Amer...
Introduction to machine learning and Linear Models
SAP 2 completion done . PRESENTATION.pptx
Introduction to Data Science and Data Analysis
Fluorescence-microscope_Botany_detailed content
annual-report-2024-2025 original latest.
IB Computer Science - Internal Assessment.pptx
Galatica Smart Energy Infrastructure Startup Pitch Deck
Data_Analytics_and_PowerBI_Presentation.pptx
Miokarditis (Inflamasi pada Otot Jantung)
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
Introduction-to-Cloud-ComputingFinal.pptx

Sql server-dba

  • 1. SQL Server DBA interview questions What are the steps to take to improve performance of a poor performing query? • Maximum use of indexes, stored procures should be done. • Avoid excessive use of complicated joins and cursors. • Avoid using conditional operators using columns of different tables. • Make use of computed columns and rewriting the query. What is a deadlock and what is a live lock? How will you go about resolving deadlocks? A deadlock occurs when two or more processes waits for a resource that is acquired by or is under the control of another process. A live lock is similar to a deadlock except the process states keeps changing. The result of such state is that none of the process will be complete. Deadlock detection finds and resolves deadlocks. A WFG strategy is followed. WFG is wait for graph. In WFG, processes are represented by nodes while dependencies are represented by edges. Thus, if process A is waiting for a resource held by process B, there is an edge in the WFG from the node for process A to the node for process B. a cycle is this graph is a deadlock. WFG constantly checks for cycles or when a process is blocked and adds a new edge to the WFG. When a cycle is found, a victim is selected and aborted. What is blocking and how would you troubleshoot it? Blocking occurs when two or more rows are locked by one SQL connection and a second connection to the SQL server requires a conflicting on lock on those rows. This results in the second connection to wait until the first lock is released. Troubleshooting blocking: • SQL scripts can be written that constantly monitor the state of locking and blocking on SQL Server • The common blocking scenarios must be identified and resolved. • The scripts output must be checked constantly, • The SQL profilers data must be examined regularly to detect blocking.
  • 2. Explain the different types of BACKUPs available in SQL Server. Complete database backup: This type of backup will backup all the information in the database. Used most commonly for disaster recovery and takes the longest time to backup. Differential databse backup: The database is divided into partitions that have been modified since last complete backup. Most suitable for large databases. The most recent differential backup contains the changes from previous backups. Transaction log backups: Backups only the changes logged in the transaction log. The transaction log has all changes logged about a database. Once the changes are accommodated on the database, the log is truncated or backed up. File/File Group backups: used to recover individual files or file groups. Each filegroup can be individually backed up. This helps in recovery only the required file or filegroup for disaster recovery. What is database isolation in SQL Server? Isolation in database defines how and when changes made by one transaction can be visible to other transactions. Different isolation levels are: • Serializable • Repeatable read • Read committed • Read uncommitted What is a Schema in SQL Server 2005? Explain how to create a new Schema in a Database? A schema is used to create database objects. It can be created using CREATE SCHEMA statement. The objects created can be moved between schemas. Multiple database users can share a single default schema. CREATE SCHEMA sample; Table creation Create table sample.sampleinfo
  • 3. { id int primary key, name varchar(20) } Explain how to create a Scrollable Cursor with the SCROLL Option. Using the SCROLL keyword while declaring a cursor allows fetching of rows in any sequence Example: DECLARE employee_curs SCROLL CURSOR FOR SELECT * FROM employee; The active set of the cursor is stored can be accessed in any order without the need of opening and closing the cursor. The Scroll cursors can be set for select and function cursors but not insert or update statements. Explain how to create a Dynamic Cursor with the DYNAMIC Option. When a cursor is declared as DYNAMIC, the cursor reflects all changes made to the base tables as the cursor is scrolled around. Declare cursor_name cursor [ STATIC | KEYSET | DYNAMIC | FAST_FORWARD ] FOR select_statement The dynamic option does not support ABSOLUTE FETCH. What are database files and filegroups? Database files are used for mapping the database over some operating system files. Data and log information are separate. SQL server database has three types of database files: Primary: starting point of a database. It also points to other files in database. Extension: .mdf
  • 4. Secondary: All data files except primary data file is a part of secondary files. Extension: .ndf Log files: All log information used to recover database. Extension: .ldf Describe in brief Databases and SQL Server Databases Architecture. SQL Server consists of a set of various components which fulfill data storage and data analysis needs for enterprise applications. Database architecture: All the data is stored in databases which is organized into logical components visible to the end users. It’s only the administrator who needs to actually deal with the physical storage aspect of the databases, whereas users only deal with database tables. Every SQL Server instance has primarily 4 system database i.e. master, model, tempdb and msdb. All other databases are user created databases as per their needs and requirements. A single SQL Server instance is capable of handling thousands of users working on multiple databases. For more questions with answers, follow the link below: http://www.careerride.com/SQLServer-Interview-Questions.aspx We do not warrant the correctness of content. The risk from using it lies entirely with the user. While using this document, you agree to have read and accepted the terms of use and privacy policy.