| title | Add persisted log buffer to a database | ||||||
|---|---|---|---|---|---|---|---|
| ms.custom | |||||||
| ms.date | 10/30/2019 | ||||||
| ms.prod | sql | ||||||
| ms.prod_service | database-engine | ||||||
| ms.reviewer | |||||||
| ms.technology | configuration | ||||||
| ms.topic | conceptual | ||||||
| helpviewer_keywords |
|
||||||
| ms.assetid | 8ead516a-1334-4f40-84b2-509d0a8ffa45 | ||||||
| author | briancarrig | ||||||
| ms.author | brcarrig | ||||||
| manager | amitban |
[!INCLUDEappliesto-ss-xxxx-xxxx-xxx-md]
This topic describes how to add a persisted log buffer to a database in [!INCLUDEsqlv15] using [!INCLUDEtsql].
Requires ALTER permission on the database.
To configure a persistent memory device in Linux.
To configure a persistent memory device in Windows.
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).
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;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).
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.