简体   繁体   English

列出 Azure SQL 服务器中所有弹性池的 T-SQL 是什么?

[英]What is the T-SQL to list all elastic pools in an Azure SQL Server?

I have more than one Azure SQL Server which each may contain at least one SQL Elastic Pool.我有不止一台 Azure SQL 服务器,每台服务器可能至少包含一个 SQL 弹性池。 I am trying to build a SQL script that can execute a CREATE DATABASE statement on any of those servers and select one of the available pools on that server.我正在尝试构建一个 SQL 脚本,该脚本可以在任何这些服务器和 select 该服务器上的可用池之一上执行 CREATE DATABASE 语句。 To that end, I would like to know the T-SQL statement which would list all the available elastic pools on this server.为此,我想知道将列出该服务器上所有可用弹性池的 T-SQL 语句。 I have found the SQL below which will list all the databases on the server and which pool they are in:我在下面找到了 SQL,它将列出服务器上的所有数据库以及它们所在的池:

SELECT d.database_id, d.name, elastic_pool_name
FROM sys.databases d
JOIN sys.database_service_objectives dso ON d.database_id = dso.database_id

However, this only returns master on a new server so I can't tell what the pool name(s) are to create a new database in a pool on the server.但是,这只会在新服务器上返回master ,所以我无法确定在服务器上的池中创建新数据库的池名称是什么。 I also found this REST API endpoint to list all elastic pools on a server , but I need to execute this in SQL and not via HTTP.我还发现这个 REST API 端点列出服务器上的所有弹性池,但我需要在 SQL 中执行此操作,而不是通过 HTTP。

You can get the list of elastic pools on the server from sys.elastic_pool_resource_stats您可以从 sys.elastic_pool_resource_stats 获取服务器上的弹性池列表

select distinct @@servername as servername, elastic_pool_name from sys.elastic_pool_resource_stats

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Azure SQL 托管实例T-SQL查询调试 - Azure SQL Managed Instance T-SQL query debugging Azure Synapse Serverless SQL 池 - 如何优化笔记本 - Azure Synapse Serverless SQL Pools - how to optimize notebook 来自多个来源且 ID 未知的数据 T-SQL 和 Azure SQL Edge - Data from multiple sources with unknown ids T-SQL and Azure SQL Edge T-SQL - 需要批定界符 - T-SQL - batch delimiter required 无法启动和运行我的 azure sql 服务器 - Can't get my azure sql server up and running 类似于 PL/SQL 或 T-SQL 的 Google Cloud Spanner 脚本? - Google Cloud Spanner scripting similar to PL/SQL or T-SQL? AWS RDS SQL Server 上的 Azure Devops 服务器 - Azure Devops Server on AWS RDS SQL Server 表不再出现在连接列表中 - Azure Data Studio 1.41、Azure SQL 服务器数据库 - Tables No Longer Appear in Connections List - Azure Data Studio 1.41, Azure SQL Server Database AzureDevOps - Azure SQL 服务器部署问题及解决方案 - AzureDevOps - Azure SQL Server deployment Problems and Solution SQL 服务器 - 将代理作业迁移到 Azure - SQL Server - Migrate Agent Jobs to Azure
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM