MS SQL DBA
70+ MS SQL DBA Interview Questions and Answers

Asked in DXC Technology

Q. If someone has deleted the table in a database, then how can you find out the user that has deleted the table ? Can you find out using the log file? Can you retsore the table using the tail log backup?
Yes, the user who deleted the table can be identified using the transaction log file.
To find out the user who deleted the table, you can query the transaction log file using the fn_dblog function.
The transaction log contains information about all the transactions performed on the database, including the table deletion.
By analyzing the log records, you can identify the specific transaction that deleted the table and retrieve the associated user information.
Restoring the table ...read more

Asked in DXC Technology

Q. What is the default port of sql server & Can we change the default port, if so where can we change it?
The default port of SQL Server is 1433. Yes, we can change the default port by modifying the SQL Server Configuration Manager.
The default port for SQL Server is 1433.
To change the default port, open SQL Server Configuration Manager.
Navigate to SQL Server Network Configuration and select Protocols for the desired SQL Server instance.
Right-click on TCP/IP and choose Properties.
In the IP Addresses tab, scroll down to the IPAll section.
Change the TCP Port value to the desired por...read more
MS SQL DBA Interview Questions and Answers for Freshers

Asked in DXC Technology

Q. If I take a full backup at midnight and log backups every hour, can I perform a point-in-time recovery up to 7:30 PM?
Point-in-time recovery is possible up to 07:30 PM with the given backup strategy.
Full backup at midnight captures the database state at that time.
Log backups every hour allow recovery to any point in time within the backup window.
To recover to 07:30 PM, ensure log backups are taken up to that time.
Example: If the last log backup was at 07:00 PM, you can restore to 07:30 PM using the log backup taken at that hour.

Asked in DXC Technology

Q. What is the default isolation level in sql server? What happens with that isolation level ?
The default isolation level in SQL Server is READ COMMITTED. It ensures that each transaction sees only committed data.
The default isolation level in SQL Server is READ COMMITTED.
READ COMMITTED ensures that each transaction sees only committed data.
It provides a balance between concurrency and data consistency.
Under READ COMMITTED, a transaction can read data that has been modified by another transaction but not yet committed.
However, it cannot read uncommitted data or data m...read more

Asked in DXC Technology

Q. What is the backup strategy for the biggest database you handled?
The backup strategy for the biggest database I handled involved regular full backups, daily differential backups, and hourly transaction log backups.
Regular full backups were performed to capture the entire database.
Daily differential backups were taken to capture the changes since the last full backup.
Hourly transaction log backups were taken to capture the changes since the last differential backup.
Backups were stored on separate storage devices to ensure data redundancy.
Ba...read more

Asked in DXC Technology

Q. When we run CheckDB, what command does it run in the background?
CheckDB runs DBCC CHECKDB command in the background.
CheckDB is a command used to check the logical and physical integrity of all objects in the specified database.
DBCC CHECKDB is the command that CheckDB runs in the background.
DBCC CHECKDB checks the allocation and structural integrity of all the objects in the specified database.
DBCC CHECKDB also checks for common errors like torn pages, index and data page corruptions, etc.
MS SQL DBA Jobs




Asked in DXC Technology

Q. What are blockings ? What are deadlocks and difference to blockings ?
Blockings occur when one transaction holds a lock on a resource, preventing other transactions from accessing it. Deadlocks are a specific type of blocking where two or more transactions are waiting for each other to release resources.
Blockings happen when one transaction holds a lock on a resource and other transactions are blocked from accessing it.
Deadlocks occur when two or more transactions are waiting for each other to release resources, resulting in a deadlock situatio...read more

Asked in DXC Technology

Q. When should statistics be updated with respect to index rebuild and reorganize?
Updating statistics is necessary after index rebuild or reorganize to ensure query optimization.
Statistics provide information about the distribution of data in a table or index.
Index rebuild or reorganize can change the distribution of data, making old statistics inaccurate.
Outdated statistics can lead to poor query performance.
Updating statistics after index rebuild or reorganize ensures query optimization.
Maintenance plans can be set up to automate this process.
Share interview questions and help millions of jobseekers 🌟

Asked in DXC Technology

Q. How do you reorganize and rebuild indexes based on index fragmentation?
Index reorganize and rebuild based on fragmentation level
For fragmentation level < 5%, use reorganize
For fragmentation level > 30%, use rebuild
For fragmentation level between 5% and 30%, choose based on table size and usage
Use ALTER INDEX statement to perform reorganize or rebuild
Monitor fragmentation level regularly to maintain optimal performance

