Azure SQL Server弹性池-自动将数据库添加到池 [英] Azure SQL Server Elastic Pool - automatically add database to pool
问题描述
当前,我们有一个Azure SQL Server,每次创建新的Web应用程序时,我们都会使用EF Core Code First来生成数据库。但是,在创建数据库之后,我们手动转到Azure门户,然后将新创建的数据库添加到Azure SQL Server内的弹性池中。是否可以通过某种方式使该过程自动化,以便每个新创建的数据库(无论是通过门户网站还是使用EF或其他方式生成的数据库)都将自动添加到池中?
Currently we have an Azure SQL Server and each time we create new web app, we use EF Core Code First to generate the database. However after the database is created we manually go to Azure portal and add the newly created database to the Elastic Pool inside the Azure SQL Server. Is it possible to somehow automate the process so that each newly created database either via portal or generated using EF or whatever, it will be automatically added to the Pool?
推荐答案
您可以使用Transact-SQL以编程方式将现有的Azure SQL数据库移动到弹性池中。
You can use Transact-SQL to programmatically move an existing Azure SQL Database into an elastic pool.
ALTER DATABASE db1
MODIFY ( SERVICE_OBJECTIVE = ELASTIC_POOL ( name = pool1 ) ) ;
这篇关于Azure SQL Server弹性池-自动将数据库添加到池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!