DBAtools

Nisarg Upadhyay
set database to single user mode

ALTER DATABASE SET SINGLE_USER statement in SQL Server

June 7, 2021 by

In this article, we are going to explore the purpose of the ALTER DATABASE SET SINGLE_USER statement. The ALTER DATABASE SET SINGLE_USER is used to put the database in single-user mode. When any database is in single-user mode, the new user cannot connect to the database. However, the users that are already connected to the database do not get disconnected.

Read more »
Nisarg Upadhyay
Task execution history

Automate consistency checks of SQL database using Windows Task Scheduler

April 20, 2021 by

The SQL database integrity check is one of the most crucial and important tasks of the database administrator. The database integrity task checks the structural integrity and allocation of all database objects and indexes. The integrity checks can be performed by using the DBCC CheckDB command. The CheckDB command is used to identify the corruption in the database. The command performs the following operations on the database.

Read more »
Nisarg Upadhyay
Job execution history

Automate SQL database backups using Windows Task Scheduler

April 15, 2021 by

In this article, we will learn how we can automate the backup of SQL database created in SQL Server Express edition. SQL Server Express edition is a lightweight database that has limited functionalities and resource allocation. The SQL Server Express edition does not support SQL Server Agent jobs, so it is tricky to automate various database administration tasks.

Read more »
Nisarg Upadhyay
drag-drop index maintenance task

Automate rebuilding SQL Database indexes using Maintenance Plans

April 9, 2021 by

Index maintenance is a vital part of a database administrator’s job. I have worked for few clients who often face performance issues in SQL Database and don’t have a dedicated DBA. I remember that one of our clients was facing performance issues. I logged in to their server and found that they did not set up any index maintenance jobs; therefore, many indexes were fragmented, causing the problem.

Read more »
Nisarg Upadhyay
Drag and drop Backup database task

Automate SQL database backups using Maintenance Plans

February 12, 2021 by

In this article, we are going to learn how we can automate the backup of the SQL database using database maintenance plans. Data is one of the most important assets of any organization, and as a database administrator, it is our prime responsibility to protect it. There are various tools available that can be used to back up the data. These tools use state of the art technology to protect the data, and some of them are very costly. Instead of using these costly tools, some organizations prefer to use SQL native backups. These backups of SQL database can be automated by SQL Server Agent Jobs or Windows’ task scheduler.

Read more »
Nisarg Upadhyay
Screenshot of email

T-SQL scripts to update statistics based on the row modification

December 24, 2020 by

In this article, we are going to learn how we can develop a T-SQL script to update statistics of tables based on the row modification. It is always a challenging task to perform maintenance on a table that has billions of rows. During the early years of my professional career, I was assigned a project and one of our clients had performance issues. The initial analysis showed that due to frequent data modifications, a specific table’s statistics become outdated.

Read more »
Nisarg Upadhyay
Job schedule

T-SQL scripts to generate database health reports

October 21, 2020 by

In this article, I am going to show how we can automate a database daily health report using T-SQL scripts. For a senior database administrator, it is always important to review the health of the database server. When a DBA manages many database servers, it becomes difficult to visit every server and review the status of databases, SQL jobs, and backups. To ease the monitoring, I have developed a T-SQL script that populates the following information:

Read more »
Nisarg Upadhyay
New Job Schedule that executes a SP to populate the unused tables of SQL Database

Identify unused tables of SQL databases

September 24, 2020 by

In this article, I am going to demonstrate how we can identify the unused tables of a given SQL Database. As a database administrator, we must maintain the tables and objects of the SQL Database. In my organization, when we add a new column or change the data type of a column, we export the data of the existing table in the backup table. Often, we forgot to review and maintain those backup tables. So as a solution, we decided to create a SQL Job that populates the list of unused tables and email the list to the DBA Team for review.

Read more »
Ben Richardson
Screenshot of Query Store fully enabled.

Performance Monitoring via SQL Server Query Store

August 19, 2019 by

SQL Server Query Store is a performance monitoring tool that helps us evaluate the performance of a SQL query in terms of several different performance metrics such as CPU and Memory Consumption, execution time and the I/O cycles consumed by the query. Query store is similar to the windows “Task Manager”. A task manager provides information about the CPU, Memory, Network and Disc consumption of a process. Similarly, the Query Store provides insight to similar information.

Read more »
Rajendra Gupta
Get-DbaTable DBATools command

Script SQL Server objects using DBATools

June 20, 2019 by

This article gives an overview to generate scripts for SQL Server objects with Windows PowerShell tool DBATools.

Database administrators or developers require generating scripts for SQL Server objects. We might need scripts to store a copy of object script before object change, create specific objects into other database environments such as development, UAT or non-prod environment. It is an excellent practice to keep a copy of the object before making a change to it. We can easily refer to the old script and roll back if required. Usually, we use SSMS Generate Scripts wizard to get these scripts.

Read more »