Adding a log threshold at 45 percent of log size

Use the following procedure to add a log threshold with a free_space value set at 45 percent of log size.

  1. Determine the log size in pages:

    select sum(size)
    from master..sysusages
    where dbid = db_id("database_name")
    and (segmap & 4) = 4
    
  2. Use sp_addthreshold to add a new threshold with a free_space value set at 45 percent. For example, if the log’s capacity is 2048 pages, add a threshold with a free_space value of 922 pages:

    sp_addthreshold mydb, logsegment, 922, thresh_proc
    
  3. Create a simple threshold procedure that dumps the transaction log to the appropriate devices. For more information about creating threshold procedures, see “Creating threshold procedures”.