データベース メールを使用するように SQL Server エージェント メールを構成するConfigure SQL Server Agent Mail to Use Database Mail
適用対象:Applies to: SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
SQL ServerSQL Server (サポートされているすべてのバージョン)
SQL ServerSQL Server (all supported versions)
このトピックでは、 SQL ServerSQL Server を使用して、 SQL ServerSQL Server の通知と警告をデータベース メールを使用して送信するように SQL Server Management StudioSQL Server Management Studioエージェントを構成する方法について説明します。This topic describes how to configure SQL ServerSQL Server Agent to use Database Mail to send notification and alerts in SQL ServerSQL Server by using SQL Server Management StudioSQL Server Management Studio. データベース メール機能を有効にして構成する方法の詳細については、「 データベース メールの構成」を参照してください。For information on how to enable and configure Database Mail, see Configure Database Mail. Transact-SQLTransact-SQLの使用例については、「 データベース メール プロファイルの作成」をご覧ください。For an example using Transact-SQLTransact-SQL, see Create a Database Mail Profile.
作業を開始する準備:Before you begin:
はじめにBefore You Begin
注意
Managed Instance 上の SQL エージェントは常に、データベース メールを使用するように構成されます。そのため、このコンテンツはマネージド インスタンスには該当しません。SQL Agent on Managed Instance is always configured to use Database Mail, so this content is not applicable on Managed Instance. Managed Instance では、SQL エージェントとデータベース メールをバインドする目的でプロファイルを用意する必要があります。このプロファイルの名前は AzureManagedInstance_dbmail_profile という名前にする必要があります。In Managed Instance you need to have a profile that must be called AzureManagedInstance_dbmail_profile in order to bind SQL Agent with Database Mail.
前提条件Prerequisites
使用するエージェント サービス アカウントの データベース メール アカウントを作成 SQL ServerSQL Server します。Create a Database Mail account for the SQL ServerSQL Server Agent service account to use.
エージェント サービス アカウントで使用する データベース メール プロファイルを作成 SQL ServerSQL Server し、ユーザーを msdb データベースの DatabaseMailUserRole に追加します。Create a Database Mail profile for the SQL ServerSQL Server Agent service account to use and add the user to the DatabaseMailUserRole in the msdb database.
作成したプロファイルを msdb データベースの既定のプロファイルに設定します。Set the profile as the default profile for the msdb database.
セキュリティSecurity
PermissionsPermissions
プロファイル アカウントを作成し、ストアド プロシージャを実行するユーザーは、sysadmin 固定サーバー ロールのメンバーである必要があります。The user creating the profiles accounts and executing stored procedures should be a member of the sysadmin fixed server role.
SQL Server Management Studio の使用Using SQL Server Management Studio
データベース メールを使用するように SQL Server エージェントを構成するにはTo configure SQL Server Agent to use Database Mail
オブジェクト エクスプローラーで、 SQL ServerSQL Server インスタンスを展開します。In Object Explorer, expand a SQL ServerSQL Server instance.
[SQL Server エージェント] を右クリックし、 [プロパティ] をクリックします。Right-click SQL Server Agent, and then click Properties.
[警告システム] をクリックします。Click Alert System.
[メール プロファイルを有効にする] チェック ボックスをオンにします。Select Enable Mail Profile.
[メール システム] ボックスの一覧で、 [データベース メール] を選択します。In the Mail system list, select Database Mail.
[メール プロファイル] ボックスの一覧で、データベース メールのメール プロファイルを選択します。In the Mail profile list, select a mail profile for Database Mail.
SQL Server エージェントを再起動します。Restart SQL Server Agent .
フォロー アップ タスクFollow-up Tasks
警告および通知を送信できるようにエージェントを構成するには、次のタスクが必要となります。The following tasks are necessary to complete the configuration of Agent to send alerts and notifications.
-
特定のデータベース イベントまたはオペレーティング システムの状態がオペレーターに通知されるように、警告を構成できます。Alerts can be configured to notify an operator of a particular database event or operating system condition.
-
オペレーターとは、電子通知を受け取ることのできる人またはグループの別名です。Operators are aliases for people or groups that can receive electronic notification