Do I need to leave some extra space available on the disk which my database log files reside, for log backup...
If I size my log files to evenly split the entire drive they reside on, leaving no extra space available, will log backups still be able to occur successfully? I have several databases, with one log file per database.
Is it good practice to not leave any space on the drive available, i.e. allocate it all to the log files? (The drive is dedicated to the log files in this case, data and the OS live on their own partitions.)
sql-server sql-server-2008-r2 transaction-log disk-space logs
add a comment |
If I size my log files to evenly split the entire drive they reside on, leaving no extra space available, will log backups still be able to occur successfully? I have several databases, with one log file per database.
Is it good practice to not leave any space on the drive available, i.e. allocate it all to the log files? (The drive is dedicated to the log files in this case, data and the OS live on their own partitions.)
sql-server sql-server-2008-r2 transaction-log disk-space logs
add a comment |
If I size my log files to evenly split the entire drive they reside on, leaving no extra space available, will log backups still be able to occur successfully? I have several databases, with one log file per database.
Is it good practice to not leave any space on the drive available, i.e. allocate it all to the log files? (The drive is dedicated to the log files in this case, data and the OS live on their own partitions.)
sql-server sql-server-2008-r2 transaction-log disk-space logs
If I size my log files to evenly split the entire drive they reside on, leaving no extra space available, will log backups still be able to occur successfully? I have several databases, with one log file per database.
Is it good practice to not leave any space on the drive available, i.e. allocate it all to the log files? (The drive is dedicated to the log files in this case, data and the OS live on their own partitions.)
sql-server sql-server-2008-r2 transaction-log disk-space logs
sql-server sql-server-2008-r2 transaction-log disk-space logs
edited 3 hours ago
Max Vernon
51.6k13114228
51.6k13114228
asked 7 hours ago
J.D.J.D.
482311
482311
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Well log backups don't change the size of the log file, and the only reason you'd need space on that drive is if you were backing up the log there (which is the same kind of bad idea as putting your house key and the backup on the same key ring). But a slightly different question, do you expect none of your log files to ever grow? Leaving a bit of space at least gives you some canary time where you can deal with a log file that is growing atypically. With no space leftover, as soon as the log file needs to grow, you're down.
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
add a comment |
There is no technical problem for SQL Server if the drive where the log file exists has no free space, assuming the log itself doesn't run out of available VLF entries.
If the log runs out of space, you'll not be able to commit any transactions until you resolve the problem. If the entire drive is consumed by the log file, the only action you can take is to add a log file on a different drive to the database; however that can be problematic if you can't actually write anything to the existing log file. Adding a log file when you're already out of log space can be impossible since the mere fact of adding a log file modifies the primary data file, which necessitates writing to the log. It's kind of a chicken-and-egg thing. If you proactively manage your log file, and never run out of log space, there is no technical prohibition from doing what you're contemplating.
Having said that, I wouldn't recommend sizing your log file to consume all available drive space:
- Windows will complain about the disk being out of space, which can be annoying.
- If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.
- How much does disk space cost? Almost nothing. Ask yourself why you wouldn't leave a little space free on the drive. Please don't take this to mean I'm endorsing using the wrong data types such as using a
bigint
instead of anint
, or even asmallint
. Unused disk space is cheap, but space used inside a database should be considered premium cost for the reasons succinctly outlined by @SolomonRutzky here.
In a comment, you mentioned that you see no difference between a log growing to fill the disk, and the disk already being filled with a mostly empty log which subsequently gets filled. The supposition is correct, both events will result in the server returning the following error:
Msg 9002, Level 17, State 2, Line 22
The transaction log for database '<database_name>' is full due to 'LOG_BACKUP'.
However, if you have a SAN, you could thin-provision the drive with a maximum size of, say, 10TB. Create the log file with the estimated "correct" initial size, say 1GB, with growth set to 1GB (or whatever makes sense). Then you won't be using more SAN disk space than you need, but you'll have room to grow the log file without needing to involve the SAN administrator. Win-win.
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "182"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232048%2fdo-i-need-to-leave-some-extra-space-available-on-the-disk-which-my-database-log%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Well log backups don't change the size of the log file, and the only reason you'd need space on that drive is if you were backing up the log there (which is the same kind of bad idea as putting your house key and the backup on the same key ring). But a slightly different question, do you expect none of your log files to ever grow? Leaving a bit of space at least gives you some canary time where you can deal with a log file that is growing atypically. With no space leftover, as soon as the log file needs to grow, you're down.
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
add a comment |
Well log backups don't change the size of the log file, and the only reason you'd need space on that drive is if you were backing up the log there (which is the same kind of bad idea as putting your house key and the backup on the same key ring). But a slightly different question, do you expect none of your log files to ever grow? Leaving a bit of space at least gives you some canary time where you can deal with a log file that is growing atypically. With no space leftover, as soon as the log file needs to grow, you're down.
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
add a comment |
Well log backups don't change the size of the log file, and the only reason you'd need space on that drive is if you were backing up the log there (which is the same kind of bad idea as putting your house key and the backup on the same key ring). But a slightly different question, do you expect none of your log files to ever grow? Leaving a bit of space at least gives you some canary time where you can deal with a log file that is growing atypically. With no space leftover, as soon as the log file needs to grow, you're down.
Well log backups don't change the size of the log file, and the only reason you'd need space on that drive is if you were backing up the log there (which is the same kind of bad idea as putting your house key and the backup on the same key ring). But a slightly different question, do you expect none of your log files to ever grow? Leaving a bit of space at least gives you some canary time where you can deal with a log file that is growing atypically. With no space leftover, as soon as the log file needs to grow, you're down.
answered 7 hours ago
Aaron Bertrand♦Aaron Bertrand
152k18293490
152k18293490
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
add a comment |
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
The only reasoning I had behind leaving the extra space for the log backups is because I know in some types of backup or copy operations (outside of SQL, perhaps I've seen it at the OS level in Windows) roughly the same amount of space of the data being copied needs to be available to perform the copy operation. I wasn't sure if there was any similar methodology in how log backups work.
– J.D.
5 hours ago
1
1
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
@J.D. That is how online index rebuilds work, but it's not how log backups work.
– Aaron Bertrand♦
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
Cool, I learned something new about index rebuilds now too. Thanks! :)
– J.D.
5 hours ago
add a comment |
There is no technical problem for SQL Server if the drive where the log file exists has no free space, assuming the log itself doesn't run out of available VLF entries.
If the log runs out of space, you'll not be able to commit any transactions until you resolve the problem. If the entire drive is consumed by the log file, the only action you can take is to add a log file on a different drive to the database; however that can be problematic if you can't actually write anything to the existing log file. Adding a log file when you're already out of log space can be impossible since the mere fact of adding a log file modifies the primary data file, which necessitates writing to the log. It's kind of a chicken-and-egg thing. If you proactively manage your log file, and never run out of log space, there is no technical prohibition from doing what you're contemplating.
Having said that, I wouldn't recommend sizing your log file to consume all available drive space:
- Windows will complain about the disk being out of space, which can be annoying.
- If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.
- How much does disk space cost? Almost nothing. Ask yourself why you wouldn't leave a little space free on the drive. Please don't take this to mean I'm endorsing using the wrong data types such as using a
bigint
instead of anint
, or even asmallint
. Unused disk space is cheap, but space used inside a database should be considered premium cost for the reasons succinctly outlined by @SolomonRutzky here.
In a comment, you mentioned that you see no difference between a log growing to fill the disk, and the disk already being filled with a mostly empty log which subsequently gets filled. The supposition is correct, both events will result in the server returning the following error:
Msg 9002, Level 17, State 2, Line 22
The transaction log for database '<database_name>' is full due to 'LOG_BACKUP'.
However, if you have a SAN, you could thin-provision the drive with a maximum size of, say, 10TB. Create the log file with the estimated "correct" initial size, say 1GB, with growth set to 1GB (or whatever makes sense). Then you won't be using more SAN disk space than you need, but you'll have room to grow the log file without needing to involve the SAN administrator. Win-win.
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
add a comment |
There is no technical problem for SQL Server if the drive where the log file exists has no free space, assuming the log itself doesn't run out of available VLF entries.
If the log runs out of space, you'll not be able to commit any transactions until you resolve the problem. If the entire drive is consumed by the log file, the only action you can take is to add a log file on a different drive to the database; however that can be problematic if you can't actually write anything to the existing log file. Adding a log file when you're already out of log space can be impossible since the mere fact of adding a log file modifies the primary data file, which necessitates writing to the log. It's kind of a chicken-and-egg thing. If you proactively manage your log file, and never run out of log space, there is no technical prohibition from doing what you're contemplating.
Having said that, I wouldn't recommend sizing your log file to consume all available drive space:
- Windows will complain about the disk being out of space, which can be annoying.
- If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.
- How much does disk space cost? Almost nothing. Ask yourself why you wouldn't leave a little space free on the drive. Please don't take this to mean I'm endorsing using the wrong data types such as using a
bigint
instead of anint
, or even asmallint
. Unused disk space is cheap, but space used inside a database should be considered premium cost for the reasons succinctly outlined by @SolomonRutzky here.
In a comment, you mentioned that you see no difference between a log growing to fill the disk, and the disk already being filled with a mostly empty log which subsequently gets filled. The supposition is correct, both events will result in the server returning the following error:
Msg 9002, Level 17, State 2, Line 22
The transaction log for database '<database_name>' is full due to 'LOG_BACKUP'.
However, if you have a SAN, you could thin-provision the drive with a maximum size of, say, 10TB. Create the log file with the estimated "correct" initial size, say 1GB, with growth set to 1GB (or whatever makes sense). Then you won't be using more SAN disk space than you need, but you'll have room to grow the log file without needing to involve the SAN administrator. Win-win.
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
add a comment |
There is no technical problem for SQL Server if the drive where the log file exists has no free space, assuming the log itself doesn't run out of available VLF entries.
If the log runs out of space, you'll not be able to commit any transactions until you resolve the problem. If the entire drive is consumed by the log file, the only action you can take is to add a log file on a different drive to the database; however that can be problematic if you can't actually write anything to the existing log file. Adding a log file when you're already out of log space can be impossible since the mere fact of adding a log file modifies the primary data file, which necessitates writing to the log. It's kind of a chicken-and-egg thing. If you proactively manage your log file, and never run out of log space, there is no technical prohibition from doing what you're contemplating.
Having said that, I wouldn't recommend sizing your log file to consume all available drive space:
- Windows will complain about the disk being out of space, which can be annoying.
- If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.
- How much does disk space cost? Almost nothing. Ask yourself why you wouldn't leave a little space free on the drive. Please don't take this to mean I'm endorsing using the wrong data types such as using a
bigint
instead of anint
, or even asmallint
. Unused disk space is cheap, but space used inside a database should be considered premium cost for the reasons succinctly outlined by @SolomonRutzky here.
In a comment, you mentioned that you see no difference between a log growing to fill the disk, and the disk already being filled with a mostly empty log which subsequently gets filled. The supposition is correct, both events will result in the server returning the following error:
Msg 9002, Level 17, State 2, Line 22
The transaction log for database '<database_name>' is full due to 'LOG_BACKUP'.
However, if you have a SAN, you could thin-provision the drive with a maximum size of, say, 10TB. Create the log file with the estimated "correct" initial size, say 1GB, with growth set to 1GB (or whatever makes sense). Then you won't be using more SAN disk space than you need, but you'll have room to grow the log file without needing to involve the SAN administrator. Win-win.
There is no technical problem for SQL Server if the drive where the log file exists has no free space, assuming the log itself doesn't run out of available VLF entries.
If the log runs out of space, you'll not be able to commit any transactions until you resolve the problem. If the entire drive is consumed by the log file, the only action you can take is to add a log file on a different drive to the database; however that can be problematic if you can't actually write anything to the existing log file. Adding a log file when you're already out of log space can be impossible since the mere fact of adding a log file modifies the primary data file, which necessitates writing to the log. It's kind of a chicken-and-egg thing. If you proactively manage your log file, and never run out of log space, there is no technical prohibition from doing what you're contemplating.
Having said that, I wouldn't recommend sizing your log file to consume all available drive space:
- Windows will complain about the disk being out of space, which can be annoying.
- If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.
- How much does disk space cost? Almost nothing. Ask yourself why you wouldn't leave a little space free on the drive. Please don't take this to mean I'm endorsing using the wrong data types such as using a
bigint
instead of anint
, or even asmallint
. Unused disk space is cheap, but space used inside a database should be considered premium cost for the reasons succinctly outlined by @SolomonRutzky here.
In a comment, you mentioned that you see no difference between a log growing to fill the disk, and the disk already being filled with a mostly empty log which subsequently gets filled. The supposition is correct, both events will result in the server returning the following error:
Msg 9002, Level 17, State 2, Line 22
The transaction log for database '<database_name>' is full due to 'LOG_BACKUP'.
However, if you have a SAN, you could thin-provision the drive with a maximum size of, say, 10TB. Create the log file with the estimated "correct" initial size, say 1GB, with growth set to 1GB (or whatever makes sense). Then you won't be using more SAN disk space than you need, but you'll have room to grow the log file without needing to involve the SAN administrator. Win-win.
edited 5 hours ago
answered 7 hours ago
Max VernonMax Vernon
51.6k13114228
51.6k13114228
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
add a comment |
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
Comments are not for extended discussion; this conversation has been moved to chat.
– Paul White♦
2 hours ago
add a comment |
Thanks for contributing an answer to Database Administrators Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fdba.stackexchange.com%2fquestions%2f232048%2fdo-i-need-to-leave-some-extra-space-available-on-the-disk-which-my-database-log%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown