SQL Server DBA Interview Questions

9
SQL Server Interview Questions: 1. How to identify what hot fixes and service packs are installed. 2. How do identify and fix page corruption 3. What are trace flags, how many of them is in sql server 4. Emergency mode and suspect mode, how do you identify and fix it. 5. SQL Server is consuming 90 percent of memory how do you troubleshoot it. 6. Tempdb is full, what are steps you to take to prevent it 7. Tempdb is full, how do you freespace without shrinking it 8. what is missing indexes and unusable index, how to identify them and troubleshoot it 9. Difference between index online and reorganize index 10. Processor affinity and I/O affinity 11. what is heart beat and keep alive and is alive 12. what is the boot page in sql server 13. file architecture 14. what is active - active and active - passive in cluster 15. files and filegroup backups 16. SQL Server Architecture 17. Ghost Cleanup or Ghost Rows 18. what are missing indexes and unused indexes 19. what is TUF file and what happens if it gets lost 20. steps for failover in logshipping 21. can u use same backup and restore path after failovering in logshipping 22. Tail log backup and point in time recovery 23. steps for point in recovery if u database is crashed on wednesday afternoon how u perform it. 24. How to take log backup if the log is corrupted for a database or taking a log backup for a crashed database. (Tail log backup and continue after error) 25. How do you verify whether Backup succeed or not. U need to use RESTORE VERIFY .. 26. How do you move tempdb files to another location. 27. Difference between Simple and Full recovery model

description

Guides you on what Questions are beginning asked in the interview by Corporate. If helpful have a like on it.

Transcript of SQL Server DBA Interview Questions

Page 1: SQL Server DBA Interview Questions

SQL Server Interview Questions:

1. How to identify what hot fixes and service packs are installed.2. How do identify and fix page corruption3. What are trace flags, how many of them is in sql server 4. Emergency mode and suspect mode, how do you identify and fix it.5. SQL Server is consuming 90 percent of memory how do you troubleshoot it.6. Tempdb is full, what are steps you to take to prevent it7. Tempdb is full, how do you freespace without shrinking it8. what is missing indexes and unusable index, how to identify them and troubleshoot it9. Difference between index online and reorganize index10. Processor affinity and I/O affinity11. what is heart beat and keep alive and is alive12. what is the boot page in sql server13. file architecture 14. what is active - active and active - passive in cluster15. files and filegroup backups16. SQL Server Architecture17. Ghost Cleanup or Ghost Rows18. what are missing indexes and unused indexes19. what is TUF file and what happens if it gets lost20. steps for failover in logshipping21. can u use same backup and restore path after failovering in logshipping22. Tail log backup and point in time recovery23. steps for point in recovery if u database is crashed on wednesday afternoon how u perform it.24. How to take log backup if the log is corrupted for a database or taking a log backup for a crashed

database. (Tail log backup and continue after error)25. How do you verify whether Backup succeed or not. U need to use RESTORE VERIFY ..26. How do you move tempdb files to another location.27. Difference between Simple and Full recovery model28. I have 32 bit system, and have 32 GB RAM, how much memory does it take, what options do we

required to be enabled to have max memory29. what is the use of min memory setting in sql server 30. Difference between cluster index and non clustered index31. what is update statistics, reoraganize index and rebuild index, and what is view to view it.32. How to patch sql server cluster instance33. what is Service packs and Hot fix.34. When do you get orphan users in sql server and what is the command to find it.35. what is the way to execute T SQL query across multiple instances at same time -- registered

servers.36. How can locate sql server error log if the instance has crashed.

Page 2: SQL Server DBA Interview Questions

In SQL Server Configuration Manager, expand Services, and then click SQL Server

In the details pane, right-click the name of the instance you want to start automatically, and then click Properties

Click the Advanced tab, and Verify Startup Parameters.

-e The fully qualified path for the error log file

Other parameters

-d The fully qualified path master database file -l The fully qualified path master database log file

Now, assuming that Enterprise Manager is not working. Here’s how you still determine the SQL Error Log location….Using SQL Server Registry KeysClick Start, click Run, type Regedit, and then click OK. Locate the following registry subkey:

For - Default Instance HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSSQLServer\MSSQLServer\Parameters

For - Named Instance HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft SQL Server\<Instance_Name>\MSSQLServer\Parameters

Go Try This !

