Do I need to leave some extra space available on the disk which my database log files reside, for log backup operations to successfully occur?Why Does the Transaction Log Keep Growing or Run Out of Space?SQL Server 2008 R2 SP1 - Tempdb “Available free space” showing negative valueHow to pinpoint root cause of excessive log file growthLog File Management - Space on DiskWhy can't I get the available free space after shrinking?should we keep the log file or the data file on the fastest drive?Reclaim Transaction Log space of SQL ServerTruncation of transaction logsSQL Server 2016 out of disk spaceDatabase file …_log has a max file size set to x MB. If it runs out of space, the database will stop workingDoes splitting 1 tempdb file into 4 require a SQL Server restart?

Is it ok to include an epilogue dedicated to colleagues who passed away in the end of the manuscript?

What wound would be of little consequence to a biped but terrible for a quadruped?

Touchscreen-controlled dentist office snowman collector game

If Invisibility ends because the original caster casts a non-concentration spell, does Invisibility also end on other targets of the original casting?

Silly Sally's Movie

Potentiometer like component

This equation is outside the page, how to modify it

Is a lawful good "antagonist" effective?

Plywood subfloor won't screw down in a trailer home

Is this animal really missing?

Replacing Windows 7 security updates with anti-virus?

Time-reversing a quantum computation: what does this mean for the future of physics and is it considered to be time travel?

Prove that the total distance is minimised (when travelling across the longest path)

Best approach to update all entries in a list that is paginated?

How could our ancestors have domesticated a solitary predator?

What Happens when Passenger Refuses to Fly Boeing 737 Max?

Why would a jet engine that runs at temps excess of 2000°C burn when it crashes?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements

Coworker uses her breast-pump everywhere in the office

How could a female member of a species produce eggs unto death?

If the Captain's screens are out, does he switch seats with the co-pilot?

US to Europe trip with Canada layover- is 52 minutes enough?

Running a subshell from the middle of the current command



Do I need to leave some extra space available on the disk which my database log files reside, for log backup operations to successfully occur?


Why Does the Transaction Log Keep Growing or Run Out of Space?SQL Server 2008 R2 SP1 - Tempdb “Available free space” showing negative valueHow to pinpoint root cause of excessive log file growthLog File Management - Space on DiskWhy can't I get the available free space after shrinking?should we keep the log file or the data file on the fastest drive?Reclaim Transaction Log space of SQL ServerTruncation of transaction logsSQL Server 2016 out of disk spaceDatabase file …_log has a max file size set to x MB. If it runs out of space, the database will stop workingDoes splitting 1 tempdb file into 4 require a SQL Server restart?













2















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.)










share|improve this question
























  • You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

    – Shanky
    4 hours ago











  • @MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

    – J.D.
    1 hour ago















2















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.)










share|improve this question
























  • You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

    – Shanky
    4 hours ago











  • @MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

    – J.D.
    1 hour ago













2












2








2








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.)










share|improve this question
















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 14 mins ago









Max Vernon

51.6k13114228




51.6k13114228










asked 4 hours ago









J.D.J.D.

477311




477311












  • You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

    – Shanky
    4 hours ago











  • @MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

    – J.D.
    1 hour ago

















  • You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

    – Shanky
    4 hours ago











  • @MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

    – J.D.
    1 hour ago
















You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

– Shanky
4 hours ago





You should leave some space on drive where log file resides no matter how better you calculated the space requirement, there is always a chance of a query forcing it to grow more. Why take a risk

– Shanky
4 hours ago













@MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

– J.D.
1 hour ago





@MaxVernon I meant in regards to multiple log files because of multiple databases, but one log file per database.

– J.D.
1 hour ago










2 Answers
2






active

oldest

votes


















3














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.






share|improve this answer























  • 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.
    2 hours ago







  • 1





    @J.D. That is how online index rebuilds work, but it's not how log backups work.

    – Aaron Bertrand
    2 hours ago











  • Cool, I learned something new about index rebuilds now too. Thanks! :)

    – J.D.
    2 hours ago


















3














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:



  1. Windows will complain about the disk being out of space, which can be annoying.

  2. If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.

  3. 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 an int, or even a smallint. 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.






