英文:
How to automatically backup a SQL Database as a script (.sql file)
问题
我可以使用SSMS保存我的Azure SQL数据库为脚本,按照这个指南操作:
https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/common-import-and-export-sql-database-to-sql-script-via-sql-management-studio
如何使这个脚本导出过程自动化?我想每天早上运行它,而不必手动操作。
我找到了一些解决方案,可以实现自动数据库备份,但目前还没有找到能将备份保存为.sql文件的方法。
我更喜欢.sql文件而不是.bak文件,因为我希望在可能恢复备份之前能够阅读和编辑它(这是一个小型数据库)。
英文:
I am able to save my Azure SQL database as a script using SSMS following this guide:
https://docs.telerik.com/devtools/aspnet-ajax/knowledge-base/common-import-and-export-sql-database-to-sql-script-via-sql-management-studio
How can I make this script export an automatic process? I would like to run it every morning without having to do this manually.
I have found several solutions to make automatic database backups, but none so far that save the backup as a .sql file.
I would prefer a .sql file over a .bak file, as I would like it to be readable & editable before potentially restoring a backup (this is a small database).
答案1
得分: 2
如果您正在使用Azure SQL,您可能已经意识到数据库会自动备份。然而,为了回答您的具体问题,您可以编写一个PowerShell脚本,然后让Azure自动化定期执行此脚本。
英文:
If you are using Azure SQL you're probably aware that the database is automatically backed up. However, to answer your specific question you could write a PowerShell script and then have Azure Automation execute this on a regular basis.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论