Open In App

Microsoft Azure – Delete Databases in AzureSQL

Last Updated : 21 Aug, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

Azure SQL Database enables users to build apps more quickly by providing a fully managed SQL database system in which users may install advanced query processing features like high-performance in-memory technologies and intelligent query processing based on their needs. It is also able to work with data in a variety of formats, including relational, graph, JSON, and spatial data.

What is Azure SQL Database?

Azure SQL Database is a fully managed platform, offered by Microsoft Azure. As a service (PaaS) database engine, it handles different database management operations such as upgrading, patching, backups, and monitoring automatically and efficiently without the user’s involvement each time, with just a few commands.

Best Practices for Deleting Databases in Azure SQL

Azure databases are created according to the need of the user and can easily be deleted after completing the purpose. There can be various reasons why one needs to delete an SQL database. From which the most simple reason could be that the user no longer needs the database and want to save costs. Or due to duplication, or one wants to remove any sensitive or corrupted data from the database.

Whatever the reason, firstly, we should always consider taking a full backup before proceeding to deletion. It could be useful later if we need to re-create the same database. also, it’ll be more convenient in performing a comparison of old and new data, and reach a conclusion. In case, some error is detected during the comparison, we can easily revert the data to the previous one. To know how to create an Azure SQL database refer to Microsoft Azure – Create Azure SQL Database.

Here, we will talk about two simple ways to delete the Azure SQL database. Let’s proceed.

Using SQL Server Management Studio to delete SQL database

Step 1: Open the Azure portal and sign in following the proper credentials.

Step 2: click on the SQL database option.

Step 3: Select the database that is needed to delete and proceed to the overview option.

Step 4: here, a delete button will appear, as could be seen in the picture below.

Azure-delete-1

Step: 5 by Clicking on the delete button, a new pop-up will appear on the right for confirmation, here, in the textbox, we simply need to type the database name and push on the delete button at the bottom, as could be seen in the image below.

Azure-2

It might take a few seconds be permanently deleting the database from the server.

Deleting Azure Database Through Transact-SQL

Step: 1 Go to the Database Engine under connect.

Step: 2 In the Standard bar, click on the New Query.

Step: 3 Copy and paste the database name into the query window, as in the given example below:

USE master ;  
GO
DROP DATABASE Sales, NewSales ;
GO

Step: 4 then, select Execute.

Conclusion: Deleting databases in Azure SQL is a crucial skill when working with cloud-based data. it is helpful in the process of optimization of data storage, security, and overall performance. Here in this article, we have talked about some basic methods of deleting databases in Azure SQL, such as the Azure portal, of Transact-SQL. Although, this step is essential for optimization and overall performance, however, it still needs careful planning and execution. Therefore, a backup is highly recommended before deleting any database.  

FAQs On Databases in AzureSQL

1.    How Can We Prevent The Accidental Deletion Of A Database In The SelectingAzure Portal?

When working with an Azure SQL database, it’s common to face situations like accidental deletion. In such cases, we can use Microsoft Azure’s Resource Locks services to help protect our data. It can aid in preventing accidental deletion or modification of the database.

2. How Can We Find Out Who Deleted The Database In The Azure Portal?

The service Azure Activity Log can be used to monitor database deletion operations. This option makes it simple to keep track of all activities carried out within any database. Simply select Activity Log under Monitor to access this option.

3. What Happens To The Backup Of A Deleted Database In The Azure Portal?

After the deletion date, the backup of a deleted database is kept for seven days. Within this period, the database can be restored using the backup if needed. The backup will be deleted permanently after seven days automatically.

4. How Can We Restore a Deleted Database In The Azure Portal?

We can restore the database from the backup vault within the seven-day retention period by enabling geo-redundant backups. We can navigate to the Backup Centre and choose SQL Database to recover the deleted database.


Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads