Script to Delete Azure SQL Database if serverName is Null

半城伤御伤魂 提交于 2019-12-11 10:44:52

问题


We have some solutionDB(lets say solution100) that stuck in the creating state so the serverName would be NULL, I have to delete the solutionDB if the ServerName is null.

So first I have to get the list of SQL databases and server names, iterate through the list, and then delete the solutionDB if the serverName is NULL.


回答1:


From what you describe, I guess that you are creating an SQL Database with a new SQL Server. But, the creation is stuck at server level, which means the SQL server has not been created yet. There is no server, so there is no database yet at all. Hence, there is nothing you can delete.

Now, the only thing you need to do is to figure out at what step the creation is stuck.

Here are some hints for you.

  1. Log into the new Portal, click Browse at the left navigation of the page.

  2. Enter Audit Logs to search. And then, click Audit Logs

  3. Click filter, and choose the resource group of your SQL Database to narrow your search.

  4. Now, you will be able to see a column with operation Update SQL database. Click it, and you will be able to see what's wrong with your SQL database creation.



来源:https://stackoverflow.com/questions/35028728/script-to-delete-azure-sql-database-if-servername-is-null

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!