Sqlserveragent не запущен ошибка 22022

June 8 2012, 15:04

Category:

  • IT
  • Cancel

Настраиваем бэкап баз SQL.

Открываем SQL Studio, добавляем план обслуживания, выбираем резервное копирование, прописываем папку для бэкапов, настраиваем расписание.

Вот хорошая инструкция: http://howknow1c.ru/nastroika-1c/backup-sql.html

Сохраняем план обслуживания, встаем на него и говорим «Выполнить».

Ошибка. Ругается на незапущенный агент SQL.

«Ошибка 22022: SQLServerAgent не запущен, не может получать уведомления об этой операции.»

Стартуем Агент SQL Server вручную. Не стартует.

Решение: меняем учетную запись, от которой запускается служба Агент SQL Server с sa на системную учетную запись.

Тип запуска: ставим автоматический.

Запускаем. Все работает.

Вроде бы все тривиально, но мало ли, вдруг кому пригодится…

This is for very first time that I am trying to use SQL server Agent.
I get this error :

Msg 22022, Level 16, State 1, Line 0
SQLServerAgent is not currently running so it cannot be notified of this action.

I went to services to check if it was running. I tried to start it and got this immediately . The services then stopped ofcourse.:
error

Then I tried with SQL server configuration manager:

On trying to start the service there,
enter image description here

When I try to change the log on account via SQL server configuration manager:

enter image description here

How do I get this service started ?

  • Remove From My Forums
  • Вопрос

  • Добрый день.

    Проблема в следующем. Я создал план обслуживания для бекапа всех баз
    sql
    на  определенное время и
     
    ежедневно. После создания задачи проверка показала успех по всем тестируемым позициям.
     Но при ее выполнении в ручную выдает ошибку:

    Выполнить план обслуживания. BackUp (Ошибка)

    Сообщения

    ·
    Ошибка выполнения. Дополнительные сведения см. в плане обслуживания и журналах заданий агента SQL Server.

    ——————————
    ДОПОЛНИТЕЛЬНЫЕ СВЕДЕНИЯ:

    При выполнении инструкции или пакета Transact-SQL возникло исключение. (Microsoft.SqlServer.ConnectionInfo)

    ——————————

    SQLServerAgent не запущен, поэтому нельзя отправить для него уведомление. (Microsoft SQL Server, ошибка: 22022)

    Чтобы получить справку, щелкните: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.1600&EvtSrc=MSSQLServer&EvtID=22022&LinkId=20476
     

    По указанной ссылке никакой информации нет.

    Подскажите в чем может быть проблема.

Ответы

  • 1. Нужно проверить, запущен ли SQL Server Agent.
    2. Нужно чтобы учётка, от имени которой стартует агент, имела роль sysadmin.
    3. Соответственно, когда вы запускаете задание вручную, то делать это нужно тоже из под админской учетки.

    Вот еще инфа по агенту

    • Предложено в качестве ответа

      8 апреля 2011 г. 12:07

    • Помечено в качестве ответа
      Dmitry Davydov
      11 апреля 2011 г. 16:52

RRS feed

  • Remove From My Forums
  • Question

  • When trying to run a maintenance job I receive the error «SQLServerAgent is not currently running so it cannot be notified of this action. (Microsoft SQL Server, Error: 22022)». The agent starts and then stops. What would cause this?

Answers

    • Edited by
      Tom Phillips
      Monday, December 9, 2013 7:22 PM
    • Proposed as answer by
      Shanky_621MVP
      Tuesday, December 10, 2013 5:26 AM
    • Marked as answer by
      Sofiya Li
      Saturday, December 21, 2013 2:14 PM

