Published: 30 Nov 2007
By: Pinal Dave

Pinal Dave shares his notes about Q&A with Database Administrators.

I have been in India for more than a month now, as I am leading a very large outsourcing project. We have conducted few interviews since the project required more Database Administrators and Senior Developers. I am listing few of the questions discussed during all the interviews. The whole event of interviews was very interesting. I met some very good programmers from all over the country. Many interesting questions were discussed between interviewers and candidates. I am listing some of those questions here. Some are technical and some are just my personal opinions.

Questions & Answers

Q. What kind of Database Administrator do you think is the best Database Administrator?

A. Primary job of DBA is to secure the data and keep it safe as well as being able to reproduce data efficiently, when required. A Database Administrator, who can fulfill the requirements of Securing Data and Retrieving Data, is the best DBA as per my view.

When I hire DBA I always ask them questions about backup strategies and efficient restoring methodologies.

Q. Can I restore the database if I do not have full backup but I have all the primary data file and secondary data files as well as logs?

A. You can not restore the database without having full database backup. However, if you have copy of all the data files (.mdf and .ndf) and logs (.ldf), when database was in working condition (or your desired state) you can attach that database using sp_attach_db.

Q. As per your opinion, what are the five top responsibilities of DBA?

A. I rate following five tasks as the most important responsibilities of DBA.

  1. Securing the database from physical as well as logical integrity damage.
  2. Restore the database from backup as part of disaster management plan.
  3. Optimize the queries performance by proper indexing and optimizing joins, where conditions, select clause etc.
  4. Design the new schema and support legacy schema as well legacy database systems.
  5. Help developers to be better at writing SQL related code.

Q. One of the developers in my company moved one of the columns from one table to some other table in the same database. How can I find the name of the new table where the column has been moved?

A. This question can be answered by querying system views.

For SQL Server 2005 run the following code:

The previous query will return all the tables that use the column name specified in the WHERE condition. This is a very small but very handy script.

Q. What is the difference between SQL Server 2000 object owner and SQL Server 2005 schema?

A. Let us first see the fully qualified query name to access a table for SQL Server 2000 and SQL Server 2005.

SQL Server 2000: [DataBaseServer].[DataBaseName].[ObjectOwner].[Table]

SQL Server 2005: [DataBaseServer].[DataBaseName].[Schema].[Table]

In SQL Server 2000, before dropping the user who owns database objects, all the objects belonging to that user need to be either dropped or their owner has to be changed. Every time a user has to be dropped or modified, system admin has to go through this inconvenient process.

In SQL Server 2005, instead of accessing a database through database owner, it can be accessed through a schema. Users are assigned to schemas, and by using this schema a user can access database objects. Multiple users can be assigned to a single schema and they all automatically receive the same permissions and credentials as the schema to which they are assigned. Due the same reason in SQL Server 2005 - when a user is dropped from database - there is no negative effect on the database itself.

Q. What is BI? I have heard this term before but I have no idea what is it?

A. BI is an acronym that stands for Business Intelligence. Microsoft has started to promote the acronym BI since the launch of SQL Server 2005. However, it has been in use for long time. The basic idea of BI is quite similar to Data Warehousing. Business intelligence is a method for storing and presenting key enterprise data so that anyone in your company can quickly and easily ask questions based on accurate and timely data. Effective BI allows end users to use data to understand why your business got the particular results that it did, to decide on courses of action based on past data, and to accurately forecast future results

Q. What is your recommendation if a query is running very slow?

A. Your question is very difficult to answer without looking at code, application and physical server. Few things should be looked at right away when similar situations arise.

  • Restart Server
  • Upgrade Hardware
  • Check Indexes on Tables and Create Indexes if necessary
  • Make sure SQL Server has priority over other operating system processes in SQL Server settings
  • Update statistics on the database tables

Q. What should be the fill factor for Indexes created on tables?

A. Fill factor specifies a percentage that indicates how full the Database Engine should make the leaf level of each index page during index creation or alteration. Fill factor must be an integer value from 1 to 100. The default is 0. I keep my servers default fill factor as 90.

Q. Which feature in SQL Server 2008 (to be released in February 2008) has surprised you? Name only one.

