如何解决不可执行的存储过程错误



我有一个数据库,我想为其配置数据库邮件,以便由触发器激活。我发现并遵循了一些在线教程,得到了这个。

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' ;

但我得到了一个奇怪的错误:

Msg 2812,级别16,状态62,行74
找不到存储过程"sysmail_help.queue_sp">

如何更正此问题?

需要像这样指定数据库和所有者:

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

最新更新