All replies

  • Please see the SQLAGENT.OUT in the LOG directory for the reason Agent is not running. 

  • I rebooted like it says below but was trying to run the job before and after. I tried manually starting the agent a few times too.

    2013-11-26 19:59:18 - ? [100] Microsoft SQLServerAgent version 11.0.3128.0 (X64 unicode retail build) : Process ID 4676
    2013-11-26 19:59:18 - ? [495] The SQL Server Agent startup service account is NT ServiceSQLSERVERAGENT.
    2013-11-26 19:59:18 - ? [393] Waiting for SQL Server to recover database 'msdb'...
    2013-11-26 19:59:18 - ? [000] 
    2013-11-26 19:59:18 - ? [101] SQL Server SERVER version 11.00.3128 (0 connection limit)
    2013-11-26 19:59:18 - ? [102] SQL Server ODBC driver version 11.00.3000
    2013-11-26 19:59:18 - ? [103] NetLib being used by driver is DBNETLIB; Local host server is 
    2013-11-26 19:59:18 - ? [310] 4 processor(s) and 6144 MB RAM detected
    2013-11-26 19:59:18 - ? [339] Local computer is SERVER running Windows NT 6.1 (7601) Service Pack 1
    2013-11-26 19:59:18 - ? [432] There are 12 subsystems in the subsystems cache
    2013-11-26 19:59:34 - ! [364] The Messenger service has not been started - NetSend notifications will not be sent
    2013-11-26 19:59:34 - ? [129] SQLSERVERAGENT starting under Windows NT service control
    2013-11-26 19:59:34 - + [475] Database Mail is not enabled for agent notifications.
    2013-11-26 19:59:34 - + [396] An idle CPU condition has not been defined - OnIdle job schedules will have no effect
    2013-11-26 20:00:32 - ? [130] SQLSERVERAGENT stopping because of Windows shutdown...
    2013-11-26 20:00:33 - ! [359] The local host server is not running
    2013-11-26 20:00:34 - ! [359] The local host server is not running
    2013-11-26 20:00:34 - ? [098] SQLServerAgent terminated (normally)

  • Also seeing this in ERRORLOG.

    2013-11-26 20:30:43.08 Logon       Login failed for user 'NT AUTHORITYSYSTEM'. Reason: Failed to open the explicitly specified database 'model'. [CLIENT: 10.x.x.x]
    2013-11-26 20:30:43.09 Logon       Error: 18456, Severity: 14, State: 38.

    • Edited by
      Tom Phillips
      Monday, December 9, 2013 7:22 PM
    • Proposed as answer by
      Shanky_621MVP
      Tuesday, December 10, 2013 5:26 AM
    • Marked as answer by
      Sofiya Li
      Saturday, December 21, 2013 2:14 PM
  • Thank you sir! I will check it out and get back with you.

Hello Friends,

Hope you are enjoying our blog.

Today i am going to share one more examples of real troubleshooting where customer comes with an issue but when we actually found the root cause it turns out to be completely different all together from what we expected. To know more, look at how we worked on this issue and most amazing thing was how we resolved this one.

According to the customer when he was starting SQL Server Agent service it started successfully with status “service started successfully” but when we are running any jobs it was throwing below error.

SQLServerAgent is not currently running so it cannot be notified of this action. (Microsoft SQL Server, Error: 22022)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=10.50.2500&EvtSrc=MSSQLServer&EvtID=22022&LinkId=20476

 ——————————

 BUTTONS:

 OK

 ——————————

Surprising part was if SQL Server Agent is running successfully then why this error message.
First thing for troubleshooting is to start with SQLAGENTLOG.OUT to see if any error message reported there. I opened SQLAGENTLOG.OUT file and it was completely blank!!! Phew!!

It was difficult to believe this, so I decided to start SQLAgent service from command prompt. I started it from Command prompt and here is the result.

C:Program FilesMicrosoft SQL ServerMSSQL.1MSSQLBinn>SQLAGENT90.EXE -I Instancename -c
Microsoft (R) SQLServerAgent 10.50.2500.0
Copyright (C) Microsoft Corporation.

Nothing is getting reported in the command prompt as well. This is interesting, no clue at all!! We got stuck here and most of the time we give up in such situations, but in this case we decided to try something else.
I had 2 ideas as a next action plan.

1- Take a Procmon while running the service.
2- Take a Dump of SQLAGENT90.EXE.

We tried first action plan of collecting Procmon while running the service. It did not help much then we moved to next step and took dump of SQLAGENT90.EXE.

