Microsoft KB Archive/110565

{|
 * width="100%"|

INF: Automatic Transaction Log Dumping via Performance Monitor

 * }

Q110565

-

The information in this article applies to:


 * Microsoft SQL Server version 4.2x

-

SUMMARY
One of the features of SQL Server for Windows NT is its integration with the Windows NT Performance Monitor. The SQL Server for Windows NT "Configuration Guide" indicates that you can use the % Full counter of the SQLServer-Log object to dump or truncate the transaction log.

MORE INFORMATION
Below is an example of how to set up the event.

  Set up a text file called Dump.sql. This file will contain the Transact-SQL statements to dump or truncate the log, as in the following example:

      dump tran pubs with truncate_only go  Start the Window NT Performance Monitor and add an alert that will run the script through ISQL when the log is more than 75 percent full (or whatever threshold you think is appropriate.) Make sure that SQL Server is running. Start Performance Monitor. On the View menu, click Alert. Click on the + button to add an alert event. Select the SQLServer-Log object. Select the Log Space Used(%) counter.</li> Select the instance of the database that you want to monitor (for this example, select the pubs sample database).</li> Click the Over button of the Alert If dialog box, and then type the percentage at which you want the log to be truncated in the box to the right of this button. For example, if you type 75, the truncate command will be issued when the log becomes more than 75 percent full.</li>  Type the command file name that contains the following command:

<pre class="CODESAMP">     isql -Sserver -Usa -Ppassword -ic:\sql\dump.sql

A command file is required because Windows NT Performance Monitor passes an extra parameter, the alert condition, to the program. For additional information, please see the following article in the Microsoft Knowledge Base:

"Q117371 Setting Performance Monitor Alert to Run Program May Not Work"</li> Click the Every Time button so that the log will be truncated every time the percentage full exceeds the specified threshold.</li> Click OK.</li></ol>

NOTES:


 * You can use the Save Alert Settings command on the File menu to save these settings so that you do not have to re-create this alert every time you start Windows NT.
 * If you are using Integrated Security, Performance Monitor must be started either under an administrator account or the account that maps to the database's owner (DBO).

Additional query words: PERFMON 1105

Keywords : kbother

Issue type : kbinfo

Technology : kbSQLServSearch kbAudDeveloper kbSQLServ420OS2