share|improve this answer

























  • So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

    – J.D.
    3 hours ago












  • I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

    – J.D.
    3 hours ago












  • @J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

    – Aaron Bertrand
    2 hours ago







  • 1





    Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

    – Max Vernon
    2 hours ago






  • 1





    ...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

    – Aaron Bertrand
    2 hours ago











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
);



);













draft saved

draft discarded


















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









3














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.






share|improve this answer























  • 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.
    2 hours ago







  • 1





    @J.D. That is how online index rebuilds work, but it's not how log backups work.

    – Aaron Bertrand
    2 hours ago











  • Cool, I learned something new about index rebuilds now too. Thanks! :)

    – J.D.
    2 hours ago















3














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.






share|improve this answer























  • 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.
    2 hours ago







  • 1





    @J.D. That is how online index rebuilds work, but it's not how log backups work.

    – Aaron Bertrand
    2 hours ago











  • Cool, I learned something new about index rebuilds now too. Thanks! :)

    – J.D.
    2 hours ago













3












3








3







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.






share|improve this answer













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.







share|improve this answer












share|improve this answer



share|improve this answer










answered 3 hours ago









Aaron BertrandAaron 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.
    2 hours ago







  • 1





    @J.D. That is how online index rebuilds work, but it's not how log backups work.

    – Aaron Bertrand
    2 hours ago











  • Cool, I learned something new about index rebuilds now too. Thanks! :)

    – J.D.
    2 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.
    2 hours ago







  • 1





    @J.D. That is how online index rebuilds work, but it's not how log backups work.

    – Aaron Bertrand
    2 hours ago











  • Cool, I learned something new about index rebuilds now too. Thanks! :)

    – J.D.
    2 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.
2 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.
2 hours ago





1




1





@J.D. That is how online index rebuilds work, but it's not how log backups work.

– Aaron Bertrand
2 hours ago





@J.D. That is how online index rebuilds work, but it's not how log backups work.

– Aaron Bertrand
2 hours ago













Cool, I learned something new about index rebuilds now too. Thanks! :)

– J.D.
2 hours ago





Cool, I learned something new about index rebuilds now too. Thanks! :)

– J.D.
2 hours ago













3














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:



  1. Windows will complain about the disk being out of space, which can be annoying.

  2. If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.

  3. 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 an int, or even a smallint. 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.






share|improve this answer

























  • So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

    – J.D.
    3 hours ago












  • I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

    – J.D.
    3 hours ago












  • @J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

    – Aaron Bertrand
    2 hours ago







  • 1





    Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

    – Max Vernon
    2 hours ago






  • 1





    ...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

    – Aaron Bertrand
    2 hours ago
















3














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:



  1. Windows will complain about the disk being out of space, which can be annoying.

  2. If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.

  3. 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 an int, or even a smallint. 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.






share|improve this answer

























  • So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

    – J.D.
    3 hours ago












  • I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

    – J.D.
    3 hours ago












  • @J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

    – Aaron Bertrand
    2 hours ago







  • 1





    Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

    – Max Vernon
    2 hours ago






  • 1





    ...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

    – Aaron Bertrand
    2 hours ago














3












3








3







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:



  1. Windows will complain about the disk being out of space, which can be annoying.

  2. If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.

  3. 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 an int, or even a smallint. 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.






share|improve this answer















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:



  1. Windows will complain about the disk being out of space, which can be annoying.

  2. If you do run out of log space, and you almost certainly will at some point, the database will not be accessible.

  3. 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 an int, or even a smallint. 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.







share|improve this answer














share|improve this answer



share|improve this answer








edited 2 hours ago

























answered 4 hours ago









Max VernonMax Vernon

51.6k13114228




51.6k13114228












  • So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

    – J.D.
    3 hours ago












  • I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

    – J.D.
    3 hours ago












  • @J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

    – Aaron Bertrand
    2 hours ago







  • 1





    Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

    – Max Vernon
    2 hours ago






  • 1





    ...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

    – Aaron Bertrand
    2 hours ago


















  • So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

    – J.D.
    3 hours ago












  • I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

    – J.D.
    3 hours ago












  • @J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

    – Aaron Bertrand
    2 hours ago







  • 1





    Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

    – Max Vernon
    2 hours ago






  • 1





    ...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

    – Aaron Bertrand
    2 hours ago

















So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

– J.D.
3 hours ago






