SQL Server 如何解决无法找到的存储过程错误

rdrgkggo  于 2022-12-17  发布在  其他
关注(0)|答案(1)|浏览(776)

我有一个数据库,我想配置数据库邮件,要激活一个触发器。我找到并遵循了一些在线教程,并得到了这个。

sp_configure 'show advanced options', 1;
GO 
RECONFIGURE;
GO
sp_configure'Database Mail XPs',1;
GO
RECONFIGURE
GO

EXECUTE msdb.dbo.sysmail_add_profile_sp
    @profile_name='Notifications',
    @description='Profile for sending outgoing notifications using Gmail.';
GO

EXECUTE msdb.dbo.sysmail_add_principalprofile_sp  
    @profile_name = 'Notifications',  
    @principal_name = 'public',  
    @is_default = 1 ;
GO

EXECUTE msdb.dbo.sysmail_add_account_sp  
    @account_name = 'Gmail',  
    @description = 'Mail account for sending outgoing notifications.',  
    @email_address = 'my_email',  
    @display_name = 'Automated Mailer',  
    @mailserver_name = 'smtp.gmail.com',
    @port = 465,
    @enable_ssl = 1,
    @username = 'my_email',
    @password = 'My_password' ;  
GO

EXECUTE msdb.dbo.sysmail_add_profileaccount_sp  
    @profile_name = 'Notifications',  
    @account_name = 'Gmail',  
    @sequence_number =1 ;  
GO

EXEC msdb.dbo.sp_send_dbmail
     @profile_name = 'Notifications',
     @recipients = 'my_email',
     @body = 'The database mail configuration was completed successfully.',
     @subject = 'Automated Success Message ';
GO

它工作正常,直到我试图发送一封测试电子邮件,它只会给予我这个:

Mail (Id: 9) queued.

然后,我访问了SQLserver文档以解决问题,并运行以下命令:

EXEC sp_configure 'show advanced', 1;  
RECONFIGURE; 
EXEC sp_configure; 
GO
sysmail_help_queue_sp @queue_type = 'Mail' ;

但我得到了这个奇怪的错误:
消息2812,级别16,状态62,第74行
找不到存储过程'sysmail_help_queue_sp'
如何纠正此问题?

ruarlubt

ruarlubt1#

需要按如下方式指定数据库和所有者:

msdb.dbo.sysmail_help_queue_sp @queue_type = 'Mail';

相关问题