SQL Server Architecture Questions and Answers

SQL Server Architecture Questions and Answers

 

Sql Server Architecture Questions and Answers

Here are the list of Sql Server Architecture Questions and Answers which are asked in SQL Server developer / DBA  interviews

Q. Can you draw SQL Server architectural diagram with all the components?

Ans:

 

062513_0610_SQLServerAr3.png

Network Flow – SQL Server Architecture

Q. Can you explain the network flow in SQL Server Architecture?

Ans:

062513_0610_SQLServerAr4.jpg

These steps are defined as follows:

1. The user selects an option in a client application. This option calls a function in the client application that generates a query that is sent to SQL Server. The application uses a database access library to send the query in a way SQL Server can understand.

2. The database library transforms the original request into a sequence of one or more Transact-SQL statements to be sent to SQL Server. These statements are encapsulated in one or more Tabular Data Stream (TDS) packets and passed to the database network library to be transferred to the server computer.

3. The database network library uses the network library available in the client computer to repackage the TDS packets as network protocol packets.

4. The network protocol packets are sent to the server computer network library across the network, where they are unwrapped from their network protocol.

5. The extracted TDS packets are sent to Open Data Services (ODS), where the original query is extracted.

6. ODS sends the query to the relational engine, where the query is optimized and executed in collaboration with the storage engine.

7. The relational engine creates a result set with the final data and sends it to ODS.

8. ODS builds one or more TDS packets to be sent to the client application, and sends them to the server database network library.

9. The server database network library repackages the TDS packets as network protocol packets and sends them across the network to the client computer.

10. The client computer receives the network protocol packets and forwards them to the network libraries where the TDS packets are extracted.

11. The network library sends the TDS packets to the database access library, where these packets are reassembled and exposed as a client result set to the client application.

12. The client application displays information contained in the result sets to the user.

Pages and Extents

Q. What is a page in database systems and tell me something about pages?

Ans:

The fundamental unit of data storage in SQL Server is the page.

Page size is 8kb means 128 pages = 1 MB.

Page starts with the header of 96 bytes that is used to store page number, page type, the amount of free space on the page, and the object id that owns the page. The maximum size of a single row on a page is 8060 bytes. But this restriction is relaxed for tables which are having varchar, nvarchar, Varbinary, Taxt or Image columns.

Q. Any idea what is “ROW_OVERFLOW_DATA allocation unit”?

Ans:

When the total row size of all fixed and variable columns in a table exceeds the 8,060 byte limitation, SQL Server dynamically moves one or more variable length columns to pages in the ROW_OVERFLOW_DATA allocation unit.

This is done whenever an insert or update operation increases the total size of the row beyond the 8060 byte limit. When a column is moved to a page in the ROW_OVERFLOW_DATA allocation unit, a 24-byte pointer on the original page in the IN_ROW_DATA allocation unit is maintained. If a subsequent operation reduces the row size, SQL Server dynamically moves the columns back to the original data page.

Q. Can you briefly describe about EXTENT?

Ans:

An extent is eight physically contiguous pages, or one extent = 64 KB. That means 16 Extents= 1 MB.

There are two types of Extents. Uniform Extents and Mixed Extents.

Uniform extents are owned by a single object;

Mixed extents are shared by up to eight objects

Q. What are the different Types of Pages available?

Ans:

GAM and SGAM (Global Allocation Map & Shared GAM):

GAM: Extents have been allocated: 1 – Free space 0 – No space

SGAM: Mixed Extents have been allocated: 1 – Free Space + Mixed Extent and 0 – No space

Each GAM / SGAM covers 64000 extents – 4 GB

PFS (Page Free Space): Percentage of free space available in each page in an extent.

DCM (Differential Changed Map):  This tracks the extents that have changed since the last BACKUP DATABASE statement. 1 – Modified, 0 – Not modified

BCM (Bulk Changed Map): This tracks the extents that have been modified by bulk logged operations since the last BACKUP LOG statement. 1 – Modified, 0 – Not modified (Used only in bulk logged Recovery model)

In each data file pages are arranged like below

Along with that we have three different data pages

Data

Index

Text/ Image (LOB, ROW_OVERFLOE, XML)

 

Files and File Groups

Q. Have you ever heard the word “Files” or “File Groups” in SQL Server?

Ans:

Continue reading

Posted in Database Design, Interview Q&A, SQL Development, SQL Server DBA | Tagged , , , , , , , , , , , , , , , | 60 Comments

Cumulative Update 7 has been released for SQL Server 2008 R2 SP2

sqlserver2008r2Capture

Cumulative update package 7 for SQL Server 2008 R2 SP2

Click here to know the hotfixes in this CU

Download the CU7

Posted in Miscellaneous | Tagged , , , | 2 Comments

Configuring Replication step by step in SQL Server

Configuring Replication step by step in SQL Server

Here is a video that demonstrates “Configuring Replication step by step in SQL Server”

Replication_image

Understanding SQL Server replication basics to expert level – Part-1

Continue reading

Posted in High Availability, SQL Server DBA | Tagged , , , , , , , , , , , | 7 Comments