DBA- Interview Questions & Answers

Hi Friends,

This blog is based on the interview based questions.  I have collected, summarized & prepared the answers and presenting in front of you.


These questions are based on Page & Extents in SQL Server.

  1. What is the fundamental unit of data storage in SQL server?

Ans. Page

     2. What is the page size?

Ans. 8 kB

  1. What is the page header size?

Ans. 96 byte and it is used to store system info about the page

  1. Name the different types of pages in SQL server?


  • Data
  • Index
  • Text/Image
  • GAM (Global Allocation Map)
  • PFS (Page Free Space)
  • IAM (Index Allocation Map)
  • BCM (Bulk Changed Map)
  • DCM (Differential Changed Map)
  1. Does log files contains pages?

Ans. No, log files contains only a series of log records

  1. Name the type of extents?


  1. Uniform Extents
  2. Mixed extents

7. What is PLE (Page Life Expectancy)?

Ans. It is a perfmon counter, found in the SQL server buffer manager. PLE is the best   indication of how volatile your buffer pool is. Volatility is measured by taking the   average”life” of a page within the buffer pool.

So if lots of pages are being overwritten with new data very often, the average PLE will be low and our BP volatility will be high.


PLE threshold= ((maxbp(mb)/1024)4)*300

We can find the vaule of PLE by running this command


[SELECT [object_name],


[cntr_value] FROM sys.dm_os_performance_counters

WHERE [object_name] LIKE ‘%Manager%’

AND [counter_name] = ‘Page life expectancy’]

8. What is PFS?

Ans. Page free space (PFS) pages record the allocation status of each page. After an          extent has been allocated to an object, the Database Engine uses the PFS pages to    record    which pages in the extent are allocated or free. This information is used when the Database Engine has to allocate a new page.

A PFS page is the first page after the file header page in a data file (page id 1) followed by GAM & SGAM pages.

9. What is DCM?

Ans. DCM stands for differential changed map. This tracks the extents that have changed since the last backup database statement. Differential backup just reads the DCM pages to determine which extents have been modified.

10. What is BCM?

Ans. BCM stands for bulk changed map. This tracks the extents that have changed since the last backup log statement. Although BCM pages appear in all databases, they are only relevant when the database is using the bulk logged recovery model.


Your likes & comments are always appreciated.


Posted in Database Administration, Q & A, Sql Server, T-SQL | Tagged , , , , , , , , , , , , , , , | Leave a comment

SQL Database as a Service in Azure

Introduction –SQL Database as a Service in Azure


This blog is based on a feature in Azure that is SQL Database which is used as a service. It is a good service for the management of SQL Database from a minimal up to the huge database sizes and near zero administration. The prerequisite and how to use this service is mentioned below in explanation section.

SQL Database in Azure


As we login to Azure portal and on the left hand side on the options (as in picture above) we can get this SQL Databases which we can use as a service. I have already stated in my previous blog that we can manage SQL database via two options.

  1. SQL Database in Azure
  2. SQL Server in virtual machine

Here I’ll talk about only SQL Database as a service in Azure. SQL Database provides many attractive features such as elastic scale, predictable performance, business continuity, near zero maintenance etc.  We need to keep in our mind that we are using this as a service so there would be no physical server which we need to manage. Almost all the administration would be handled by Azure itself.

SQL database is available in two different models –

  1. Elastic Database pools
  2. Single Database

The key feature of elastic pool model is the ability to share performance across many databases in pool.  Single database might be more appropriate in case of if we are having handful of databases. Both models allows us to adjust performance as necessary with no downtime and provide 99.99% SLA (service level agreement).

Introduction to SQL Database in Azure

Elastic database pools and single database, both models are available in three different service tiers as shown in picture above.

a. Basic      b. Standard         c. Premium 

Here performance is expressed in DTU i.e. Data Throughput Unit within these service tiers. Standard and premium tiers also have been further categorized as (S0, S1, S2, S3) and Premium as (P1, P2, P4, P6, P11). We can start with basic service tier and then can switch to any tiers depending on the usage and performance of the application. To switch to any tier is an online operation and we can use database during that operation.

Service Tiers


