Со следующей ошибкой глобальный профиль не настроен

1

2 3 4 5Проверяем отсылку тестового письма

Если письмо не дошло — смотрим логи. проверяем брокера

SELECT is_broker_enabled FROM sys.databases WHERE name = 'msdb'
Если возвращаемое значение отличается от единицы, Service Broker выключен. Включаем брокера
ALTER DATABASE msdb SET ENABLE_BROKER

SQL Server может прислать уведомление о том, что задание выполнилось успешно / завершилось с ошибкой. Настраиваем агента

6 7 8

Если в логах регламентного задания видим ошибку

«EXECUTE msdb.dbo.sp_notify_operator @name=N’.» со следующей ошибкой: «Глобальный профиль не настроен. Укажите имя профиля при помощи параметра @profile_name.  Глобальный профиль не настроен. Укажите имя профиля при помощи параметра @profile_name.». Возможные причины сбоя: проблемы с этим запросом, свойство «ResultSet» установлено неправильно, параметры установлены неправильно или соединение было установлено неправильно.  Конец ошибки  DTExec: завершено исполнение пакетаDTSER_FAILURE

Проверяем назначили ли мы дефолтные профили

5

С консоли весь процесс выглядит примерно так

IF (SELECT is_broker_enabled FROM sys.databases WHERE [name] = 'msdb') = 0
    ALTER DATABASE msdb SET ENABLE_BROKER WITH ROLLBACK AFTER 10 SECONDS
GO
sp_configure 'Database Mail XPs', 1
GO
RECONFIGURE
GO

проверить, запущена ли служба DBMail:
EXECUTE msdb.dbo.sysmail_help_status_sp

запустить ее запросом
EXECUTE msdb.dbo.sysmail_start_sp


-- Создадим SMTP-аккаунт для отсылки писем
EXECUTE msdb.dbo.sysmail_add_account_sp
    -- Название аккаунта
        @account_name = 'admin@iamroot.ru',
    -- Краткое описание аккаунта
        @description = N'Почтовый аккаунт admin@iamroot.ru',
    -- Почтовый адрес
        @email_address = 'admin@iamroot.ru',
    -- Имя, отображаемое в письме в поле "От:"
        @display_name = N'DATABASE_ADMIN',
    -- Адрес, на который получателю письма нужно отправлять ответ
        @replyto_address = 'admin@iamroot.ru',
    -- Домен или IP-адрес SMTP-сервера
        @mailserver_name = 'mail.iamroot.ru',
    -- Порт SMTP-сервера, обычно 25
        @port = 25,
    -- Имя пользователя. Некоторые почтовые системы требуют указания всего
    -- адреса почтового ящика вместо одного имени пользователя
        @username = 'admin@iamroot.ru',
    -- Пароль к почтовому ящику
        @password = 'passw0rd',
    -- Защита SSL при подключении, большинство SMTP-серверов сейчас требуют SSL
        @enable_ssl = 1;


-- Создадим профиль администратора почтовых рассылок
EXECUTE msdb.dbo.sysmail_add_profile_sp
        @profile_name = 'DBAADMIN';
-- Подключим SMTP-аккаунт к созданному профилю
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
        @profile_name = 'DBAADMIN',
        @account_name = 'admin@iamroot.ru',
    -- Указатель номера SMTP-аккаунта в профиле
        @sequence_number = 1;

-- Установим права доступа к профилю для роли DatabaseMailUserRole базы MSDB
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
        @profile_name = 'DBAADMIN',
        @principal_id = 0,
        @is_default = 1;



 отправим тестовое письмо:
EXEC msdb.dbo.sp_send_dbmail
    -- Созданный нами профиль администратора почтовых рассылок
        @profile_name = 'DBAADMIN',
    -- Адрес получателя
        @recipients = 'mmch@iamroot.ru',
    -- Текст письма
        @body = N'Испытание системы SQL Server Database Mail',
    -- Тема
        @subject = N'Тестовое сообщение',
    -- Для примера добавим к письму результаты произвольного SQL-запроса
        @query = 'SELECT TOP 10 name FROM sys.objects';


At some time in the past, I set up a maintenance plan in one SQL Server instance for rapidly tuning up a set of databases with some simple tasks such as index rebuild, etc., and I got the error message: “No global profile is configured. Specify a profile name in the @profile_name parameter”.

About the “No global profile is configured” Error Message in SQL Server

Whenever you set up a maintenance plan is always a good idea to add in the end the “Notify Operator” Task in order to get notified on the outcome of the maintenance plan’s execution.

Here’s a screenshot of my simple maintenance task:

No global profile is configured. Specify a profile name in the @profile_name parameter - Article on SQLNetHub

Even though the first three tasks were executed successfully, when I checked the history of the job that undertakes the execution of the maintenance plan, there was an error message on the last task that is the “Notify Operator” Task.

A part of the error message is the following:

“No global profile is configured. Specify a profile name in the @profile_name parameter.”

How to Resolve the Issue

So, what does the above error message tell us? It actually says that upon the task’s execution, it cannot find a Database Mail profile in order to use it for sending the email notification.

To overcome this problem, you can set one of the available Database Mail profiles as the default one.

In SQL Server SSMS, you can do this in the following way:

  1. In Management — Database Mail, double-click or right-click and choose “Configure Database Mail”. Then click on Next.
  2. Then click on Manage profile security.
  3. Click on Next.
  4. Then you will see a list with all the available database mail profiles. You have the option to select one of these profiles to be the Default Profile (be selecting ‘Yes’ in the combo box).
  5. Click on Next.
  6. Click on Finish.

That should do it!

At least in my scenario I tried it and worked perfectly! 🙂

Of course, the above assumes that you have at least one Database Mail profile up and working! 🙂


Strengthen your SQL Server Administration Skills – Enroll to our Online Course!

Check our online course on Udemy titled “Essential SQL Server Administration Tips
(special limited-time discount included in link).

Via the course, you will learn essential hands-on SQL Server Administration tips on SQL Server maintenance, security, performance, integration, error handling and more. Many live demonstrations and downloadable resources included!

Essential SQL Server Administration Tips - Online Course with Live Demonstrations and Hands-on Guides

Lifetime Access / Live Demos / Downloadable Resources and more!

Enroll from $12.99


Featured Online Courses:

  • Introduction to Azure SQL Database for Beginners
  • SQL Server 2019: What’s New – New and Enhanced Features
  • SQL Server Fundamentals – SQL Database for Beginners
  • Essential SQL Server Administration Tips
  • Boost SQL Server Database Performance with In-Memory OLTP 
  • Essential SQL Server Development Tips for SQL Developers
  • Working with Python on Windows and SQL Server Databases
  • Introduction to Computer Programming for Beginners
  • .NET Programming for Beginners – Windows Forms with C#
  • Introduction to SQL Server Machine Learning Services
  • Entity Framework: Getting Started – Complete Beginners Guide
  • How to Import and Export Data in SQL Server Databases
  • Learn How to Install and Start Using SQL Server in 30 Mins
  • A Guide on How to Start and Monetize a Successful Blog

Artemakis Artemiou

Artemakis Artemiou is a Senior SQL Server Architect, Author, a 9 Times Microsoft Data Platform MVP (2009-2018). He has over 20 years of experience in the IT industry in various roles. Artemakis is the founder of SQLNetHub and {essentialDevTips.com}. Artemakis is the creator of the well-known software tools Snippets Generator and DBA Security Advisor. Also, he is the author of many eBooks on SQL Server. Artemakis currently serves as the President of the Cyprus .NET User Group (CDNUG) and the International .NET Association Country Leader for Cyprus (INETA). Moreover, Artemakis teaches on Udemy, you can check his courses here.

Views: 8,072

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit «Cookie Settings» to provide a controlled consent. Read More

  • Remove From My Forums
  • Question

  • User-1499457942 posted

    Hi

      I have below code . I am using Sql Database Mail . When i send Test mail it is working . Secondly i want if stored procedure is executed successfully it should reurn value and message displayed . Successfully executed

    protected void Mailing(int Id)
    {
    con.Open();
    using (cmd = new SqlCommand(«sp_Test», con))
    {
    cmd.CommandType = CommandType.StoredProcedure;
    cmd.Parameters.AddWithValue(«@No», Id);
    cmd.ExecuteNonQuery();
    }
    }

    Below is the line in Stored procedure

    EXEC msdb.dbo.sp_send_dbmail @recipients=@EMail,

One of the reasons I’m not a huge fan of Maintenance Plans is that they do everything in a very set way.  My biggest gripe around this remains around lack of smarts in optimisation of indexes but I recently came across another annoyance and that is that the “Notify an operator” task relies on a public or global operator.  While you can quite happily send an email with TSQL by specifying a private mail account, if there is no public account this task will fail and you will get a message like below:

Msg 14636, Level 16, State 1, Procedure sp_send_dbmail, Line 94

No global profile is configured. Specify a profile name in the @profile_name parameter

The error gives you most of what you need to know to figure this one out, although not clearly enough for my liking.  It tells us the problem is in the procedure that sends dbmail, so we know it’s a database mail issue.  And it tells us that there is no global profile defined so we should specify a value for @profile_name.  Well….yes I would do that….if I was using TSQL.  But I’m not, I’m using a maintenance plan.  So I have two options.

  1. Instead of a notify operator task, I can use a TSQL task and write a piece of custom tsql to send myself a message, in which case I can specify my private profile.  Or…
  2. Define a new default profile or change an existing private profile to be the default.

Now, in my mind a tsql task is a fine option because you can do a few additional things which can’t be done with a notify operator task(like attach a file such as the error log for example) , but it can be a pain cutting and pasting the TSQL across all your various notifications.  So if you want to resolve the error all you need to do is:

1.  Open database mail configuration by logging into SQL Server Management studio and expanding Management and right clicking on DatabaseMail, then choosing configure:

Public Mail Profile 1

2.  Choose Manage Profile Security.

Public Mail Profile 2

3.  Configure your profile to be the default profile:

Public Mail Profile 3

There’s no need to restart anything, your maintenance plan should now send email fine.

Localized version

Click to search this error in Google

English version

No global profile is configured. Specify a profile name in the @profile_name parameter.

Click to search this error in Google

Localized version
 Russian

Error category
 SQL Server

Other localized versions
11 versions

Понравилась статья? Поделить с друзьями:
  • Соболь ошибка 1607
  • Снова они сошлись снова ударились найти ошибку
  • Снять ошибку на принтере brother 1512r
  • Снять санкции ошибка
  • Соболь ошибка p0831