You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This topic describes how to add a persisted log buffer to a database in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)] and above using [!INCLUDE[tsql](../../includes/tsql-md.md)].
26
+
This topic describes how to add and remove a persistent log buffer to a database in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)] and above using [!INCLUDE[tsql](../../includes/tsql-md.md)].
26
27
27
28
## Permissions
28
29
@@ -36,13 +37,13 @@ To configure a persistent memory device in [Linux](../../linux/sql-server-linux-
36
37
37
38
To configure a persistent memory device in [Windows](../../database-engine/configure-windows/configure-persistent-memory.md).
38
39
39
-
## Add a persisted log buffer to a database
40
-
41
-
Use the following syntax to add a persisted log buffer to an existing database. The syntax differs depending on the version of [!INCLUDE[ssnoversion-md](../../includes/ssnoversion-md.md)].
40
+
## Add a persistent log buffer to a database
42
41
43
42
The volume or the mount point for the new log file must be formatted with DAX enabled (NTFS) or mounted with the DAX option (XFS/EXT4).
44
43
45
-
### Add persisted log file in [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] and later
44
+
Use the following syntax to add a persistent log buffer to an existing database. The syntax differs depending on the version of [!INCLUDE[ssnoversion-md](../../includes/ssnoversion-md.md)].
45
+
46
+
### Add persistent log buffer in [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] and later
46
47
47
48
```sql
48
49
ALTERDATABASE [DB] SET PERSISTENT_LOG_BUFFER =ON (DIRECTORY_NAME ='path-to-directory');
@@ -54,9 +55,9 @@ For example:
54
55
ALTERDATABASE WideWorldImporters SET PERSISTENT_LOG_BUFFER =ON (DIRECTORY_NAME ='F:\SQLTLog');
55
56
```
56
57
57
-
The name of the persisted log file buffer is generated automatically. The size of the file is always 20 megabytes.
58
+
The name of the persistent log file buffer is generated automatically. The size of the file is always 20 megabytes.
58
59
59
-
### Add persisted log file in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)]
60
+
### Add persistent log buffer in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)]
60
61
61
62
```sql
62
63
ALTERDATABASE [DB] ADD LOG FILE
@@ -78,17 +79,17 @@ SIZE = 20 MB
78
79
);
79
80
```
80
81
81
-
The log file on the DAX volume will be sized at 20 megabytes regardless of the size specified with the `ALTER DATABASE ADD LOG FILE` command.
82
+
The log buffer file on the DAX volume will be sized at 20 megabytes regardless of the size specified with the `ALTER DATABASE ADD LOG FILE` command.
82
83
83
-
## Remove a persisted log buffer from a database
84
+
## Remove a persistent log buffer from a database
84
85
85
-
The syntax differs depending on the version of [!INCLUDE[ssnoversion-md](../../includes/ssnoversion-md.md)].
86
+
To safely remove a persistent log buffer, the database must be placed in single user mode in order to drain the persistent log buffer.
86
87
87
-
To safely remove a persisted log buffer, the database must be placed in single user mode in order to drain the persisted log buffer.
88
+
When you remove a persistent log buffer, the log buffer file on disk is deleted.
88
89
89
-
When you remove a persisted log buffer, the log file on disk is deleted.
90
+
The syntax differs depending on the version of [!INCLUDE[ssnoversion-md](../../includes/ssnoversion-md.md)].
90
91
91
-
### Remove persisted log file in [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] and later
92
+
### Remove persistent log buffer in [!INCLUDE[sssql17-md](../../includes/sssql17-md.md)] and later
92
93
93
94
```sql
94
95
ALTERDATABASE [DB] SET PERSISTENT_LOG_BUFFER = OFF;
@@ -100,7 +101,7 @@ For example:
100
101
ALTERDATABASE WideWorldImporters SET PERSISTENT_LOG_BUFFER = OFF;
101
102
```
102
103
103
-
### Remove persisted log file in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)]
104
+
### Remove persistent log buffer in [!INCLUDE[sqlv16](../../includes/sssql16-md.md)]
104
105
105
106
```sql
106
107
ALTERDATABASE [DB] SET SINGLE_USER;
@@ -118,19 +119,20 @@ ALTER DATABASE WideWorldImporters SET MULTI_USER;
118
119
119
120
## Limitations
120
121
121
-
[Transparent Data Encryption (TDE)](../security/encryption/transparent-data-encryption.md) is not compatible with persisted log buffer.
122
+
[Transparent Data Encryption (TDE)](../security/encryption/transparent-data-encryption.md) is not compatible with persistent log buffer.
122
123
123
-
[Availability Groups](../../t-sql/statements/create-availability-group-transact-sql.md) can only use this feature on secondary replicas due to the requirement by the log reader agent for standard log writing semantics on the primary. However, a small log file must be created on all nodes (ideally on DAX volumes or mounts). In the event of a failover, the persisted log buffer path must exist, in order for the failover to be successful.
124
+
[Availability Groups](../../t-sql/statements/create-availability-group-transact-sql.md) can only use this feature on secondary replicas due to the requirement by the log reader agent for standard log writing semantics on the primary. However, a small log file must be created on all nodes (ideally on DAX volumes or mounts). In the event of a failover, the persistent log buffer path must exist, in order for the failover to be successful.
124
125
125
-
In cases where the path or file isn't present during an Availability Group failover event, or database startup, the database enters a `RECOVERY PENDING` state until the issue is resolved.
126
+
> [!CAUTION]
127
+
> If the persistent log buffer path or file isn't present during an Availability Group failover event, or database startup, the database enters a `RECOVERY PENDING` state until the issue is resolved.
126
128
127
129
## Interoperability with other PMEM features
128
130
129
-
When both persisted log buffer and [Hybrid Buffer Pool](../../database-engine/configure-windows/hybrid-buffer-pool.md) are enabled, along with the start up [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md), Hybrid Buffer Pool will operate in what is known as _Direct Write_ mode.
131
+
When both persistent log buffer and [Hybrid Buffer Pool](../../database-engine/configure-windows/hybrid-buffer-pool.md) are enabled, along with the start up [trace flag 809](../../t-sql/database-console-commands/dbcc-traceon-trace-flags-transact-sql.md), Hybrid Buffer Pool will operate in what is known as _Direct Write_ mode.
130
132
131
133
## Back up and restore operations
132
134
133
-
Normal restore conditions apply. If persisted log buffer is restored to a DAX volume or mount, it continues to function. If the log is restored to a regular disk volume, it can be safely removed.
135
+
Normal restore conditions apply. If persistent log buffer is restored to a DAX volume or mount, it continues to function. If the log is restored to a non-DAX disk volume, it can be safely removed using the `ALTER DATABASE REMOVE FILE` command.
Copy file name to clipboardExpand all lines: docs/t-sql/statements/alter-database-transact-sql-set-options.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -268,7 +268,7 @@ SET
268
268
PERSISTENT_LOG_BUFFER
269
269
{
270
270
= OFF
271
-
| = ON (DIRECTORY_NAME= '<Filepath to folder on DAXformattedvolume>')
271
+
| = ON (DIRECTORY_NAME= 'directory-name-on-a-DAX-formatted-volume')
272
272
}
273
273
}
274
274
@@ -1170,7 +1170,7 @@ Enables or disables Stretch Database for the database. For more info, see [Stret
1170
1170
1171
1171
**Applies to**: [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] and later.
1172
1172
1173
-
When this option is specified, the transaction log buffer is created on a volume that is located on a disk device backed by Storage Class Memory (NVDIMM-N nonvolatile storage), also known as a persistent log buffer. For more information, see [Transaction Commit latency acceleration using Storage Class Memory](/archive/blogs/sqlserverstorageengine/transaction-commit-latency-acceleration-using-storage-class-memory-in-windows-server-2016sql-server-2016-sp1) and [Add persisted log buffer to a database](../../relational-databases/databases/add-persisted-log-buffer.md).
1173
+
When this option is specified, the transaction log buffer is created on a volume that is located on a disk device backed by Storage Class Memory (NVDIMM-N nonvolatile storage), also known as a persistent log buffer. For more information, see [Transaction Commit latency acceleration using Storage Class Memory](/archive/blogs/sqlserverstorageengine/transaction-commit-latency-acceleration-using-storage-class-memory-in-windows-server-2016sql-server-2016-sp1) and [Add persistent log buffer to a database](../../relational-databases/databases/add-persisted-log-buffer.md).
@@ -288,7 +288,7 @@ The following options are allowable only when CONTAINMENT has been set to PARTIA
288
288
289
289
**Applies to**: [!INCLUDE[ssSQL17](../../includes/sssql17-md.md)] and later.
290
290
291
-
When this option is specified, the transaction log buffer is created on a volume that is located on a disk device backed by Storage Class Memory (NVDIMM-N nonvolatile storage), also known as a persistent log buffer. For more information, see [Transaction Commit latency acceleration using Storage Class Memory](/archive/blogs/sqlserverstorageengine/transaction-commit-latency-acceleration-using-storage-class-memory-in-windows-server-2016sql-server-2016-sp1) and [Add persisted log buffer to a database](../../relational-databases/databases/add-persisted-log-buffer.md).
291
+
When this option is specified, the transaction log buffer is created on a volume that is located on a disk device backed by Storage Class Memory (NVDIMM-N nonvolatile storage), also known as a persistent log buffer. For more information, see [Transaction Commit latency acceleration using Storage Class Memory](/archive/blogs/sqlserverstorageengine/transaction-commit-latency-acceleration-using-storage-class-memory-in-windows-server-2016sql-server-2016-sp1) and [Add persistent log buffer to a database](../../relational-databases/databases/add-persisted-log-buffer.md).
0 commit comments