Add persisted log buffer to a database

Applies to: yesSQL Server (all supported versions)

This topic describes how to add a persisted log buffer to a database in SQL Server 2019 (15.x) using Transact-SQL.

Permissions

Requires ALTER permission on the database.

Configure persistent memory device (Linux)

To configure a persistent memory device in Linux.

Configure persistent memory device (Windows)

To configure a persistent memory device in Windows.

Add a persisted log buffer to a database

The following examples adds a persisted log buffer.

ALTER DATABASE <MyDB> 
  ADD LOG FILE 
  (
    NAME = <DAXlog>, 
    FILENAME = '<Filepath to DAX Log File>', 
    SIZE = 20MB
  );

The volume or mount the new log file is placed must be formatted with DAX (NTFS) or mounted with the DAX option (XFS/EXT4).

Remove a persisted log buffer

To safely remove a persisted log buffer, the database must be placed in single user mode in order to drain the persisted log buffer.

The following example places removes a persisted log buffer.

ALTER DATABASE <MyDB> SET SINGLE_USER;
ALTER DATABASE <MyDB> REMOVE FILE <DAXlog>;
ALTER DATABASE <MyDB> SET MULTI_USER;

Limitations

Transparent Data Encryption (TDE) is not compatible with persisted log buffer.

Availability Groups can only use this feature on secondary replicas due to need for normal log writing semantics on the primary. However, the small log file must be created on all nodes (ideally on DAX volumes or mounts).

Backup and restore operations

Normal restore conditions apply. If persisted log buffer is restored to a DAX volume or mount, it will continue to function, otherwise it can be safely removed.

Next steps