Since this is not an error message we can not directly take a crash dump so challenge here is, how should we take dump on the service? Luckily this was Windows Server 2008. Windows Server 2008 we have a facility where we can directly take dumps from the task manager for a process.
Here is the screen shot on how to take dump. Check the below screen shot.

Once dump is generated it will give you the location where it got generated.

Go to the dump location and get the DMP file.

Here we go with our typical Dump analysis
First step is to set the symbol path to Microsoft symbols server. On the Windbg command window type below command.
.sympath srv*c: publicsymbols*http://msdl.microsoft.com/download/symbols;

Now let’s load the symbols from Microsoft symbols server:

Again type .reload /f and hit enter.

Let’s confirm whether we have symbols loaded or not, remember this time we took dump on SQLAGENT.EXE.

0:002> lmvm SQLAGENT
 start end module name
 00000000`00b40000 00000000`00bbd000 SQLAGENT (pdb symbols) c:publicsymbolsSQLAGENT.pdbD6244891FD4647DBBA866D05ED4825891SQLAGENT.pdb
 Loaded symbol image file: SQLAGENT.EXE
 Image path: C:Program FilesMicrosoft SQL ServerMSSQL10_50.MSSQLSERVERMSSQLBinnSQLAGENT.EXE
 Image name: SQLAGENT.EXE
 Timestamp: Fri Jun 17 01:28:00 2011 (4DFB1010)
 CheckSum: 0007337E
 ImageSize: 0007D000
 File version: 2009.100.2500.0
 Product version: 10.50.2500.0
 File flags: 8 (Mask 3F) Private
 File OS: 40000 NT Base
 File type: 1.0 App
 File date: 00000000.00000000
 Translations: 0409.04b0
 CompanyName: Microsoft Corporation
 ProductName: Microsoft SQL Server
 InternalName: SQLAGENT
 OriginalFilename: SQLAGENT.DLL
 ProductVersion: 10.50.2500.0
 FileVersion: 2009.0100.2500.00 ((KJ_PCU_Main).110617-0038 )
 FileDescription: SQLAGENT - SQL Server Agent
 LegalCopyright: Microsoft Corp. All rights reserved.
 LegalTrademarks: Microsoft SQL Server is a registered trademark of Microsoft Corporation.
 Comments: SQL

Since this is full dump there can we multiple threads and we have no idea which thread is of our interest. To know that run below command on windbg.

0:000> ~
 # 0 Id: 155c.137c Suspend: 0 Teb: 000007ff`fffde000 Unfrozen
   1 Id: 155c.15f4 Suspend: 0 Teb: 000007ff`fffda000 Unfrozen
 . 2 Id: 155c.1a68 Suspend: 0 Teb: 000007ff`fffd4000 Unfrozen
   3 Id: 155c.1200 Suspend: 0 Teb: 000007ff`fffae000 Unfrozen
   4 Id: 155c.158c Suspend: 0 Teb: 000007ff`fffd8000 Unfrozen
   5 Id: 155c.128c Suspend: 0 Teb: 000007ff`fffd6000 Unfrozen

Now if you look at all the threads carefully you will find a “.” dot just before the thread 2. That is how we came to know this is the thread of our interest. Currently we are on thread 0 so we need to switch to thread 2. Below is the command to switch to a thread.

0:000> ~[2]s
 ntdll!NtWaitForSingleObject+0xa:
 00000000`7721135a c3 ret
 Run below command to dump the stack.
0:002> kc
 Call Site
 ntdll!NtWaitForSingleObject
 KERNELBASE!WaitForSingleObjectEx
 KERNELBASE!GetOverlappedResult
 sqlncli10!Np::ReadSync
 sqlncli10!BATCHCTX::SNIRead
 sqlncli10!BATCHCTX::ReadPacket
 sqlncli10!CConnection::PreLogin
 sqlncli10!CTdsParser::DoConnect
 sqlncli10!CTdsParser::OpenServerConnection
 sqlncli10!ConnectIt
 sqlncli10!DoDlgConnection
 sqlncli10!SQLDriverConnectW
 odbc32!SQLInternalDriverConnectW
 odbc32!SQLDriverConnectW
 sqlsvc!QSQLLogonExImpl
 sqlsvc!QSQLLogonExWithErrorHandling
 SQLAGENT!ConnVerifyConnectionOnStart
 SQLAGENT!DumpAndCheckServerVersion
 SQLAGENT!ServiceMain
 sechost!ScSvcctrlThreadA
 kernel32!BaseThreadInitThunk
 ntdll!RtlUserThreadStart