Asked in DXC Technology

Q. What was the database size you used in your previous project?
The database size I have used in my previous project was approximately 500 GB.
The database size was around 500 GB.
It contained various tables, indexes, and stored procedures.
The data included millions of records from different sources.
We regularly optimized the database to ensure efficient performance.
Backup and recovery strategies were implemented to safeguard the data.

Asked in DXC Technology

Q. What is the parameter (-1) used in DBCC TRACEON(1204,-1)? Why is it used?
Parameter (-1) in DBCC TRACEON(1204,-1) is used to enable deadlock tracing for all sessions.
DBCC TRACEON(1204,-1) enables deadlock tracing for all sessions
The parameter -1 specifies that the trace flag should be enabled for all sessions
Deadlock tracing helps identify and resolve deadlocks in SQL Server

Asked in DXC Technology

Q. While applying patching, some MSI files are missing. How do you resolve this?
Check if the missing msi files are required for the patch. If yes, download and install them.
Verify if the missing msi files are essential for the patch
Check if the msi files are available in the original installation media or backup
If not, download the missing msi files from the vendor's website
Install the missing msi files before applying the patch

Asked in DXC Technology

Q. Do you use any monitoring tool for monitoring SQL server?
Yes, I use SQL Server Management Studio (SSMS) and SQL Server Profiler for monitoring SQL Server.
I use SSMS to monitor server activity, query performance, and resource usage.
I use SQL Server Profiler to capture and analyze SQL Server events and performance data.
I also use third-party tools like SolarWinds Database Performance Analyzer and Redgate SQL Monitor for more advanced monitoring and alerting.
Regularly monitoring SQL Server helps identify and resolve performance issues...read more

Asked in DXC Technology

Q. What is the difference between Summary.txt and Detail.txt?
Summary.txt contains summarized information while Detail.txt contains detailed information.
Summary.txt provides a brief overview of data while Detail.txt provides a more comprehensive view.
Summary.txt may contain aggregated data while Detail.txt contains individual data points.
Summary.txt is useful for quick analysis while Detail.txt is useful for in-depth analysis.
Example: Summary.txt may contain total sales for a month while Detail.txt contains sales data for each day of th...read more
Asked in Yes Madam

Q. Tell me something about master and slave? Replication and it's working
Master and slave are terms used in database replication. Master is the primary database and slave is a copy of it.
Master database is the primary database that is used for read and write operations.
Slave database is a copy of the master database that is used for read-only operations.
Replication is the process of copying data from one database to another.
Replication can be one-way or two-way.
In one-way replication, changes made to the master database are copied to the slave dat...read more

Asked in DXC Technology

Q. How do you identify deadlocks in SQL Server?
Deadlocks in SQL Server can be identified using SQL Server Profiler or by querying the system_health extended event session.
Use SQL Server Profiler to capture deadlock events
Query the system_health extended event session to view deadlock graphs
Use sp_whoisactive to identify blocking and deadlocking processes
Enable trace flag 1222 to capture deadlock information in the SQL Server error log

Asked in DXC Technology

Q. If TempDB is full, how do you resolve it?
To resolve TempDB full issue, identify the cause and take appropriate action.
Identify the cause of TempDB full issue using DMVs or third-party tools
Check for long-running transactions or open transactions
Check for large sorts or hash joins
Increase the size of TempDB or add more files
Move TempDB to a faster disk
Restart SQL Server to clear TempDB
Modify application code to reduce TempDB usage

Asked in DXC Technology

Q. What is the command for a Tail Log backup?
The command for Tail log backup is BACKUP LOG WITH NORECOVERY
Use the BACKUP LOG command to create a tail log backup
Add the WITH NORECOVERY option to allow further log backups
Tail log backups are used to capture any transactions that occurred after the last log backup
Syntax: BACKUP LOG database_name TO disk = 'backup_device' WITH NORECOVERY

Asked in DXC Technology

Q. What issues have you faced with log shipping?
Issues faced in log shipping
Network latency causing delays in log shipping
Log backups not being taken frequently enough
Failure to restore logs due to mismatched log backups
Lack of monitoring and alerting for log shipping failures

Asked in DXC Technology

