When the transaction log files of your database are restored by using the WITH RECOVERY option as part of the log shipping process, you may notice that Microsoft SQL Server 2000 takes longer to complete the restore operation successfully than you expect.
For a list of previous hotfixes, see the "Microsoft SQL Server 2000 post-Service Pack 3 or Microsoft SQL Server 2000 post-Service Pack 3a hotfixes" section in the following Microsoft Knowledge Base article:
290211 How to obtain the most recent SQL Server 2000 service pack
This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.
The English version of this hotfix has the file attributes (or later file attributes) 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.
The SQL Server Agent job that corresponds to the log shipping process runs the xp_sqlmaint extended stored procedure that invokes the sqlmaint utility to restore the transaction log files.
The hotfix that is discussed in this article adds the following new parameters to the sqlmaint utility to help users speed up the restore process:
To improve the performance of the restore operation, you can modify the SQL Server Agent job step that calls the xp_sqlmaint extended stored procedure. Include the MaxTransferSize and the BufferCount parameters as the input parameters for the extended stored procedure. A command line that specifys a 512 KB transfer size with 2 buffers appears as follows:
-MaxTransferSize 524288 -BufferCount 2
Factors that affect the speed of the restore process
Several factors can affect the speed of the restore process. You must consider the following factors when you are evaluating the performance of the restore process:
The memory blocks that are fetched in the data cache.
The Virtual log file size.
The parallel query processing operations.
More information about each of these factors follows.
The memory blocks that are fetched in the data cache
The data pages that correspond to your database are not in the SQL Server data cache at the time that you initiate the restore process. The restore process uses the read-ahead feature to issue the asynchronous I/O. Therefore, the required data pages are fetched from the memory to the data cache in advance.
The data pages are fetched from the memory to the data cache in memory blocks. By using the MaxTransferSize parameter of the sqlmaint utility, you can adjust the size of the memory block that is fetched from the memory to the data cache during the restore operation. The maximum value that can be set for the MaxTransferSize parameter is 4,194,304. Therefore, the maximum size of the memory block that can be fetched from the memory to the data cache is 4 MB.
Note The value that is set for the MaxTransferSize parameter must be a power of 2, and the value must be between 64 KB and 4 MB, specified in bytes.
The more the data is available to SQL Server for processing during the restore process, the more speed the restore process will have. By using the MaxTransferSize parameter, you can increase the buffer size that can be fetched from the memory to the data cache by the read ahead operation. This will help improve the performance of the restore process.
For more information about how to improve the capabilities of the read ahead features, click the following article number to view the article in the Microsoft Knowledge Base:
834451 FIX: Restoring transaction log files takes longer than expected in SQL Server 2000
The Virtual log file size
Each transaction log file is logically divided into smaller segments that are referred to as virtual log files. All the virtual log files are not necessarily of the same size, and they are not in the same physical memory order. Therefore, the size of the memory block that is fetched during the read ahead operation depends on the size of the current virtual log file. Increasing the value of the MaxTransferSize parameter may not have any effect on the speed of the restore process of the transaction log files that contain smaller virtual log files.
For optimal performance, we recommend that you manually shrink the transaction log files instead of letting Microsoft SQL Server 2000 automatically shrink the transaction log files. Additionally, you must set the file growth increment size or the file growth increment percentage to a reasonable size to prevent the transaction log file from growing by too small a value.
For more information, visit the following Microsoft Web site:
This is an important factor when you are evaluating the performance of the restore operation. Because SQL Server accomplishes the restore operation by using a single execution thread, a parallel query processing operation that is recovered during the restore process takes longer. For example, a parallel query processing operation that takes 1 second to complete on an eight processor computer will take 8 seconds to complete during the restore process. Therefore, you must evaluate the requirements of the parallel query processing operations when you are backing up the log files by using the log shipping process.
The BufferCount parameter
The hotfix that is discussed in this article also includes an optional BufferCount parameter for the sqlmaint utility. You can use the BufferCount parameter to change the number of memory blocks that are the size as specified by the MaxTransferSize parameter and that are fetched by the read ahead feature at one instance. By default, the BufferCount parameter is set to 3.
However, note that the BufferCount parameter can be used only when you restore your SQL Server database. When you restore your SQL Server log, the log restore process disregards the value and it considers the default buffer count to be 3, even though you set the value of the BufferCount parameter to a value other than the default value.
Note The expression (BufferCount * MaxTransferSize) evaluates to the memory size that is fetched to the data cache. Therefore, maximizing these values may not always be a good solution. Make sure that you work with a reasonable memory goal.
For additional information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:
822499 New naming schema for Microsoft SQL Server software update packages
For additional information about the terminology that Microsoft uses when correcting software after it is released, click the following article number to view the article in the Microsoft Knowledge Base:
824684 Description of the standard terminology that is used to describe Microsoft software updates