So it was the introduction about the SQL database  as a service available in Azure. I have described its benefits, usages, database models & different service tiers etc.

Hope you enjoyed about this new service!


Mirza Husain

Note: Next Blog coming soon based on Interview Q&A

Posted in Azure, Database Administration, Sql Server, windows azure | Tagged , , , , , , , , , , , , | Leave a comment

Microsoft under the Sea (A journey from Cloud to Sea)

Microsoft under the Sea

(A journey from Cloud to Sea)

This blog is based on the current news from Microsoft which is related to the milestone project Natick. I am sharing a brief summary and few important highlights however at the end of this bog there is a link which will redirect to Microsoft site for the complete news. I wish Microsoft a to be more successful  in such projects and serve the whole world.

Datacentre in Sea


The underwater datacenter concept was originally presented in a white paper prepared for a Microsoft event called ThinkWeek that encourages employees to share out-of-the-box ideas. Lee’s group was intrigued. Just 12 months after launching Project Natick in July 2014, the team had deployed a lab-built proof-of-concept prototype in calm, shallow waters off California.

Project Natick -Main Highlights

  1. A deep water data center.
  2. Natick is a code name and having no special meaning
  3. Project Natick launched in 2014
  4. First prototype deployed in August 2015 & retrieve after 105 days
  5. The data center contains 864 servers.
  6. The datacentre contains 12 racks
  7. It is assembled and tested in France

Project Importance in the eye of Mr. Satya Nadella

As per Microsoft CEO Satya Nadella this project is  “relevant moonshots” with the potential to transform the core of Microsoft’s business and the computer technology industry. Project Natick is an out-of-the-box idea to accommodate exponential growth in demand for cloud computing infrastructure near population centers.

Project Details

Microsoft tests a datacentre under the sea that’s quick to deploy, could provide internet connectivity for years

It is a milestone project for Microsoft which will help the people who live near to coastel areas in the world. Project Natick is an out-of-the-box idea to accommodate exponential growth in demand for cloud computing infrastructure near population centers.

Project Natick’s 40-foot long Northern Isles datacenter is loaded with 12 racks containing a total of 864 servers and associated cooling system infrastructure. The datacenter was assembled and tested in France and shipped on a flatbed truck to Scotland where it was attached to a ballast-filled triangular base for deployment on the seabed.

At the deployment site, a remotely operated vehicle retrieved a cable containing the fiber optic and power wiring from the seafloor and brought it to the surface where it was checked and attached to the datacenter, and the datacenter powered on.

Backbone of the Internet

Datacenters are the backbone of the Internet, the physical clouds of cloud computing where customers leverage economies of scale to securely store and process data, train machine learning models and run AI algorithms.

Demand for datacenter resources across the computing industry is growing exponentially as corporations increasingly shift their networks and computing needs to the cloud, and internet-connected intelligent devices ranging from smartphones to robots proliferate.


  1. Able to deploy a datacentre not more than 90 days.
  2. Natick datacentres are completely recycled, made from recycle material which is in turn to recycle at the end of the life of it.
  3. These datacentres doesn’t consume water to cool it.
  4. Microsoft create sustainable datacentre which leverages locally produced green energy, providing customers with additional options to meet their own sustainable requirements.

Project Natick


Project Natick’s Northern Isles datacenter reaches full submersion as it is lowered foot-by-foot 117 feet to the rock slab seafloor off the coast of the Orkney Islands in Scotland. Microsoft’s Project Natick is a years-long research effort to investigate manufacturing and operating environmentally sustainable, prepackaged datacenter units that can be ordered to size, rapidly deployed and left to operate lights out on the seafloor for years.

To get complete news

Please click here

Hire Me

Posted in Azure, Database Administration, Microsoft News, Other, Sql Server, T-SQL, windows azure | Tagged , , , , , , , , , , , , , , , , | Leave a comment

Comparison – SQL Database & SQL Server in Virtual Machine in Azure

Comparison – SQL Database & SQL Server in Virtual Machine in Azure