http://www.mssqltips.com/sqlservertip/2506/identify-location-of-the-sql-server-error-log-file/http://blogs.msdn.com/b/varund/archive/2009/03/21/how-to-verify-path-for-sql-server-error-log-files.aspx

37. how can verify whether the backup is consistent or not. -- restore verify38. Why you need to have differential backup when you have transaction log backup is running for

every 5 mins.39. what is filegroup backup and copy only backup.40. what is scheduled job and scheduled task.41. how do you monitor sql server performance42. List out the backup types in sql server43. what is dbcc and list out few of them 44. what is logshipping and what are steps for configuring logshipping45. what is service account in sql server46. List out the steps involved in configuring sql server failover cluster.47. how many IPs do you use in configuring clustering and what are they what are its use

Page 3: SQL Server DBA Interview Questions

48. Types of jobs created in sql server logshipping, and on which instance they are created.49. list out the steps for configuring log shipping 50. difference between log shipping and database mirrroing51. what is push subscription and pull subscription.52. how many mirror database we can have in log shipping and how many secondary databases do

we have in secondary database.53. how can u change the port number of sql server.54. how can we establish connection to oracle from sql server without using linked server.55. Differences between database recovery models56. What are the typical situations have faced in your environment explain few of them.57. What steps do you follow to recover a database when the user database crashes.58. what are reasons when you are not able to login/connect to sql server instance and your are

able to do remote desktop for that server/instance.59. what i have to provide if user want to access a particular database.60. Explain the situations that u have faced in client environment61. Can you perform anything on mirror database.62. How many named instance can you have on a Server.63. I have a scenario that database has crashed how do you recover it, explain me the steps.64. Steps for moving system databases.65. What are the standards do you follow while installing sql server.66. I have the one instance, I was able to login through RDP but not able to login through SSMS

what would be the possible reasons.67. Difference between inplace upgrade and side by side upgrade.68. How many types of upgrade modes do you have and what are they.69. what do you see in configuration manager.70. Difference between differential backup and transactional backup71. Can we upgrade SQL Server 2005 to SQL Server 2012 directly.72. Can we restore SQL Server 2005 backup onto SQL Server 2012 instance.73. How do you troubleshoot if tempdb is full.74. what is default port for sql server and how do you change the default port number.

http://www.databasejournal.com/features/mssql/article.php/3689846/Using-Non-Standard-Port-for-SQL-Server.htmhttps://msdn.microsoft.com/en-us/library/ms177440.aspxhttp://www.blackbaudknowhow.com/tech-tips/sql-server-ports.htm

75. what is collation and what is its use.76. What is affinity I/O and affinity mask -- in doubt but question exists.77. what is dbcc checkdb and what it shows up.

CHECKDB found 0 allocation errors and 0 consistency errors in database78. what is database mirroring and operating modes. 79. What is endpoint in database mirroring.

An endpoint is a SQL Server object that enables SQL Server to communicate over the network. 80. Performance counters in sql server

Page 4: SQL Server DBA Interview Questions

81. Action taken when SQL Server not connecting remotely?· Enable remote connections on the instance of SQL Server that you want to connect to from a remote computer.· Turn on the SQL Server Browser service.· Configure the firewall to allow network traffic that is related to SQL Server and to the SQL Server Browser service

What is difference between DELETE and TRUNCATE commands?

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.

1. TRUNCATE:

1. TRUNCATE is faster and uses fewer system and transaction log resources than DELETE.

2. TRUNCATE removes the data by deallocating the data pages used to store the table’s data, and only the page deallocations are recorded in the transaction log.

3. TRUNCATE removes all rows from a table, but the table structure, its columns, constraints, indexes and so on, remains. The counter used by an identity for new rows is reset to the seed for the column.

4. You cannot use TRUNCATE TABLE on a table referenced by a FOREIGN KEY constraint. Because TRUNCATE TABLE is not logged, it cannot activate a trigger.

5. TRUNCATE cannot be rolled back.

6. TRUNCATE is DDL Command.

7. TRUNCATE Resets identity of the table

2. DELETE:

1. DELETE removes rows one at a time and records an entry in the transaction log for each deleted row.

2. If you want to retain the identity counter, use DELETE instead. If you want to remove table definition and its data, use the DROP TABLE statement.

3. DELETE Can be used with or without a WHERE clause

4. DELETE Activates Triggers.

5. DELETE can be rolled back.

6. DELETE is DML Command.

7. DELETE does not reset identity of the table.

