• <bdo id='6KPoP'></bdo><ul id='6KPoP'></ul>
  • <i id='6KPoP'><tr id='6KPoP'><dt id='6KPoP'><q id='6KPoP'><span id='6KPoP'><b id='6KPoP'><form id='6KPoP'><ins id='6KPoP'></ins><ul id='6KPoP'></ul><sub id='6KPoP'></sub></form><legend id='6KPoP'></legend><bdo id='6KPoP'><pre id='6KPoP'><center id='6KPoP'></center></pre></bdo></b><th id='6KPoP'></th></span></q></dt></tr></i><div id='6KPoP'><tfoot id='6KPoP'></tfoot><dl id='6KPoP'><fieldset id='6KPoP'></fieldset></dl></div>
    <legend id='6KPoP'><style id='6KPoP'><dir id='6KPoP'><q id='6KPoP'></q></dir></style></legend>

  • <small id='6KPoP'></small><noframes id='6KPoP'>

        <tfoot id='6KPoP'></tfoot>

        如何在 SQL Server Express 版中创建作业

        时间:2023-07-16
          • <tfoot id='vGlTm'></tfoot>

              <bdo id='vGlTm'></bdo><ul id='vGlTm'></ul>

                <small id='vGlTm'></small><noframes id='vGlTm'>

                1. <legend id='vGlTm'><style id='vGlTm'><dir id='vGlTm'><q id='vGlTm'></q></dir></style></legend>
                    <tbody id='vGlTm'></tbody>

                2. <i id='vGlTm'><tr id='vGlTm'><dt id='vGlTm'><q id='vGlTm'><span id='vGlTm'><b id='vGlTm'><form id='vGlTm'><ins id='vGlTm'></ins><ul id='vGlTm'></ul><sub id='vGlTm'></sub></form><legend id='vGlTm'></legend><bdo id='vGlTm'><pre id='vGlTm'><center id='vGlTm'></center></pre></bdo></b><th id='vGlTm'></th></span></q></dt></tr></i><div id='vGlTm'><tfoot id='vGlTm'></tfoot><dl id='vGlTm'><fieldset id='vGlTm'></fieldset></dl></div>

                  本文介绍了如何在 SQL Server Express 版中创建作业的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  谁能向我解释如何在 SQL Server Express 版本中创建作业?

                  Could anyone please explain to me how to create jobs in SQL Server Express edition?

                  推荐答案

                  SQL Server Express 没有包括 SQL Server 代理,因此不可能只创建 SQL 代理作业.

                  SQL Server Express doesn't include SQL Server Agent, so it's not possible to just create SQL Agent jobs.

                  你可以做的是:
                  您可以手动"创建工作通过创建批处理文件和 SQL 脚本文件,并通过 Windows 任务计划程序运行它们.
                  例如,您可以使用以下两个文件备份您的数据库:

                  What you can do is:
                  You can create jobs "manually" by creating batch files and SQL script files, and running them via Windows Task Scheduler.
                  For example, you can backup your database with two files like this:

                  backup.bat:

                  sqlcmd -i backup.sql
                  

                  backup.sql:

                  backup database TeamCity to disk = 'c:ackupsMyBackup.bak'
                  

                  只需将两个文件放在同一个文件夹中,然后通过 Windows 任务计划程序执行批处理文件即可.

                  Just put both files into the same folder and exeute the batch file via Windows Task Scheduler.

                  第一个文件只是一个 Windows 批处理文件,它调用了 sqlcmd 实用程序 并传递一个 SQL 脚本文件.
                  SQL 脚本文件包含 T-SQL.在我的示例中,备份数据库只是一行,但您可以将任何 T-SQL 放入其中.例如,您可以改为执行一些 UPDATE 查询.

                  The first file is just a Windows batch file which calls the sqlcmd utility and passes a SQL script file.
                  The SQL script file contains T-SQL. In my example, it's just one line to backup a database, but you can put any T-SQL inside. For example, you could do some UPDATE queries instead.

                  如果您要创建的作业用于备份、索引维护或完整性检查,您还可以使用出色的维护解决方案 作者:Ola Hallengren.

                  If the jobs you want to create are for backups, index maintenance or integrity checks, you could also use the excellent Maintenance Solution by Ola Hallengren.

                  它由一堆存储过程(以及 SQL Server 非 Express 版本的 SQL 代理作业)组成,并位于 FAQ 有一个关于如何在 SQL Server Express 上运行作业的部分:

                  It consists of a bunch of stored procedures (and SQL Agent jobs for non-Express editions of SQL Server), and in the FAQ there’s a section about how to run the jobs on SQL Server Express:

                  SQL Server Express 没有 SQL Server 代理.因此,必须使用 cmd 文件和 Windows 计划任务来计划存储过程的执行.请按照以下步骤操作.

                  How do I get started with the SQL Server Maintenance Solution on SQL Server Express?

                  SQL Server Express has no SQL Server Agent. Therefore, the execution of the stored procedures must be scheduled by using cmd files and Windows Scheduled Tasks. Follow these steps.

                  SQL Server Express 没有 SQL Server 代理.因此,执行必须使用 cmd 文件和Windows 计划任务.请按照以下步骤操作.

                  SQL Server Express has no SQL Server Agent. Therefore, the execution of the stored procedures must be scheduled by using cmd files and Windows Scheduled Tasks. Follow these steps.

                  1. 下载 MaintenanceSolution.sql.

                  1. Download MaintenanceSolution.sql.

                  执行 MaintenanceSolution.sql.此脚本创建您需要的存储过程.

                  Execute MaintenanceSolution.sql. This script creates the stored procedures that you need.

                  创建cmd文件来执行存储过程;例如:
                  sqlcmd -E -S .SQLEXPRESS -d master -Q "EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory =N'C:Backup', @BackupType = 'FULL'";-b -o C:LogDatabaseBackup.txt

                  Create cmd files to execute the stored procedures; for example:
                  sqlcmd -E -S .SQLEXPRESS -d master -Q "EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = N'C:Backup', @BackupType = 'FULL'" -b -o C:LogDatabaseBackup.txt

                  在 Windows 计划任务中,创建任务以调用 cmd 文件.

                  In Windows Scheduled Tasks, create tasks to call the cmd files.

                  安排任务.

                  启动任务并验证它们是否成功完成.

                  Start the tasks and verify that they are completing successfully.

                  这篇关于如何在 SQL Server Express 版中创建作业的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  上一篇:使用浮点数还是小数点来计算会计应用程序的美元金额? 下一篇:SQL Server 中是否有一个 Max 函数,它采用两个值,如 .NET 中的 Math.Max?

                  相关文章

                  <tfoot id='x1xZ1'></tfoot>

                  1. <small id='x1xZ1'></small><noframes id='x1xZ1'>

                      • <bdo id='x1xZ1'></bdo><ul id='x1xZ1'></ul>
                    1. <legend id='x1xZ1'><style id='x1xZ1'><dir id='x1xZ1'><q id='x1xZ1'></q></dir></style></legend>
                      <i id='x1xZ1'><tr id='x1xZ1'><dt id='x1xZ1'><q id='x1xZ1'><span id='x1xZ1'><b id='x1xZ1'><form id='x1xZ1'><ins id='x1xZ1'></ins><ul id='x1xZ1'></ul><sub id='x1xZ1'></sub></form><legend id='x1xZ1'></legend><bdo id='x1xZ1'><pre id='x1xZ1'><center id='x1xZ1'></center></pre></bdo></b><th id='x1xZ1'></th></span></q></dt></tr></i><div id='x1xZ1'><tfoot id='x1xZ1'></tfoot><dl id='x1xZ1'><fieldset id='x1xZ1'></fieldset></dl></div>