This blog is based on the comparison of SQL database feature with SQL server installed in virtual machine in Azure. Which option is good or which one we need to opt to full fill our company\business requirements. There are multiple questions regarding this as –

  1. How can we setup database in Azure?
  2. What are the pre-requisite to work on Azure SQL Database?
  3. Can we install SQL Server and create databases there as we do in our premises on a server or VM?
  4. What are the different ways to create databases in Azure?
  5. What are the features available in SQL Database in Azure?
  6. What are the benefits to use SQL Database instead of SQL server in Virtual Machine? Etc. etc.

SQL Database


As Azure is progressing and capturing the IT market by leaps and bounds and companies also have started moving to Cloud and taking services from Azure.

Therefore such questions may arise in the minds of the Database Administrators regarding the databases and their creation/migration/deletion etc. etc.

To answers such questions I am writing this blog to help you out by clearing the doubts. Firstly I would like to tell you that there are two options to work on SQL databases in Azure:

  1. SQL Database in Azure as a service
  2. Create Virtual Machine and use SQL server by installing it

We can work on SQL databases by using either option however there are few differences that’s why both options are available in Azure. First option SQL Database in Azure give us almost all the features and we can use it Platform as a service (PaaS) but we can’t find all the features here.

To get all the features of SQL Server we have to create virtual machine and then install SQL Server into it as we do in our premises. If we compare SQL Database and SQL server in virtual machine, we will find a list of features not available in SQL database. Few common features which are not available in SQL Database  as below:

  1. Windows Authentication
  2. Filestream data
  3. Database Mirroring
  4. Extended Stored Procedures
  5. SQL Server Agent/Jobs
  6. SSRS & SSIS doesn’t support.

SSRS- SQL server reporting Services

SSIS – SQL Server Integration Services

T-SQL Features:

  1. Use statement is not supported. To change databases, a new connection must be established.
  2. Common Language Runtime (CLR)

These are few common features which are not available in SQL Database in Azure. To view the complete list please go through the Microsoft link


However the question is then why we need to use SQL Database instead of traditional SQL Server in VM.

The decision to use SQL Database or SQL Server in Virtual Machine can be difficult. There are many factors to consider when choosing between SQL Database and SQL Server in Azure Virtual Machine and these factors may be as database size, existing application versus new application, administration, business continuity etc.


SQL Database is often the right solution for cloud –designed application that are not using unsupported features and need near zero administration.

Azure virtual machine is often the right choice for new or existing application that require a high level of control and customization and which doesn’t require hardware maintenance on premise in future.


Using SQL Database in Azure

  1. Elastic Scale
  2. Predictable Performacne
  3. Business continuity
  4. Near-zero maintenance
  5. Low costCost Difference between SQL Database & SQL Server in VM

    We can understand the cost difference as below:

    Total Cost for SQL Server in VM = Windows Server Cost +SQL Server Licence Cost + Azure Storage cost

    Cost for SQL Database = SQL Database is considered as a service and it is charged per hour basis. There is no cost for VM, licence etc.


    Therefore I would like to state that it totally depends on the business needs (database size, application type, new vs old application, business continuity etc )whether we need to use SQL Database feature or SQL server in VM as we have seen benefits and explanation above. There are certain limitations with SQL Database feature in Azure while we can use all features of SQL Server without any limit in virtual machine.

    ——————————————————————————————————————————–Hire Me

Posted in Azure, Database Administration, Q & A, Sql Server, windows azure | Tagged , , , , , , , , , , , | Leave a comment

How to learn Microsoft Cloud- Azure

Micrsofot Azure

As we know that technology has changed and Cloud Computing has come into picture. This technology provides easy access with lot of functionalities and is good from the point view of cost. Therefore companies have started to move to cloud technology.

There are several companies which provide Cloud technology however few are popular.

The popular and top most Cloud providers are as:

  1. Microsoft – Azure
  2. AWS- Amazon Web Services
  3. Google– Google Cloud
  4. IBM
  5. Salesforce
  6. Oracle
  7. SAP

Here, I am providing a glimpse of Microsoft cloud which is known as Azure. It was initially released on 1st Feb 2010. Azure is a cloud computing service created by Microsoft for building, testing, deploying and managing applications and services through a global network of Microsoft managed data centers.

To start with Azure,we need to login to https://portal.azure.com/ along with user name and password as below.


