An Exchange Server 2010 administrator may want to find out if any of the mailbox databases in the organization have been configured for circular logging.  However the Exchange Management Console does not make this information visually available.

The Exchange Management Shell can be used to determine which mailbox databases are enabled for circular logging by running the following command.

[PS] C:>Get-MailboxDatabase | where {$_.CircularLoggingEnabled -eq $true}

Name                           Server          Recovery        ReplicationType
----                           ------          --------        ---------------
Mailbox Database 02            EX1             False           Remote
Mailbox Database 04            EX2             False           None

Another technique is to list all mailbox database sorted by their circular logging settings.

[PS] C:>Get-MailboxDatabase | select name, circularloggingenabled | sort circularloggingenabled -desc | ft -AutoSize

Name                CircularLoggingEnabled
----                ----------------------
Mailbox Database 04                   True
Mailbox Database 02                   True
Mailbox Database 01                  False
Mailbox Database 03                  False

Here is a method that can be used to disabled circular logging on each of the mailbox databases. Because the change doesn’t take effect until the mailbox database is dismounted and mounted again, this method also performs that task.

Caution: this may cause a disruption to mailbox access for your end users, so I do not recommend running this outside of maintenance windows.

Firstly, read the mailbox databases that have circular logging enabled into an array.

[PS] C:>$dbs = Get-MailboxDatabase | where {$_.CircularLoggingEnabled -eq $true}

You can see now that the two mailbox databases are in the array.

[PS] C:>$dbs

Name                           Server          Recovery        ReplicationType
----                           ------          --------        ---------------
Mailbox Database 02            EX1             False           Remote
Mailbox Database 04            EX2             False           None

Now use the following commands to modify the circular logging setting on each mailbox database, dismount it, and mount it again.

Caution: I repeat my earlier warning that this may disrupt mailbox access for your end users. Proceed with care.

[PS] C:>foreach ($db in $dbs)
>> {Set-MailboxDatabase -Identity $db -CircularLoggingEnabled $false
>> Dismount-Database -Identity $db -Confirm:$false
>> Mount-Database -Identity $db
>> }
>>

Note: press Enter after each line and once more at the end to start processing the for loop.

About the Author

Paul Cunningham

Paul is a former Microsoft MVP for Office Apps and Services. He works as a consultant, writer, and trainer specializing in Office 365 and Exchange Server. Paul no longer writes for Practical365.com.

Comments

  1. Abdelchafik Zahzah

    Hello,
    Thanks for the Great work, however, I’m trying to modify the script to be used in a DAG environment and add a sleep of 120 sec between each database as following:

    -Remove Dismount+Mount operations (not needed in DAG DBs)
    -Add Sleep 120 sec between each DB (as i don’t want the logs of 50 DB to be purged at the same time)

    $dbs = Get-MailboxDatabase | where {$_.CircularLoggingEnabled -eq $False}
    foreach ($db in $dbs)
    {Set-MailboxDatabase -Identity $db -CircularLoggingEnabled $True
    sleep 240
    }

    Will be tankful if anyone could help.

    1. Abdelchafik Zahzah

      Actually the above script is working now, but i’ll need to add the below to re-disable teh circular logging at the end of the loop circle.

      Working Script to enable the Circular logging on a delay interval of 120 sec for each DB:

      $dbs = Get-MailboxDatabase | where {$_.CircularLoggingEnabled -eq $False}
      foreach ($db in $dbs)
      {Set-MailboxDatabase -Identity $db -CircularLoggingEnabled $True
      sleep 120
      }

      Need to add the below to the above script
      Set-MailboxDatabase -Identity $db -CircularLoggingEnabled $False

      **PS: Big fan of your work and Practical365.com

  2. praveen

    Hello, I enabled circular logging in exchange 2010, unfortunately, backup was running at the same time after finishing backup I checked backup status, the last backup was done. all databases are mounted state. but I have doubt it’s effect server databases or any other issues will come kindly help me on this issue.

  3. praveen

    Hello, I enabled circular logging in exchange 2010, unfortunately, backup was running at the same time after finishing backup I checked backup status, the last backup was done. all databases are mounted state . but I have doubt it’s effect server databases or any other issues will come ?

  4. Georgia Jaeger

    Does turning circular logging on an existing database disrupt service or cause loss of email? I am working with an environment that has circular logging on some of the databases but not all. Backups are failing as the database without circular logging (being large) is still being backed to NAS when the copy to external drive starts. I would need to clean up the transaction logs in the database to reduce the size. Would just turning on circular logging do the trick or will I need to do the dismount, wipe and remount? I’m a chicken to dismount the database.

    1. Georgia Jaeger

      addendum: when I say that backups are failing, I’m speaking to the server level bare metal backup to NAS, not the Exchange internal backup.

      GJ

    2. Avatar photo

      If you’re running a backup correctly, the transaction logs for the database that doesn’t have circular logging enabled should be getting truncated (removed) automatically. If that is not happening, I suspect your backup is misconfigured or is not the correct type of backup, which calls into question whether you will even be able to use that backup to restore data if there is a problem. I recommend you look at your backups configuration.

  5. John

    Thank you Paul, I am installing a backup for our Exchange DAG. The Exchange administrator has disabled the circular logging.
    Should i still do the full backup or copy backup ? My understanding is that the DAG truncates the logs after shipping .

    1. Avatar photo

      Please refer to your backup product’s documentation, and the Exchange backup documentation on TechNet, about what each backup does. It’s important to read and understand these things before you settle on a backup strategy.

  6. Allan

    Thank you Paul. This was very helpful and still relevant to Exchange 2016.

    I had to turn on Circular Logging as it was off by default and I found my self out of disk space unexpectedly.

    Just had to adapt the scripts above.

    1. Avatar photo

Leave a Reply