“指定的‘@notify_email_operator_name’无效”错误

发布于 2024-12-13 10:48:36 字数 229 浏览 0 评论 0原文

我有一个脚本化的 SQL Server 代理作业,我试图从服务器传输到本地数据库,但收到此错误消息:

Msg 14234,Level 16,State 1,Procedure sp_verify_job,Line 243 指定的“@notify_email_operator_name”无效(有效值由 sp_help_operator 返回)。

双击错误消息甚至不会将我带到失败的行。以前有其他人得到过这个吗?

I have a scripted SQL Server Agent job I'm trying to transfer over to my local database from a server, but I receive this error message:

Msg 14234, Level 16, State 1, Procedure sp_verify_job, Line 243
The specified '@notify_email_operator_name' is invalid (valid values are returned by sp_help_operator).

Double clicking the error message won't even take me to the line that it fails on. Has anybody else gotten this before?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

睫毛上残留的泪 2024-12-20 10:48:36

使用 Ctrl+F 查找 @notify_email_operator_name 出现的位置。
它可能设置为您尚未在本地计算机上设置的电子邮件配置文件。

对于 SQL Server 2005 及更高版本,您可以使用 SMTP 服务器设置数据库邮件。

就您而言,您可能只是在计算机上进行一些测试,并且您可能不关心电子邮件通知,因此您可以安全地设置 @notify_email_operator_name = NULL,然后重新运行脚本。

Use Ctrl+F to find where @notify_email_operator_name appears.
It probably is set to an email profile that you haven't set up on your local machine.

For SQL Server 2005 and above, then you can set up database mail using an SMTP server.

In your case, you might just be doing some testing on your machine, and you might not care about the email notifications so you can safely set @notify_email_operator_name = NULL and then re-run the script.

他是夢罘是命 2024-12-20 10:48:36

在 SSMS 左侧的 SQL Server 代理树下,您将找到一个名为操作员的节点。创建一个与您缺少的名称相同的脚本,或者从生成作业创建脚本的同一位置生成一个创建脚本。

Under your SQL Server Agent Tree on the left hand side of SSMS you'll find a node called operators. Create one with the same name as what your missing, or generate a create script from the same place as you generated your job create script.

梦境 2024-12-20 10:48:36

您的服务器可能有一个操作员设置用于发送您没有的电子邮件通知。如果您确实需要电子邮件通知,或者您只想匹配服务器环境以进行测试,请在填写空白后运行以下命令:

USE [msdb]
GO

EXEC msdb.dbo.sp_add_operator @name=N'youroperatorname',
        @enabled=1,
        @email_address=N'[email protected]',
        @category_name=N'[Uncategorized]'
GO

Your server probably has an operator set up for email notifications that you don't have. If you do want e-mail notifications, or if you just want to match your server's environment for testing purposes, run the following after filling in the blanks:

USE [msdb]
GO

EXEC msdb.dbo.sp_add_operator @name=N'youroperatorname',
        @enabled=1,
        @email_address=N'[email protected]',
        @category_name=N'[Uncategorized]'
GO
把昨日还给我 2024-12-20 10:48:36

我在部署/升级本地测试数据库时遇到了这个问题,我花了整个下午的时间来弄清楚如何解决这个问题,即使我们有三个答案作为线索。

Davos 的答案应该是正确的,但就我而言,我通过 @notify_email_operator_name 找到的 sp_add_job 已分配了默认值,因此我不能将其更改为 null。

因此,谈到 Tod 的答案,我添加了一个名为 notify_email_operator_name 的操作员,但它不起作用,并且部署显示相同的错误。

然后我认为如果部署在生产服务器上工作,就必须有正确的操作员。所以我连接到生产服务器,发现操作员的正确名称实际上是分配的默认值。

解决方案简述

  1. 转到部署按预期工作的 MS SQL。
  2. 在 SQL Server 代理 >运算符>找到您需要的运营商。
  3. 右键单击>脚本运算符为 >创建到>剪贴板。
  4. 在出现问题的服务器上运行剪贴板中的脚本。

I ran into this while deploy/upgrade my local testing DB and it took me the whole afternoon to figure how to work it out even we have three answers as clues.

Davos's answer should be correct but in my case, the sp_add_job I found with @notify_email_operator_name had a default value assigned already so I can't just change it to null.

So it comes to Tod's answer, I add an operator named notify_email_operator_name but it doesn't work and deployment shows the same error.

Then I think if the deployment works on the production server, there has to have the correct operator. So I connect to the production server and found out the correct name of the operator is actually the assigned default value.

Solution in short

  1. Go to the MS SQL that deployment works as expected.
  2. Under SQL Server Agent > Operators > Find the operator you need.
  3. Right-click > Script Operator as > Create To > ClipBoard.
  4. Run the script in clipboard on the server that has the issue.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文