使用Elastic Database Agent创建Sql数据库 [英] Create Sql Database using Elastic Database Agent

查看:82
本文介绍了使用Elastic Database Agent创建Sql数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个用ASP.NET Core 2.2编写的门户,该门户托管在Azure中.我们的客户使用此门户网站来管理自己的数据.每个客户的数据必须存储在其自己的单独数据库中.

因此,我需要从门户网站启动我用作模板(也托管在Azure中)的数据库的新副本的创建.显然,我在网站上没有任何繁重的工作,但是我想让Elastic Database Agent创建数据库 然后应用所需的任何种子数据.

有人可以告诉我实现此目标的最佳方法吗?我会尝试流利吗?我可以使用REST方法吗?我对TSQL和C#感到满意.我想让它自动化...而不是Powershell命令列表.

一个很好的例子或很棒的例子.

预先感谢您的帮助,

Joel

解决方案

我有一个用ASP.NET Core 2.2编写的门户网站,该门户网站托管在Azure中.我们的客户使用此门户网站来管理自己的数据.每个客户的数据必须存储在其自己的单独数据库中.

因此,我需要从门户网站启动我用作模板(也托管在Azure中)的数据库的新副本的创建.显然,我在网站上没有任何繁重的工作,但是我想让Elastic Database Agent创建数据库 然后应用所需的任何种子数据.

有人可以告诉我实现此目标的最佳方法吗?我会尝试流利吗?我可以使用REST方法吗?我对TSQL和C#感到满意.我想让它自动化...而不是Powershell命令列表.

一个很好的例子或很棒的例子.

预先感谢您的帮助,

乔尔

美好的一天,

>>  每个客户的数据必须存储在其自己的单独数据库中.

您确定针对案件使用正确的解决方案吗?
只是为了澄清一下,您基本上是在使用Azure数据库谈论为每位客户创建新服务

话虽这么说,在这种情况下使用Azure Elastic Jobs听起来很完美.您可以将所有数据库放在弹性池下,也可以放在特定的逻辑服务器下(这将是您的工作目标),然后 方式,使用Elastic Job,您可以管理目标中的所有数据库,而无需手动添加/删除数据库.目标中的任何新数据库将由作业自动管理:-)

>>  我在网站上没有什么负担

我看不出这有什么关系.由于您将Azure数据库用作一项服务,因此它是与您的网站完全独立的服务.

>>  我想让Elastic Database Agent创建数据库

您确定您了解Elastic Job和Elastic Agent的含义吗?我无法在论坛上详细介绍一个消息,也许现在是重新考虑您的体系结构的好时机.对于您的请求有问题,我将尝试给出一些指导:

Azure Elastic Agent不创建任何内容,仅管理Elastic作业.您在炉灶上所做的是一个不同的故事.

不幸的是,作业在数据库级别执行.由于Azure不支持三个部分的名称,并且Elastic Job打算在多个用户的数据库上执行和/或安排执行,因此听起来不像与 弹性作业.

您能否详细说明与Elastic Job的关系?
* CREATE DATABASE仅在主数据库上执行,听起来好像您不需要安排执行正弦,这并不意味着您每X次获得一个新客户.根据您的描述,您需要执行CREATE DATABASE 每个新客户一次.

>>  我希望此操作自动化.

您到底想自动化什么?!?
这是了解您需要的最重要的要点

您是否需要在特定时间或每个时间间隔(例如每天)安排任务.如果答案是否定的,那么执行此自动化任务的触发器是什么?

>>  有人可以告诉我实现此目的的最佳方法吗?...  乍一看,我觉得您应该考虑使用 Azure Function ,并且可能将其与 Azure自动化 .


I have a portal written in ASP.NET Core 2.2 that is hosted in Azure.  This portal is used by our customers to manage their own data.  Each Customer's data must be stored in its own separate database.  

So, from the portal I need to initiate the creation of a new Copy of a database I use as a template (also hosted in Azure).  Obviously, I can't have any heavy lifting on the Web Site but I would like to have the Elastic Database Agent create the database then apply whatever seed data is required.

Can someone tell me the best approach to accomplish this?  Do I attempt Fluent?  Do I go with the REST approach?  I am comfortable with TSQL as well as C#.  I want this automated... not a list of powershell commands.

A good working example or something close would be awesome.

Thanks in advance for your help,

Joel

解决方案

I have a portal written in ASP.NET Core 2.2 that is hosted in Azure.  This portal is used by our customers to manage their own data.  Each Customer's data must be stored in its own separate database.  

So, from the portal I need to initiate the creation of a new Copy of a database I use as a template (also hosted in Azure).  Obviously, I can't have any heavy lifting on the Web Site but I would like to have the Elastic Database Agent create the database then apply whatever seed data is required.

Can someone tell me the best approach to accomplish this?  Do I attempt Fluent?  Do I go with the REST approach?  I am comfortable with TSQL as well as C#.  I want this automated... not a list of powershell commands.

A good working example or something close would be awesome.

Thanks in advance for your help,

Joel

Good day,

>> Each Customer's data must be stored in its own separate database. 

are you sure that you use the right solution for your case?
Just to clarify, using Azure Database you basically talking about creating new service for each customer

With that being said using Azure Elastic Jobs sound perfect for this case. You can put all the databases under Elastic Pool or simply under a specific logical server (which will be your Job Target) and this way, using Elastic Job you can manege all the databases in the target without the need to manually add/remove databases. Any new DB in the target will automatically be managed by the job :-)

>> I can't have any heavy lifting on the Web Site

I don't see how this is relevant. Since you are using Azure Database as a service which is totally separate services from your website.

>> I would like to have the Elastic Database Agent create the database

Are you sure that you understand the meaning of Elastic Job and Elastic Agent? I cannot elaborate in one message in th forum and maybe it is a good time to re-think about your architecture. I will try to give some direction on the problematic of your request:

Azure Elastic Agent does not create anything, but only manages Elastic jobs. What you do in the hobs is a different story.

Unfortunately, the jobs executed on the databases level. Since Azure does not support three parts names, and Elastic Job meant to be executed on multiple user's database and/or schedule execution, it does not sound like something that have any relation to Elastic Jobs.

Can you elaborate what is the relation to Elastic Job?
* CREATE DATABASE is executed on the master database only, and it does not sound like you need to schedule the execution sine it make no sense that you get exactly one new customer every X time. According to your description you need to execute the CREATE DATABASE once for each new customer.

>> I want this automated.

What exactly you want to automated ?!?
THIS IS THE MOST IMPORTANT POINT TO UNDERSTAND WHAT YOU NEED

Do you need to schedule the task for specific time,or for every interval of time (for example every day). If the answer is no, then what is the trigger that will execute this automated task?

>> Can someone tell me the best approach to accomplish this?... I am comfortable with TSQL as well as C#.

Once I will, get more information (especially the point above regarding the meaning of the automated the task), I will probably be able to point you better to a solution, but in the mean time using the description here, in first glance I don't see any relation to Elastic Agent (for the creation of the new database) and since you familiar with C# and you come from the developing side, It sound to me in first glance that you should think about using Azure Function and maybe combine it with Azure Automation.


这篇关于使用Elastic Database Agent创建Sql数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