DB Mails Queue leeren
1. Schauen, wie es dem Mailsystem geht
EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'Mail';
2. Mailservice stoppen:
EXEC msdb.dbo.sysmail_stop_sp
3. Betroffene Mailqueues leeren (Internal & External ; snipplet hier für External
ALTER QUEUE ExternalMailQueue WITH STATUS = ON
set nocount on
declare @Conversation_handle uniqueidentifier;
declare @message_type nvarchar(256);
declare @counter bigint;
declare @counter2 bigint;
set @counter = (select count(*) from ExternalMailQueue) -- count millions of queued messages
set @counter2=0
-- now do until nothing is left in the queue
while (@counter2 <=@counter)
begin
receive @Conversation_handle = conversation_handle, @message_type = message_type_name from ExternalMailQueue -- pop messages from the queue
set @counter2 = @counter2 + 1
end
4. Fehler suchen und beheben
5. Mailque wieder starten und checken:
EXEC msdb.dbo.sysmail_start_sp
EXEC msdb.dbo.sysmail_help_queue_sp @queue_type = 'Mail';