Looking at the highlighted part in the stack, looks like we got stuck while login to SQL Server.
There could be 2 possibilities.

1- We have some permission issues while login to SQL Server
2- We have some login issue with over all SQL Server itself.

We checked and confirmed that Agent account had sysadmin rights on the SQL Server. This signifies there is no permission issue with Agent.
So we decided to go ahead with other option.

We were not confident here that login to SQL Server could be an actual problem because customer is connected to SQL Server from his laptop and showing us the job failure status .This means Login is working fine from the client location but, what about login from the server itself?? Because SQL Agent is connecting to SQL Server using client tools of Server itself.

I asked customer to connect to SQL Server from Management Studio of server. What I see here was quite interesting Management Studio login got hung. This is interesting, isn’t it??

I tried to connect to SQL Server from Command prompt of server that also got hung. Now I was confident we are going in right direction.
It leads us to the conclusion that the actual problem is with client tools of Server. To make it 100% sure I created UDL (to know how to create udl, check this blog).

UDL worked in the first attempt because UDL by default goes with OLEDB Provider for SQL Server, but we are facing issue with native client that’s why I changed the provider of SQL Server to Native Client to check it is getting hung or not, check the blow screen on how to change it.

I changed it to Native Client 10.0 and then tried to connect and this also got hung.

Come on Manish! We are going in right direction and yes yes….We can crack this now.
Now I went back to the dump stack which we took earlier and checked it carefully, looked at below 2 frames.

 sqlncli10!BATCHCTX::ReadPacket
 sqlncli10!CConnection::PreLogin
 sqlncli10!CTdsParser::DoConnect

As per the above call looks like we got stuck at PreLogin that means we are not even going inside the SQL Server, problem is before that.
I consulted few of my friends who work on the connectivity side to check what checks we do during PreLogin.
As per them for the security reasons during the PreLogin we use SSL Encryption using Schannel.dll and this is registered at below registry location
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSecurityProvidersSCHANNEL
So one of the reasons for this problem could be the encryption cipher used during the SSL Encrypted Pre-Login to SQL Server is corrupt/disabled. Since the cipher is corrupt/disabled the pre-login cannot complete as the data cannot be encrypted/decrypted correctly.

To resolve this issue follow these steps:

1. Open regedit.
2. Rename the SCHANNEL key to old from below location:
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSecurityProvidersSCHANNEL === > make it to SCHANNEL_Old
3. When you do this you might receive an error. (This can be ignored).
4. Refresh the branch in the registry and the SCHANNEL key should now be recreated with default settings.
NOTE: No Reboot is required on Windows 2003/2008 but a reboot is required on Windows 2000.

After making these changes if we try to login to SQL Server this key will be re-populated.
Now any attempt of login to SQL Server from local server will be successful. We started the SQL Server Agent now and then tried to start a job. Now all the jobs are working fine!!!

NOTE: As you now know this was the issue with Client tools of that local machine, so this can happen with any client machine not necessarily with local server were SQL Server is installed, but resolution steps will remain same for that machine where you face this issue.

As you can see from this blog we started troubleshooting SQL Agent job failing with error and ending up troubleshooting Login issue.
Hope this will help you in troubleshooting not only this issue, infact you can follow the similar approach to troubleshoot other login issues as well.

Понравилась статья? Поделить с друзьями:
  • Sql ошибка 26 при обнаружении указанного сервера или экземпляра
  • Sql ошибка 26 нет сети
  • Sql ошибка 15404 как исправить
  • Sql ошибка 1068 не удалось запустить дочернюю службу
  • Sql откат транзакции при ошибке