Note: DELETE and TRUNCATE both can be rolled back when surrounded by TRANSACTION if the current session is not closed. If TRUNCATE is written in Query Editor surrounded by TRANSACTION and if session is closed, it can not be rolled back but DELETE can be rolled back.

What is the difference between a Local and a Global temporary table?

 

Page 5: SQL Server DBA Interview Questions

82. A local temporary table exists only for the duration of a connection or, if defined inside a compound statement, for the duration of the compound statement.

83. A global temporary table remains in the database permanently, but the rows exist only within a given connection. When connection is closed, the data in the global temporary table disappears. However, the table definition remains with the database for access when database is opened next time.

84. When do observer pending failover and what are the reasons for it.85. Master database is corrupted what steps do you follow to resolve it.86. what is database snapshot and how it differs from the user database and do they have same size

as of user database when snapshot is created before and after.87. Do differential backup backed up the transaction log records like full database. Yes differential

backup will have transaction log records for recovery purpose.88. what is uncommitted isolation level.89. I have a situation I need to grant the view definition and data reader privs for 5 users on 3 tables

what steps do u take care.90. We have scheduled maintenance activity, where we need to failover the first node to second

node, but for some reason it is not allowing to failover. What are the possible reasons and where do you check for the logs.

91. I have 3 node cluster and 4 instances are on it how do you look at it what are opinions of placing it. We can have two instances each on two nodes, which can be thought as active - active. the third node will act as passive node.

92. You have two drives, in one you have data file and other you have log files, and we have a situation in where transaction log filled up the space on the drive and users are complaining that it is affecting business, so what steps do u take to resolve the issue.

https://technet.microsoft.com/en-us/library/ms175495(v=sql.110).aspx

also check mssqltips site.

93. Is Database Mirroring Causing The Transaction Log To Fill Up

Every insert, update, and delete operation that occurs on the principal database is sent to the mirror database through active transaction log records.  The mirror server applies these log records in sequence as quickly as possible.  There are two operating modes that dictate how SQL Server manages the way the principal and mirrored databases handle the transactions. 

94. The first operating mode is high-performance (asynchronous) mode, where there is just a principal server and a mirror server.  In this mode, performance is priority at the risk of a potential loss of data and high availability.   What’s important to note here is that in this mode once the principal server sends the log for a transaction to the mirror, it does not wait for a confirmation from the mirror acknowledging the transacation.  In this case, the principal will just keep sending log data to the mirror regardless of the work load. 

Page 6: SQL Server DBA Interview Questions

95. The second operating mode is High Safety failover (synchronous) mode. In this mode, all committed transactions are guaranteed to be written to disk on the mirror server.  The principal database will send the transactions over to the mirror and wait to commit those transactions until it gets a verification from the mirror server.  If for some reason, the link between the two databases is affected, the transaction log will continue to grow on the principal database until it receives acknowledgement from the mirrored database. As a result the transaction log will grow and not re-use space. 

96. What is the endpoint in Mirroring?

Endpoint: An endpoint is a SQL Server object that enables SQL Server to communicate over the network. It encapsulates a transport protocol and a port number.

97. Is High Safety mirroring is recommended on WAN network? If not then why?

We make no recommendations about whether a wide-area network (WAN) is reliable enough for database mirroring in high-safety mode. If you decide to use high-safety mode over a WAN, be cautious about how you add a witness to the session, because unwanted automatic failovers can occur. For more information, see Recommendations for Deploying Database Mirroring, later in this topic.

98. Can you take transaction log backup in simple recovery model and what is the reason. In simple recovery model u cannot take the transaction log backup as the log is truncated when it checkpoint occurs all committed transactions are written to the disk. http://www.mytechmantra.com/LearnSQLServer/SQL_Server_Recovery_Model.htmlIn full recovery model,all the DML transactions are logged and unless you have a periodic transactional backups,the committed transactions are still there in the log file.This makes it to grow until you perform a log backup.Log backup takes all the committed transactions into it.Since you have all the transactions in the log you can recover the database upto the point in case of disaster.In simple recovery model,only the uncommitted transactions will be there in the log.The committed transactions are removed upon a checkpoint issued by sql server.So log file never grows abnormally and you cannot perfom a log backup.Point in time recovery is not possible in this case.If you have a full backup scheduled ,we can recover only upto that point.

General Notes: Client connections to the principal server do not use the database mirroring endpoint.