資料庫郵件排除

2021-06-16 11:34:11 字數 952 閱讀 2424

資料庫遷移,郵件中出現問題。先增加賬戶後執行如下指令碼,關聯孤立賬戶:

sp_change_users_login @action='update_one', @usernamepattern='uat_user', 

@loginname='uat_user';

資料庫庫還原到新的伺服器後,傳送郵件報錯。檢視傳送錯誤日誌後確定無法連線郵件伺服器。修改防毒軟體後恢復訪問。

但是新建的使用者無法傳送:the execute permission was denied on the object 'sp_send_dbmail', database 'msdb', schema 'dbo'.

因為賬號是還原後建立的和原來的id不一致,在msdb執行: 

後許可權正常。但是產生新的錯誤:the execute permission was denied on the object 'xp_sysmail_attachment_load', database 'mssqlsystemresource', schema 'sys'.

在master上執行:

grant execute on xp_sysmail_attachment_load to trial_user

go

報錯。找不到trial_user使用者。

執行:

use master

gocreate user [trial_user] for login [trial_user]

go

後再執行:

use master

gogrant execute on xp_sysmail_attachment_load to trial_user

go

資料庫郵件

直接發文字 exec msdb.dbo.sp send dbmail profile name zulin recipients 8711 gs4.comp body test subject 資料庫郵件測試 帶查詢結果 exec msdb.dbo.sp send dbmail profile na...

配置資料庫郵件

配置資料庫郵件,傳送郵件先要啟用資料庫郵件.可以從外圍應用配置器中啟用 見圖一 在sql server management studio中右擊資料庫郵件 配置資料庫郵件 見圖二 在 圖三 選擇通過執行以下任務來安裝資料庫郵件,在 圖四 指定乙個smtp賬號其中包括,賬號名 administrato...

配置資料庫郵件

配置資料庫郵件指令碼 1.開啟資料庫郵件 exec sp configure show advanced options 1 goreconfigure goexec sp configure database mail xps 1 goreconfigure go 2.建立郵件帳戶資訊 exec ...