This post was originally published on SQLDocKit Blog.
My company Acceleratio Ltd. is an ISV (independent software vendor), which means we make our own software and then sell it to our many customers all over the globe.
We are in the sysadmin business, building tools that help our customers to be more efficient when managing their Windows, Citrix, SharePoint or SQL Server environments.
The key to building great software is to test it thoroughly in every imaginable situation. That means we have to have hundreds of different virtual environments ready for use by our dev and QA teams to test and further develop our software.
We have so many combinations that it is hard to list them all, but we cover everything from Windows Server 2003 to Windows Server 2016, from SharePoint 2007 to SharePoint 2016. On top of that, we also test our tools on various localized products such as French Windows or a German SQL Server.
Successfully manage SQL Server databases with SQLDocKit
To recreate the various challenges faced by our customers, we also have hundreds of databases that are prefilled or used to simulate a very specific problem a customer is facing. As we grow, we have had to find a way to manage all these databases, and that’s how the idea for SQLDocKit was born.
In today’s busy corporate landscape, a developer might “forget” to delete a 100GB test database that no longer needs, and as the years go by, might have many TBs of unused databases lying around, cluttering precious SQL Server and storage resources.
With the latest release of SQLDocKit, we finally have the tool in our arsenal that can free us of all these databases that are no longer needed.
Here is how SQLDocKit can help you do that:
1. Connect to the SQLDocKit Console and jump into Live Explorer.
2. If the tool is already configured, it will show you all of your SQL Servers you on the left-hand side.
3. Expand the SQL Server or instance you want to explore and choose the Databases node on the right-hand side; the tool will show you the list of all databases.
A visual indicator will be shown, which will allow you to easily distinguish databases that are in the read-only state, in recovery, suspects, etc. Once I got a hold of this list, I took the following steps in order to get rid of some of the databases:
- Sort databases by size and look at the largest. If these haven’t been used for a while (e.g. two weeks), use the Change State button to make these Read-Only; then alert the owner to check whether she needs this database anymore.
- Now check databases that have no connections. This could be an indicator that a database is no longer in use. Even if a database has an open connection, that does not necessarily mean it is being used proactively. A connection could be opened by a system job, backup or other action that is no longer needed. Use Show Connections and Kill Connections to view and manage database connections.
- Check for databases whose owner has left the company; try to find the person responsible and use the Change Owner button to transfer ownership if needed.
When it comes to removing databases, we currently have two options available: Detach and Drop. I probably didn’t mention that all of our commands come with integrated support for multiple databases. Want to drop 10 databases with a single click? Yeah, not a problem, we’ve got you covered. And you know what else? On top of that, we also support multiple SQL servers. Want to drop or manage databases from a number of different SQL Servers? You can do that as well.
SQLDocKit bonus options
There is one hidden bonus, you know how in SQL Management Studio sometimes you cannot drop a and get the following error: “Cannot drop database “DB_Name” because it is currently in use. (Microsoft SQL Server, Error: 3702)”, well that’s not going to be a problem if you are going to be using SQLDocKit from now on, as SQLDocKit is going to close all your connections automagically.