Q. What are the isolation levels in SQL Server?
Isolation levels in SQL Server determine how transactions interact with each other.
There are five isolation levels: READ UNCOMMITTED, READ COMMITTED, REPEATABLE READ, SNAPSHOT, and SERIALIZABLE.
Each level has its own trade-offs between concurrency and consistency.
The default isolation level is READ COMMITTED.
Isolation levels can be set at the transaction level or for the entire database.
For example, the SNAPSHOT isolation level allows for consistent reads even when data is be...read more

Asked in DXC Technology

Q. What tasks did you perform using the ticketing tool?
I used the ticketing tool to track and manage database-related issues and requests.
Create and assign tickets for database-related issues and requests
Monitor ticket status and update as necessary
Communicate with stakeholders regarding ticket status and resolution
Close tickets once issues are resolved
Generate reports on ticket volume and resolution time

Asked in DXC Technology

Q. Do you have any experience with replication?
Yes, replication is the process of copying and distributing data from one database to another.
Replication is used to improve data availability, scalability, and disaster recovery.
It involves a publisher database that sends data to one or more subscriber databases.
There are three types of replication: snapshot, transactional, and merge.
Snapshot replication copies the entire database to the subscriber.
Transactional replication sends only the changes made to the database since t...read more

Asked in DXC Technology

Q. What is point in time recovery?
Point in time recovery is the ability to restore a database to a specific moment in time.
It allows for recovery of data up to a specific point in time.
It requires regular backups and transaction logs.
It is useful in case of accidental data deletion or corruption.
It can be done manually or through automated tools.
Example: Restoring a database to its state before a specific transaction occurred.

Asked in DXC Technology

Q. Do you have any experience with SQL Profiler?
SQL Profiler is a tool used to capture and analyze SQL Server events and activities.
SQL Profiler captures events such as queries, stored procedures, and errors.
It can be used to troubleshoot performance issues and optimize queries.
Profiling can be done on a live server or on a trace file.
Events can be filtered and grouped for easier analysis.
SQL Profiler has been replaced by Extended Events in newer versions of SQL Server.

Asked in DXC Technology

Q. What is the backup strategy you have?
Our backup strategy includes full backups weekly, differential backups daily, and transaction log backups every 15 minutes.
Weekly full backups
Daily differential backups
Transaction log backups every 15 minutes
Backups stored on separate disk
Regular testing of backups for restoration

Asked in DXC Technology

Q. What ticketing tool do you use?
We use ServiceNow as our ticketing tool.
ServiceNow is a cloud-based platform that offers IT service management (ITSM), IT operations management (ITOM), and IT business management (ITBM) solutions.
It allows us to manage incidents, problems, changes, and service requests in a single system.
We can also track the status of tickets, assign them to team members, and set priorities and deadlines.
ServiceNow also provides reporting and analytics capabilities to help us monitor perform...read more

Asked in Microland

Q. Database migration from lower version to higher version
Database migration involves upgrading a lower version of a database to a higher version.
Ensure compatibility between the source and target database versions
Backup the source database before migration
Use a migration tool or script to transfer data and schema
Test the migrated database thoroughly before deploying to production

Asked in Datavail Infotech

Q. What is a quorum disk, and what are its advantages and disadvantages?
Quorum disk is a shared disk used in a Windows Server Failover Cluster to store cluster configuration data.
Advantages: Provides a single point of reference for cluster configuration data, ensures consistency of data across all nodes, enables automatic failover of cluster resources.
Disadvantages: Single point of failure, requires additional hardware, can be a bottleneck for cluster performance.
Example: In a 3-node cluster, a quorum disk can be used to store the cluster configu...read more

Asked in Capgemini

Q. difference between logshipping mirroring, tempdb corruption, master db corruption, agents used in replication
Explanation of differences between logshipping, mirroring, tempdb corruption, master db corruption, and agents used in replication
Logshipping involves copying and restoring transaction logs from one server to another for disaster recovery.
Mirroring involves maintaining an exact copy of a database on a secondary server for failover purposes.
Tempdb corruption can occur due to hardware failures, software bugs, or other issues affecting the temporary database.
Master db corruption...read more

Asked in Datavail Infotech

Q. What is replication and what are its types?
Replication is the process of copying and distributing data from one database to another.
Types of replication include snapshot replication, transactional replication, and merge replication.
Snapshot replication copies the entire database at a specific point in time.
Transactional replication copies only the changes made to the database since the last replication.
Merge replication combines changes made to the database at different locations.
Replication can be used for backup, re...read more
Interview Experiences of Popular Companies





Top Interview Questions for MS SQL DBA Related Skills



Reviews
Interviews
Salaries
Users

