Deleting Azure SQL DB

So you want to do a clean-up exercise in Azure and remove some databases. You go to delete a database that is no longer required (as shown below).

ElasticMain

But you get an error code 400 – Failed to delete the database: ElasticMain.

Full message:

ErrorCode: 400: ErrorMessage: The database ElasticMain on server smarties is used by job account elasdba. Database cannot be deleted or renamed while associated with job account.

What is going on? This is not an ordinary database. This is the control database (see this link for more details https://docs.microsoft.com/en-us/azure/sql-database/sql-database-elastic-jobs-overview)  that stores all the metadata for when elastic jobs have been setup. (Which I totally forgot about).

Well as the message states you have to remove the job agent before deleting the database that used to be associated with the control database.

deletemain

So navigate to elastic job agents and then click delete. Then you will be able to remove the database.

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s