Sessions: 231 The postings on this site are my own and do not represent my Employer's positions, advice or strategies.


  Wednesday, April 17, 2024
Wider View Login

IBM - AS400
Performance Counters
Service Broker
SQL Server
     Temporary Database
          TempDB Monitoring an...
          Moving the tempdb da...
          TempDB Multiple File...
          Moving the Temporary...
     SQL Mail
     DTS - Data Transformation Services
     Jobs SQL Agent
     User Management
     System Databases
     Temp Tables
Windows OS

Will be added as a sub-category of, Temporary Database
TempDB Multiple Files - concurrency Enhancement T1118
TempDB Multiple Files - concurrency Enhancement T1118 When the tempdb database is heavily used, SQL Server may experience contention when it tries to allocate pages. From the sysprocesses system table output, the waitresource may show up as "2:1:1" (PFS Page) or "2:1:3" (SGAM Page). Depending on the degree of contention, this may also lead to SQL Server appearing unresponsive for short periods. These operations heavily use tempdb: • Repeated create and drop of temporary tables (local or global). • Table variables that use tempdb for storage purposes. • Work tables associated with CURSORS. • Work tables associated with an ORDER BY clause. • Work tables associated with an GROUP BY clause. • Work files associated with HASH PLANS. Heavy and significant use of these activities may lead to the contention problems. Back to the top CAUSE During object creation, two (2) pages must be allocated from a mixed extent and assigned to the new object. One page is for the Index Allocation Map (IAM), and the second is for the first page for the object. SQL Server tracks mixed extents by using the Shared Global Allocation Map (SGAM) page. Each SGAM page tracks about 4 gigabytes of data. As part of allocating a page from the mixed extent, SQL Server must scan the Page Free Space (PFS) page to find out which mixed page is free to be allocated. The PFS page keeps track of free space available on every page, and each PFS page tracks about 8000 pages. Appropriate synchronization is maintained to make changes to the PFS and SGAM pages; and that can stall other modifiers for short periods. When SQL Server searches for a mixed page to allocate, it always starts the scan on the same file and SGAM page. This results in intense contention on the SGAM page when several mixed page allocations are underway, which can cause the problems documented in the "Symptoms" section of this article. Note De-allocation activities must also modify the pages, which can contribute to the increased contention. To learn more about the different allocation mechanisms used by SQL Server (SGAM, GAM, PFS, IAM), see the "References" section of this article. RESOLUTION To reduce the allocation resource contention for tempdb that is experiencing heavy usage, follow all these steps: 1. For servers that are running SQL Server 2000 Service Pack 3 (SP3), apply hotfix 8.00.0765 or the latest security fix 8.00.0818. For servers that are running SQL Server SP2, apply hotfix 8.00.0702. 2. Implement trace flag -T1118. 3. Increase the number of tempdb data files with equal sizing Note These steps also apply to Microsoft SQL Server 7.0. The only exception is that there is no hotfix for SQL Server 7.0; therefore, step 1 does not apply. With regards to step 2, the use of trace flag -T1118 for Microsoft SQL Server 7.0, before you use the trace flag, see the following article in the Microsoft Knowledge Base: 813492 FIX: Create index fails on SQL Server 7.0 when trace flag 1118 is enabled Service pack information To resolve this problem, obtain the latest service pack for Microsoft SQL Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base: 290211 How to obtain the latest SQL Server 2000 service pack Hotfix information Hotfix 8.00.0702 The English version of this hotfix has the file attributes (or later) that are listed in the following table. The dates and times for these files are listed in coordinated universal time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel. Note Because of file dependencies, the most recent hotfix or feature that contains the files may also contain additional files. Note The hotfix 8.00.0702 is for computers where you have applied SQL Server 2000 SP2. If you installed SQL Server 2000 SP3, install SQL Server 2000 SP3 rollup version 8.00.0765. See kb Article for part cut off.