Once logged in to the Azure portal website, we will get snapshot of the dashboard of Azure. We can get options on the left hand side to use e.g. SQL Database, Virtual Machines etc. We can search the particular service in search bar.



Conclusion: To be familiar with the cloud computing and enhance our knowledge , Azure is the platform to learn and move ahead as Microsoft provides free subscription for 30 days with huge amount to use for learning purpose.

So what we are waiting for , move fast and learn new technology.

Looking forward your likes & Comments!!!

Posted in Azure, Database Administration, windows azure | Tagged , , , , , , , , | Leave a comment

Solved: Nonclustered Index Corruption in SQL Sever

Data Corruption is bad. Corruption either occur physically or logically in indexes. The Non-clustered Indexes are pointers of data that helps you in finding data more quickly. It contains Non-clustered key value and each key value has a pointer that contains the key value of data rows.Sadly, the ones who work in SQL Server is not aware about the processing behind it. The error of Non clustered Index is shown as:

<Date> <Time> spid # Error: 8646, Severity: 21, State: 1.
<Date> <Time> spid # Unable to find index entry in index ID 3, of table 2102402659, in database ‘'. The indicated index is corrupt or there is a problem with the current update plan. Run DBCC CHECKDB or DBCC CHECKTABLE. If the problem persists, contact product support.

Cause of Corruption in Non-Clustered Index

Index corruption occurs due to the NOLOCK hint run with any DML operation.This causes the query to read same value multiple times or read the table value incorrectly.

Sometimes it’s only the Non-clustered indexes that get corrupted, so you don’t have to run any restore operation on backups or run any repair command. Non- Clustered corruption is quite easy to handle, unlike, corruption in SQL data pages.You will able to fix it by running DROP and CREATE index.

How to Find Corrupted Indexes?

The consistency checks on indexes differ on the level of its compatibility of databases.

  • If the compatibility level <=100;
    • DBCC CHECKTABLE performs physical and logical consistency checks on all Non-clustered indexes and on the single table. By default, only physical consistency checks are done on XML Indexes, spatial indexes and indexed views.
    • In WITH EXTENDED_LOGICAL_CHECKS, logical consistency checks are performed on an indexed view, XML indexes, and spatial indexes. Only logical consistency checks are performed, if NOINDEX is specified.

Note: Running WITH EXTENDED_LOGICAL_CHECKS can highly affect the performance, therefore, you must use it only when:

  1. If you have issues related to Suspect index that are not related to physical corruption.
  2. Page level checksum is turned off.
  3. You suspect column- level hardware corruption.
  • If compatibility level >=90;
    • DBCC CHECKTABLE performs both physical and logical consistency check on a single table, indexed view and on all non clustered indexes. Spatial Indexes are not supported.

How to Fix it Manually

  • When nonclustered index is corrupted, the first step is to Run REPAIR_REBUILD command when the user is in SINGLE Mode.

  • Alter index IX_EmailAddress_EmailAddress
    on Person.EmailAddress

    The corruption FIXATION is not guarenteed because Rebuild reads the old index to build new one as a result of this new index contain the missing rows as old ones.

  • If Rebuild is not possible, then you need Drop & Create. Follow below procedure:
  • Right click on Indexes -> Select Script Index as DROP & CREATE to New query Window.

  • Run DBCC CHECKDB command to check consistency of the database.

Easy way to Repair Corruption By an Alternate solution

If you don’t want to perform lengthy process and want to save your time in repairing indexes, you can use professional third party SQL Recovery tool. The manual process is bit time consuming and may or maynot solve your problem. So you can use third party tool for an easy repairing. SQL Recovery software is capable of repairing corrupted indexes with an ease and fix your repaired indexes as a solution.


In this Blog, I have discussed about the solution to recover Non-clustered index in SQL Server Database. The blog covers two solution of repairing non clustered indexes. Choose the repair solution as per your ease.

Posted in T-SQL | Leave a comment

How to Repair Suspect Database in SQL Server with DBCC CHECKDB

Sometimes when connecting to the database, the database becomes inaccessible and you will get the following error message:

error message 945

The error message indicates that the database is in SUSPECT mode. Continue reading

Posted in T-SQL | Leave a comment