How to Truncate Exchange Logs without Backup

Written by

In Exchange Server, transaction logs act as a buffer storage between the user, memory, and database. Transaction logs are generated constantly and purged after a successful backup of the database. If there is an issue with the backup or the backup solution, the logs will not get purged and eventually fill the hard drive.

If the drive where the database is located gets full, then this can create issues with the database and possibly lead to data loss or corruption.

So, it is important to ensure that transaction logs get truncated. In this article, we will go through the process to truncate the transaction logs without taking a backup.

Importance of Transaction Logs

If the database is accessed directly by all the processes at once, this will create delays and impact the database health. For this reason, transaction logs and memory are used as buffer for the database and temporary data is held in them until the database is backed up. During the backup, the transaction logs are committed to the database and purged by the system.

If a transaction log is deleted, moved, or corrupted, the database consistency check will fail and the database will not mount. This is why it’s important to backup the databases at least once a day to clear out and purge the transaction logs. Once the backup is complete, the database will be marked as backed up and the transaction logs will be truncated automatically.

How to Truncate Transaction Logs without Backup

The transaction logs hold temporary data and just deleting or misplacing these files will impact the health of the database. So, to truncate the transaction logs without backup, you need to find a way to simulate the backup so that the transaction logs can be purged without compromising the health of the server and data.

To achieve this, you can use the DiskShadow command, which will simulate a full backup of the server/database and inform that a backup has been completed so that the Exchange Server can commit and purge the transaction logs. Here’s how to do so:

  • Open Command Prompt as Administrator on the server.
  • Type DiskShadow and press Enter.
  • Type Add Volume <drive letter> and press Enter. For more than one partition, repeat the Add Volume command.
  • Type Begin Backup and press Enter.
  • Type Create and press Enter. The process may take some time depending on the drive size, database/transaction log size, and the server’s performance. Wait for the process to finish. You can monitor the progress through the Task Manager or the Resource Monitor.
  • Once the process is complete, type End Backup and press Enter. This will also take some time to finish.

After this process is complete, you will gradually see the space being re-claimed by the server.

To confirm that the database has been fully backed up, you can execute the Get-MailboxDatabase command in the Exchange Management Shell (EMS) as given below.

Get-MailboxDatabase -Status | select Name,LastFullBackup

To get the full info on the database backup and snapshots, you can use the below command.

Get-MailboxDatabase -status | select Name, *backup

How to Recover Data if any Issue Arises?

There is a possibility that either transaction log or database gets corrupt after ending up with no disk space. This happens if the database has not been shut down properly. In such cases, you can restore data from backup, but the recent changes will be lost. Alternatively, you can utilize a specialized Exchange recovery tool, like Stellar Repair for Exchange to restore the data.

With Stellar Repair for Exchange, you don’t need a working Exchange Server to retrieve data from an Exchange Server database. You can open any version of EDB file and in any state. Once the database is opened, you will see the entire structure of the database. You can browse through an Outlook-like interface and granularly export the database items to PST and other file formats.

You can also export the data to a new live Exchange Server database or Office 365 with features, such as automatic mailbox matching (from source to destination), priority export (to export VIP users first), parallel exports (for faster recovery). It can process user mailboxes, user archives, shared mailboxes, disabled mailboxes, and public folders.

Conclusion

Above, we have discussed what the Transaction logs are and what their importance is. We have also discussed how to truncate the transaction logs without backup. If the database gets corrupted, then you can restore the database from backup. However, it involves the risk of data loss. A better option is to use an Exchange recovery tool, such as Stellar Repair for Exchange. This tool can recover all the data from the corrupt database and ensure that no data is lost. It supports Exchange Server 2019, 2016, 2013, and the earlier versions.

Brought to you by

What’s hot on Infosecurity Magazine?