SQL 备份作业脚本 windows 计划任务 [英] SQL backup job script windows schedule task

查看:73
本文介绍了SQL 备份作业脚本 windows 计划任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道使用 SQL 服务器代理获取备份数据库的可能性,但我很想知道我们是否可以有一个仅在 Windows 中运行的备份脚本(如批处理文件),并根据我们的计划进行自动备份定义?

I knew about the possibility to get backup db using SQL server agent, but I was curious to know if we can have a backup script (like batch file) that just runs in windows and gets automatic backup according to the schedule that we define?

我认为在下一部分我们可以使用 Windows 任务计划(或 crontab)来定期运行备份脚本作业,但最重要的是要知道:是否可以通过 SQL 登录并仅使用批处理脚本文件(完全不需要SQL管理工作室并且完全独立工作)?
如果答案是肯定的,请告诉我我也有.

I think for the next part we can use windows task schedule (or crontab) for run the backup script job routinely, but the most important thing is to know: is it possible to login via SQL and backup the DB just using a batch scrip file (that there not be any need for SQL management studio completely and work completely independent)?
If the answer is yes, please let me know that I have it, too.

也许这似乎是一个愚蠢的问题,但我对此并不那么有经验.

Maybe it seems to be a silly question, but I am not so experienced about that here.

推荐答案

是的,你可以!.

如果您有 SQLServer Express 版本,则不能使用 SQLAgent,因此唯一的方法是在 SQLServer 之外,例如 .bat 文件.在此链接中,您有一个示例脚本..Bat 脚本

If you have SQLServer Express version you can't use SQLAgent, so the only way is outside of the SQLServer, like a .bat file. In this link you have an example script. .Bat Script

现在您可以使用计划任务来计划备份.

now you can use schedule task to schedule the backup.

如果您可以使用 SQL 代理,您可以为完整备份创建维护计划,然后在 SQL 代理中创建一个作业来运行它.在此链接中,您可以找到一些示例,包括脚本和维护计划和作业:使用 SQLAgent

If you can use SQL Agent, you could create a Mainteinance Plan for a Full Backup and next create a Job in SQL Agent to run it. In this link is you can find some examples, with script and mainteinance Plan and Jobs: With SQLAgent

希望对您有所帮助!

这篇关于SQL 备份作业脚本 windows 计划任务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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