So #2 and #3 confuse me a little bit (as does Shanky's comment on my question). I believe those points apply in regards to sizing the disk drive itself but not sizing the log files. If I reduced the log files sizes to leave more free space on the disk, and the same number of transactions occur to fill up my log files such that they grow to use all the free space on the disk, then the database will just as well be inaccessible and (it had to undergo grow operations).

– J.D.
3 hours ago














I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

– J.D.
3 hours ago






I guess the only way I see #2 applies is for the fact that you might not know which log file will grow the most and doing an even split of the whole disk drive then potentially limits the growth of one log file while another log file is wasting space. But even in that case when you don't know which log file might grow the fastest, doesn't it make more sense to make the disk large enough to leave a good buffer room for all of them and then size the log files to split up all of the disk space, instead of taking a shot in the dark which will grow fastest? (Since I agree disk space is cheep. :)

– J.D.
3 hours ago














@J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

– Aaron Bertrand
2 hours ago






@J.D. The point is that if you leave enough space free, you only have to deal with the file that actually grows, and if you make your growth setting sensible enough, you'll be able to deal with it before it's too late. If you just fill up the entire drive, you won't get any warning, the very first growth event will shut you down. Again, with enough free space and sensible growth settings, it's possible that growth events can happen freely without ever causing you any pain. Filling the drive is like keeping your sink completely full and not expecting any submerged dish to cause an overflow.

– Aaron Bertrand
2 hours ago





1




1





Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

– Max Vernon
2 hours ago





Also, growth events can trigger SQL Server Agent Audit actions, which can email you whenever they happen.

– Max Vernon
2 hours ago




1




1





...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

– Aaron Bertrand
2 hours ago






...and when you've done that for the same log file twice, you can concede that you estimated that log file's usage patterns incorrectly, and maybe it's time to move it or add more space. Shrinking a log file should be an extraordinary event - usually it should be left on its own to manage. Typically when it can't be and these surprises come, it's either because you're in the wrong recovery model or you aren't taking log backups frequently enough. See this post: dba.stackexchange.com/q/29829/1186

– Aaron Bertrand
2 hours ago


















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Best approach to update all entries in a list that is paginated?Best way to add items to a paginated listChoose Your Country: Best Usability approachUpdate list when a user is viewing the list without annoying themWhen would the best day to update your webpage be?What should happen when I add a Row to a paginated, sorted listShould I adopt infinite scrolling or classical pagination?How to show user that page objects automatically updateWhat is the best location to locate the comments section in a list pageBest way to combine filtering and selecting items in a listWhen one of two inputs must be updated to satisfy a consistency criteria, which should you update (if at all)?

Вунгтау (аеропорт) Загальні відомості | Див. також | Посилання | Навігаційне меню10°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.0833310°22′00″ пн. ш. 107°05′00″ сх. д. / 10.36667° пн. ш. 107.08333° сх. д. / 10.36667; 107.083337731608Vinh AirportVinh airport facelift improves serviceвиправивши або дописавши їївиправивши або дописавши їїр

Тонконіг бульбистий Зміст Опис | Поширення | Екологія | Господарське значення | Примітки | Див. також | Література | Джерела | Посилання | Навігаційне меню1114601320038-241116202404kew-435458Poa bulbosaЭлектронный каталог сосудистых растений Азиатской России [Електронний каталог судинних рослин Азіатської Росії]Малышев Л. Л. Дикие родичи культурных растений. Poa bulbosa L. - Мятлик луковичный. [Малишев Л. Л. Дикі родичи культурних рослин. Poa bulbosa L. - Тонконіг бульбистий.]Мятлик (POA) Сем. Злаки (Мятликовые) [Тонконіг (POA) Род. Злаки (Тонконогові)]Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Description from Flora of China) [Poa bulbosa Linnaeus, Sp. Pl. 1: 70. 1753. 鳞茎早熟禾 lin jing zao shu he (Опис від Флора Китаю)]Poa bulbosa L. – lipnice cibulkatá / lipnica cibulkatáPoa bulbosa в базі даних Poa bulbosa на сайті Poa bulbosa в базі даних «Global Biodiversity Information Facility» (GBIF)Poa bulbosa в базі даних «Euro + Med PlantBase» — інформаційному ресурсі для Євро-середземноморського розмаїття рослинPoa bulbosa L. на сайті «Плантариум»