Consider the following scenario. You configure many Microsoft SQL Server 2000 or Microsoft SQL Server 2005 replication agents to run on a server. For example, you configure 600 replication agents to run on a server. In this scenario, some replication agents cannot run. Additionally, the following error message is logged in the System log:
Application Error : The application failed to initialize properly (0xc0000142).
Click on OK to terminate the application.
Back to the top
To work around this problem, use the method that is described in Microsoft Knowledge Base article 824422.
For more information, click the following article number to view the article in the Microsoft Knowledge Base:
824422 (http://kbalertz.com/Feedback.aspx?kbNumber=824422/)
Unexpected behavior occurs when you run many processes on a computer that is running SQL Server
Back to the top
Each account that starts the SQL Server Agent service corresponds to one noninteractive desktop heap. Additionally, all replication agents that are managed by the SQL Server Agent service share the desktop heap of the account.
Back to the top
How to examine the use of the desktop heap
You can use the Desktop Heap Monitor tool to examine the use of the desktop heap. Then, you can decide whether you have to increase or reduce the size of the noninteractive desktop heap. Usually, you have to increase the size.
To use the Desktop Heap Monitor tool to examine the use of the desktop heap, follow these steps:
| 1. | Download the Desktop Heap Monitor tool.
The following file is available for download from the Microsoft Download Center:
Download the DesktopHeapMonitor8_1_2925_0.exe package now. (http://www.microsoft.com/downloads/details.aspx?familyid=5cfc9b74-97aa-4510-b4b9-b2dc98c8ed8b) |
| 2. | Install the Desktop Heap Monitor tool. To do this, follow these steps:| a. | Double-click the package to extract the files. | | b. | Click Start, click Run, type cmd, and then click OK. | | c. | At the command prompt, run the following command:
CD ExtractFolder\kktools\dheapmon8.1\Platform
Note ExtractFolder is a placeholder for the folder where you extract the files. Platform is a placeholder for the name of the folder that corresponds to the specific platform. | | d. | Run the following command:
dheapinst.exe -y srv*http://msdl.microsoft.com/download/symbols |
|
| 3. | Load the driver. To do this, run the following command:
dheapmon.exe –l |
| 4. | Run the Desktop Heap Monitor tool. To do this, run the following command:
dheapmon –s |
The output resembles the following:
Desktop Heap Information Monitor Tool (Version 8.1.2925.0)
Copyright (c) Microsoft Corporation. All rights reserved.
-------------------------------------------------------------
Session ID: 0 Total Desktop: ( 7872 KB - 12 desktops)
WinStation\Desktop Heap Size(KB) Used Rate(%)
-------------------------------------------------------------
WinSta0\Default 3072 24.2
WinSta0\Disconnect 64 4.5
WinSta0\Winlogon 128 10.0
Service-0x0-3e7$\Default 512 40.9
Service-0x0-3e4$\Default 512 10.0
Service-0x0-3e5$\Default 512 6.9
SAWinSta\SADesktop 512 0.5
__X78B95_89_IW\__A8D9S1_42_ID 512 0.5
Service-0x0-1d419$\Default 512 2.4
Service-0x0-1da0b$\Default 512 2.4
Service-0x0-25c2e$\Default 512 13.5
Service-0x0-2461f$\Default 512 98.6
-------------------------------------------------------------
In this output, the Service-0x0-2461f$\Default item represents the account that starts the SQL Server Agent service. All replication agents run under the security context
of this account. If you run more replication agents, the use of the desktop heap will increase. If the use of the desktop heap is more than 98 percent or 99 percent, no desktop heap resources can be allocated. Therefore, you cannot start any new replication agents.
In this output, the use of the desktop heap of the account is 98.6 percent. In this situation, increase the size of the noninteractive desktop heap by increasing the third value of the
SharedSection parameter. After you increase the third value, the problem is resolved after you restart the server. Then, you can use the Desktop Heap Monitor tool to examine if the new value accommodates all the replication agents.
Note
For more information about the SharedSection parameter, click the following article number to view the article in the Microsoft Knowledge Base:
824422 (http://kbalertz.com/Feedback.aspx?kbNumber=824422/)
Unexpected behavior occurs when you run many processes on a computer that is running SQL Server
We recommend that the desktop heap use remain between 80 percent and 90 percent. If you increase the third value of the
SharedSection parameter, we recommend that you increase the value by 512 every time.
Back to the top
Considerations if you use Remote Desktop Protocol
If you connect to the server by using the Remote Desktop Protocol (RDP), make sure that you create the console session by using the
/console switch. If you do not use the
/console switch, you cannot see the desktop. This is because the account that starts the SQL Server Agent service is associated with session 0.
The Win32k.sys driver allocates 48 MB of buffer address space for the desktop heap. Make sure that you do not have many desktops that use up the whole 48 MB of buffer address space.
If the server is not configured as a terminal server, all desktop heaps share the 48 MB of buffer address space. This limits the number of service processes that can run on the server.
If the server is configured as a terminal server, the Win32k.sys driver allocates 20 MB of buffer address space for the desktop heap. The Win32k.sys driver also allocates 16 MB of session space for its own paged pool.
Back to the top
Differences between a terminal server and terminal services with regard to the desktop heap
A terminal server and terminal services are different. You install the Terminal Server component in Add or Remove Programs. After you install the Terminal Server component, the server becomes a terminal server. Terminal services is a service that exists in the Services Microsoft Management Console (MMC) snap-in. If you remove the Terminal Server component from the server, client computers can still connect to the server by using RDP. Therefore, consider removing the Terminal Server component to obtain the 48 MB of buffer address space for the desktop heap.
Back to the top
How jobs in SQL Server 2005 affect the desktop heap
In SQL Server 2005, you may have different jobs that run under different proxy accounts. For each proxy account, the noninteractive desktop heap for that proxy account will be allocated. For example, the third value of the
SharedSection parameter is 512. If you use a proxy account to start a job, the 512 KB desktop heap will be allocated, even if the job itself uses only 10 KB of the desktop heap.
Note Other jobs that use the same proxy account will still use this desktop heap.
This may result in many desktops when the SQL Server Agent service is started. Therefore, the 48 MB of buffer address space may be used up. If you use the Desktop Heap Monitor tool to examine the use of the desk heap, you will notice that one desktop corresponds to one proxy account that is used by a running job. We recommend that you use fewer proxy accounts to avoid reaching the 48 MB limit.
Back to the top
For more information about the values of the SharedSection parameter, click the following article number to view the article in the Microsoft Knowledge Base:
184802 (http://kbalertz.com/Feedback.aspx?kbNumber=184802/)
User32.dll or Kernel32.dll fails to initialize
Back to the top