简体   繁体   English

如何使用Elastic Pool通过Azure SQL中的存储过程备份和还原数据库?

[英]How to backup and restore databases through stored procedure in Azure SQL using Elastic Pool?

I have a C# ASP.NET MVC based web application in which there is a functionality of Archiving (backup) and Restoring Databases on the click of button. 我有一个基于C#ASP.NET MVC的Web应用程序,单击该按钮后便具有存档(备份)和还原数据库的功能。 Currently, our system is On-Prem and so we are using the stored procedures in SQL Server to do the backup and restore. 当前,我们的系统为本地,因此我们正在使用SQL Server中的存储过程进行备份和还原。

Now we are migrating to Azure PaaS and are using Elastic Pool. 现在,我们正在迁移到Azure PaaS,并且正在使用Elastic Pool。 As the backup and restore T-SQL commands do not work in Azure SQL , so can someone please help me in finding a way to do the backup and restore of DBs manually through T-SQL ? 由于备份和还原T-SQL命令在Azure SQL中不起作用,因此有人可以帮助我找到一种通过T-SQL手动进行数据库 备份和还原的方法吗?

Any help would be highly appreciated! 任何帮助将不胜感激!

Auto backups is a feature of Azure SQL database. 自动备份是Azure SQL数据库的功能。 在此处输入图片说明

In SQL Azure, database backups are executed automatically and it is not possible to change this behavior. 在SQL Azure中,数据库备份是自动执行的,无法更改此行为。 This is a service offered when you create a SQL Azure database and the first full backup occurs immediately after you create a new SQL Azure database and the rest of the backups are scheduled by SQL Azure itself. 当您创建SQL Azure数据库并在创建新的SQL Azure数据库后立即进行首次完全备份,而其余备份由SQL Azure本身安排时,将提供此服务。

There is no way can help you backup and restore of DBs manually through T-SQL. 没有任何方法可以帮助您通过T-SQL手动备份和还原数据库。

Hope this helps. 希望这可以帮助。

Thanks for the quick answer,Leon! 谢谢你的快速回答,莱昂! :) :)

So that it could be helpful to other community members, I would like to mention another way to achieve the same as it can't be done by T-SQL. 为了对其他社区成员有所帮助,我想提及另一种实现相同目标的方法,这是T-SQL无法完成的。

What I have done instead is, I have used SQLPackage.exe utility embedded in a batch script and executed that batch script through my C# code to achieve the same functionality. 我要做的是,使用嵌入在批处理脚本中的SQLPackage.exe实用程序,并通过C#代码执行该批处理脚本以实现相同的功能。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM