[AGENT - SQL NOTIFICATON] je n'y arrive pas ?
Bonjour,
J’ai un soucis de configuration pour faire des notifications avec SQLSERVER. Je pense avoir tout bien configurer….
Voici mes scripte Lorsque je fait simple envoi de mail par script.
Code:
1 2 3 4 5 6 7
|
execute msdb.dbo.sp_send_dbmail
@recipients = <a href="mailto:XXX@XXX.XX">XXX@XXX.XX</a> ',
@subject = 'SQLXXX - Hello Alain ',
@body = 'HIHIH ca qsdf Ca MARche ',
@profile_name = 'SQLXXX Mail Profile'
GO |
Ou part sql server -> Management ->SQlMail -> test
Cela marche très bien.
Mais lorsque je configure un job dans l’agent, et je configure l’onglet notification cela ne marche pas.
Il y’a peut être une chose que j’ai oublié pour la configuration.
car voici le message dans les logs
Citation:
An attempt was made to send an email when no email session has been established
Mais mes scriptes de création.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
execute msdb.dbo.sysmail_add_account_sp
@account_name = 'SQLXXX Mail',
@description = 'Mail Account for SQLXXX',
@email_address = 'SQLXXX@eu.watsonwyatt.com',
@display_name = 'SQLBXX Mail Account',
@mailserver_name = 'smtpmail.XXX@XXX.XX '
execute msdb.dbo.sysmail_add_profile_sp
@profile_name = 'SQLXXX Mail Profile',
@description = 'Profile used for database mail'
execute msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'SQLXXX Mail Profile',
@account_name = 'SQLXXX Mail',
@sequence_number = 1
execute msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'SQLXXX Mail Profile',
@principal_name = 'public',
@is_default = 1
ALTER DATABASE
execute msdb.dbo.sp_send_dbmail
@recipients = 'DList.GENERAL.Wintel.Server.Alerts@watsonwyatt.com',
@subject = 'SQLXXX - Database Mail Successfully Configured',
@profile_name = 'SQLXXX Mail Profile'
GO
execute msdb.dbo.sp_send_dbmail
@recipients = <a href="mailto:XXX@XXX.XX">XXX@XXX.XX</a> ',
@subject = 'SQLXXX - Hello Alain ',
@body = 'HIHIH ca qsdf Ca MARche ',
@profile_name = 'SQLXXX Mail Profile'
GO
EXEC msdb.dbo.sp_add_operator @name= <a href="mailto:XXX@XXX.XX">XXX@XXX.XX</a>',
@enabled=1,
@weekday_pager_start_time=80000,
@weekday_pager_end_time=180000,
@saturday_pager_start_time=80000,
@saturday_pager_end_time=180000,
@sunday_pager_start_time=80000,
@sunday_pager_end_time=180000,
@pager_days=62,
@email_address= <a href="mailto:XXX@XXX.XX">XXX@XXX.XX</a>',
@category_name=N'[Uncategorized]'
GO |