A. Plan Freezing is the new feature I never thought of. It is a very interesting feature and it is included in SQL Server 2008 CTP5. SQL Server 2008 enables greater query performance stability and predictability by providing new functionality to lock down query plans, enabling organizations to promote stable query plans across hardware server replacements, server upgrades, and production deployments.

Q. How do you test your database?

This is a very generic question. I will be describing my generic database testing method as well as stored procedure testing methods.

Testing Databases:

  • Table Column data type and data value validation.
  • Index implementation and performance improvement.
  • Constraints and Rules should be validated for data integrity.
  • Application field length and type should match the corresponding database field.
  • Database objects like stored procedures, triggers, functions should be tested using different kind of input values and checking the expected output variables.

Testing Stored Procedures:

  • Understand the requirements in terms of Business Logic.
  • Check that code follows all the coding standards.
  • Comparing the fields' requirements of application to the fields retrieved by a stored procedure. They should match.
  • Repeatedly run stored procedures many times with different input parameters and compare the output with expected results.
  • Pass invalid input parameters and see if a stored procedure has good error handling.
<<  Previous Article Continue reading and see our next or previous articles Next Article >>

About Pinal Dave

Pinalkumar Dave is Microsoft SQL Server MVP and author of several hundreds SQL Server articles. He has six years experience as Principal Database Administrator in MS SQL Server 2008/2005, .NET (C#) and ColdFusion MX. He has a Masters of Science degree in Computer Networks, along with MCDBA, MCAD(.NE...

This author has published 16 articles on DotNetSlackers. View other articles or the complete profile here.

Other articles in this category

Lucene.NET vs SQL Server Full-text – Generating a million records and a full-text index
In this article we will take a look at how SQL Server performs with one million records in a table. ...
Identifying currently running SQL queries
This article is taken from the book SQL Server DMVs in Action. The author discusses a routine that i...
Easy Insert, Update and Retrieve Values for Microsoft SQL Database with C#, Visual Studio
This article will provide you with the small amount of code required to insert, update and retrieve ...
What's blocking my running SQL?
This article is taken from the book SQL Server DMVs in Action. The author discusses a routine that i...
SQL Azure to Developers: Part 1
In this part we will focus on overview of SQL Azure along with a first look on SQL Azure Management ...

You might also be interested in the following related blog posts

Use Dependency Injector "Ninject" to dynamically choose between ORM's (Entity Framework or Dapper) and Databases (SQL Server or Oracle Database) read more
SQL SERVER How to Migrate Existing Database to Contained Databases read more
Defusing Database Time Bombs: Avoiding the Need to Refactor Databases read more
MYSQL Could not Drop Object [Content] (Cannot delete or update a parent row: a foreign key constraint fails, 1217) DROP DATABASE DatabaseName read more
Big Data Operational Databases Supporting Big Data Columnar, Graph and Spatial Database Day 14 of 21 read more
Testing object databases for .NET: Eloquera, STSdb, Siaqodb, Ninja Database Lite read more
Telerik OpenAccess ORM introduces the industry-first full support for SQL Azure and extends functionality read more
Issue 50 - DotNetNuke 5 Admin Modules Access, Reset Logins, iPhone OWS read more
Migrating to Postgresql with my friend NHibernate read more


Subject Author Date
placeholder Q. What is your recommendation if a query is running very slow? Granville Barnett 11/30/2007 11:10 AM
Restarting the Server Sonu Kapoor 11/30/2007 11:22 AM
placeholder RE: Restarting the Server Pinal Dave 11/30/2007 12:41 PM
RE: RE: Restarting the Server Sonu Kapoor 11/30/2007 12:44 PM
placeholder RE: RE: RE: Restarting the Server Pinal Dave 11/30/2007 12:53 PM
RE: RE: RE: RE: Restarting the Server Granville Barnett 12/1/2007 11:49 AM
placeholder RE: RE: RE: RE: RE: Restarting the Server Kazi Manzur Rashid 12/1/2007 7:04 PM
Performance Optimization Kazi Manzur Rashid 12/1/2007 7:07 PM
placeholder RE: Performance Optimization Pinal Dave 12/1/2007 8:52 PM
Q. What is your recommendation if a query is running very slow? Sameer Alibhai 12/4/2007 3:53 PM

Please login to rate or to leave a comment.