Showing posts with label shrink. Show all posts
Showing posts with label shrink. Show all posts

Monday, March 26, 2012

Log file won't Shrink in Simple Recovery Mode

Ok, I know there are a TON of threads out there on this but I still can't find exactly what I am looking for.
I have a 4GB DB with a 1GB log file. Backups are done nightly and written to a NAS via UNC path. When I went home on Friday the log was 200MB -- this morning it was 1GB. As I stated the recovery model is set to simple so it should just reuse itself. I issued a DBCC loginfo to see that each part of the log was a status 2. I then tried a backup log... with truncate_only and backup log...with no_log. This did not reclaim any space.
I have exhausted what I THOUGHT I knew about simple recovery. If anyone else has an idea, please post!
It has always been my understanding thatIf there are a lot of VLF's with a status of 2 that means you have
uncommitted transactions in them. What does DBCC OPENTRAN() say?
--
Andrew J. Kelly SQL MVP
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that|||Is there any open transaction? DBCC OPENTRAN.
Was there any replication properties set on for this database?
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that|||Well that will sure do it<g>.
--
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...
> There were 10 open trans in the DB
> "Andrew J. Kelly" wrote:
> > If there are a lot of VLF's with a status of 2 that means you have
> > uncommitted transactions in them. What does DBCC OPENTRAN() say?
> >
> > --
> > Andrew J. Kelly SQL MVP
> >
> >
> > "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
> > news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> > > Ok, I know there are a TON of threads out there on this but I still
can't
> > find exactly what I am looking for.
> > >
> > > I have a 4GB DB with a 1GB log file. Backups are done nightly and
written
> > to a NAS via UNC path. When I went home on Friday the log was 200MB --
this
> > morning it was 1GB. As I stated the recovery model is set to simple so
it
> > should just reuse itself. I issued a DBCC loginfo to see that each part
of
> > the log was a status 2. I then tried a backup log... with truncate_only
and
> > backup log...with no_log. This did not reclaim any space.
> > >
> > > I have exhausted what I THOUGHT I knew about simple recovery. If
anyone
> > else has an idea, please post!
> > >
> > > It has always been my understanding that
> >
> >
> >|||Dave,
A log file works in a round robin format. It starts adding transactions
sequentially from the beginning to the end. Once it gets to the end it will
wrap around only if the first VLF is free and has no uncommitted
transactions. Otherwise it will grow the log and continue on. If you have
an open tran for 12 hours you have some serious issues with your app. A
transaction should ideally be open for seconds at the very most. You
absolutely need to find out who is keeping these trans open and why.
Whether you kill them or not is up to you but you have to either commit them
or roll them back.
--
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:DD934F0C-13B9-4E67-876E-DB027E285BAF@.microsoft.com...
> Yes and no...(I think)
> Even if there are open transactions; shouldn't sql be able to reclaim the
space that was before the LSN of those transactions? I understand that that
portion of the log can't be reclaimed, but shouldn't the older?
> The only other thing I can think of is would have I a transaction that say
starts now and runs for 12 hours, just holding a resource open and not
allowing that portion of the log to be 'checkpointed'?
> Would I just cancel the SPIDS submitting those transactions so that there
are NO transactions occuring? Also why would sql care if it is in simple
recovery mode?
> Thanks for all you help.
> "Andrew J. Kelly" wrote:
> > Well that will sure do it<g>.
> >
> > --
> > Andrew J. Kelly SQL MVP
> >
> >
> > "Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
> > news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...
> > > There were 10 open trans in the DB
> > >
> > > "Andrew J. Kelly" wrote:
> > >
> > > > If there are a lot of VLF's with a status of 2 that means you have
> > > > uncommitted transactions in them. What does DBCC OPENTRAN() say?
> > > >
> > > > --
> > > > Andrew J. Kelly SQL MVP
> > > >
> > > >
> > > > "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in
message
> > > > news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> > > > > Ok, I know there are a TON of threads out there on this but I
still
> > can't
> > > > find exactly what I am looking for.
> > > > >
> > > > > I have a 4GB DB with a 1GB log file. Backups are done nightly and
> > written
> > > > to a NAS via UNC path. When I went home on Friday the log was
200MB --
> > this
> > > > morning it was 1GB. As I stated the recovery model is set to simple
so
> > it
> > > > should just reuse itself. I issued a DBCC loginfo to see that each
part
> > of
> > > > the log was a status 2. I then tried a backup log... with
truncate_only
> > and
> > > > backup log...with no_log. This did not reclaim any space.
> > > > >
> > > > > I have exhausted what I THOUGHT I knew about simple recovery. If
> > anyone
> > > > else has an idea, please post!
> > > > >
> > > > > It has always been my understanding that
> > > >
> > > >
> > > >
> >
> >
> >

Log file won't Shrink in Simple Recovery Mode

Ok, I know there are a TON of threads out there on this but I still can't fi
nd exactly what I am looking for.
I have a 4GB DB with a 1GB log file. Backups are done nightly and written t
o a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it s
hould just reuse itself. I
issued a DBCC loginfo to see that each part of the log was a status 2. I th
en tried a backup log... with truncate_only and backup log...with no_log. T
his did not reclaim any space.
I have exhausted what I THOUGHT I knew about simple recovery. If anyone els
e has an idea, please post!
It has always been my understanding thatIf there are a lot of VLF's with a status of 2 that means you have
uncommitted transactions in them. What does DBCC OPENTRAN() say?
Andrew J. Kelly SQL MVP
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that|||Is there any open transaction? DBCC OPENTRAN.
Was there any replication properties set on for this database?
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that|||There were 10 open trans in the DB
"Andrew J. Kelly" wrote:

> If there are a lot of VLF's with a status of 2 that means you have
> uncommitted transactions in them. What does DBCC OPENTRAN() say?
> --
> Andrew J. Kelly SQL MVP
>
> "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
> news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> find exactly what I am looking for.
> to a NAS via UNC path. When I went home on Friday the log was 200MB -- th
is
> morning it was 1GB. As I stated the recovery model is set to simple so it
> should just reuse itself. I issued a DBCC loginfo to see that each part o
f
> the log was a status 2. I then tried a backup log... with truncate_only a
nd
> backup log...with no_log. This did not reclaim any space.
> else has an idea, please post!
>
>|||Well that will sure do it<g>.
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...[vbcol=seagreen]
> There were 10 open trans in the DB
> "Andrew J. Kelly" wrote:
>
can't[vbcol=seagreen]
written[vbcol=seagreen]
this[vbcol=seagreen]
it[vbcol=seagreen]
of[vbcol=seagreen]
and[vbcol=seagreen]
anyone[vbcol=seagreen]|||There were 10 open.
"Richard Ding" wrote:

> Is there any open transaction? DBCC OPENTRAN.
> Was there any replication properties set on for this database?
> "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
> news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> find exactly what I am looking for.
> to a NAS via UNC path. When I went home on Friday the log was 200MB -- th
is
> morning it was 1GB. As I stated the recovery model is set to simple so it
> should just reuse itself. I issued a DBCC loginfo to see that each part o
f
> the log was a status 2. I then tried a backup log... with truncate_only a
nd
> backup log...with no_log. This did not reclaim any space.
> else has an idea, please post!
>
>|||Yes and no...(I think)
Even if there are open transactions; shouldn't sql be able to reclaim the sp
ace that was before the LSN of those transactions? I understand that that p
ortion of the log can't be reclaimed, but shouldn't the older?
The only other thing I can think of is would have I a transaction that say s
tarts now and runs for 12 hours, just holding a resource open and not allowi
ng that portion of the log to be 'checkpointed'?
Would I just cancel the SPIDS submitting those transactions so that there ar
e NO transactions occuring? Also why would sql care if it is in simple reco
very mode?
Thanks for all you help.
"Andrew J. Kelly" wrote:

> Well that will sure do it<g>.
> --
> Andrew J. Kelly SQL MVP
>
> "Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
> news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...
> can't
> written
> this
> it
> of
> and
> anyone
>
>|||Dave,
A log file works in a round robin format. It starts adding transactions
sequentially from the beginning to the end. Once it gets to the end it will
wrap around only if the first VLF is free and has no uncommitted
transactions. Otherwise it will grow the log and continue on. If you have
an open tran for 12 hours you have some serious issues with your app. A
transaction should ideally be open for seconds at the very most. You
absolutely need to find out who is keeping these trans open and why.
Whether you kill them or not is up to you but you have to either commit them
or roll them back.
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:DD934F0C-13B9-4E67-876E-DB027E285BAF@.microsoft.com...
> Yes and no...(I think)
> Even if there are open transactions; shouldn't sql be able to reclaim the
space that was before the LSN of those transactions? I understand that that
portion of the log can't be reclaimed, but shouldn't the older?
> The only other thing I can think of is would have I a transaction that say
starts now and runs for 12 hours, just holding a resource open and not
allowing that portion of the log to be 'checkpointed'?
> Would I just cancel the SPIDS submitting those transactions so that there
are NO transactions occuring? Also why would sql care if it is in simple
recovery mode?[vbcol=seagreen]
> Thanks for all you help.
> "Andrew J. Kelly" wrote:
>
message[vbcol=seagreen]
still[vbcol=seagreen]
200MB --[vbcol=seagreen]
so[vbcol=seagreen]
part[vbcol=seagreen]
truncate_only[vbcol=seagreen]

Log file won't Shrink in Simple Recovery Mode

Ok, I know there are a TON of threads out there on this but I still can't find exactly what I am looking for.
I have a 4GB DB with a 1GB log file. Backups are done nightly and written to a NAS via UNC path. When I went home on Friday the log was 200MB -- this morning it was 1GB. As I stated the recovery model is set to simple so it should just reuse itself. I
issued a DBCC loginfo to see that each part of the log was a status 2. I then tried a backup log... with truncate_only and backup log...with no_log. This did not reclaim any space.
I have exhausted what I THOUGHT I knew about simple recovery. If anyone else has an idea, please post!
It has always been my understanding that
If there are a lot of VLF's with a status of 2 that means you have
uncommitted transactions in them. What does DBCC OPENTRAN() say?
Andrew J. Kelly SQL MVP
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that
|||Is there any open transaction? DBCC OPENTRAN.
Was there any replication properties set on for this database?
"Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> Ok, I know there are a TON of threads out there on this but I still can't
find exactly what I am looking for.
> I have a 4GB DB with a 1GB log file. Backups are done nightly and written
to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
morning it was 1GB. As I stated the recovery model is set to simple so it
should just reuse itself. I issued a DBCC loginfo to see that each part of
the log was a status 2. I then tried a backup log... with truncate_only and
backup log...with no_log. This did not reclaim any space.
> I have exhausted what I THOUGHT I knew about simple recovery. If anyone
else has an idea, please post!
> It has always been my understanding that
|||There were 10 open trans in the DB
"Andrew J. Kelly" wrote:

> If there are a lot of VLF's with a status of 2 that means you have
> uncommitted transactions in them. What does DBCC OPENTRAN() say?
> --
> Andrew J. Kelly SQL MVP
>
> "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
> news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> find exactly what I am looking for.
> to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
> morning it was 1GB. As I stated the recovery model is set to simple so it
> should just reuse itself. I issued a DBCC loginfo to see that each part of
> the log was a status 2. I then tried a backup log... with truncate_only and
> backup log...with no_log. This did not reclaim any space.
> else has an idea, please post!
>
>
|||Well that will sure do it<g>.
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...[vbcol=seagreen]
> There were 10 open trans in the DB
> "Andrew J. Kelly" wrote:
can't[vbcol=seagreen]
written[vbcol=seagreen]
this[vbcol=seagreen]
it[vbcol=seagreen]
of[vbcol=seagreen]
and[vbcol=seagreen]
anyone[vbcol=seagreen]
|||There were 10 open.
"Richard Ding" wrote:

> Is there any open transaction? DBCC OPENTRAN.
> Was there any replication properties set on for this database?
> "Dave Harper" <Dave Harper@.discussions.microsoft.com> wrote in message
> news:5F3AE072-8C13-444B-9C0B-E21BA3C7F717@.microsoft.com...
> find exactly what I am looking for.
> to a NAS via UNC path. When I went home on Friday the log was 200MB -- this
> morning it was 1GB. As I stated the recovery model is set to simple so it
> should just reuse itself. I issued a DBCC loginfo to see that each part of
> the log was a status 2. I then tried a backup log... with truncate_only and
> backup log...with no_log. This did not reclaim any space.
> else has an idea, please post!
>
>
|||Yes and no...(I think)
Even if there are open transactions; shouldn't sql be able to reclaim the space that was before the LSN of those transactions? I understand that that portion of the log can't be reclaimed, but shouldn't the older?
The only other thing I can think of is would have I a transaction that say starts now and runs for 12 hours, just holding a resource open and not allowing that portion of the log to be 'checkpointed'?
Would I just cancel the SPIDS submitting those transactions so that there are NO transactions occuring? Also why would sql care if it is in simple recovery mode?
Thanks for all you help.
"Andrew J. Kelly" wrote:

> Well that will sure do it<g>.
> --
> Andrew J. Kelly SQL MVP
>
> "Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
> news:9DA36206-3F23-4464-AD81-EABEF886FB82@.microsoft.com...
> can't
> written
> this
> it
> of
> and
> anyone
>
>
|||Dave,
A log file works in a round robin format. It starts adding transactions
sequentially from the beginning to the end. Once it gets to the end it will
wrap around only if the first VLF is free and has no uncommitted
transactions. Otherwise it will grow the log and continue on. If you have
an open tran for 12 hours you have some serious issues with your app. A
transaction should ideally be open for seconds at the very most. You
absolutely need to find out who is keeping these trans open and why.
Whether you kill them or not is up to you but you have to either commit them
or roll them back.
Andrew J. Kelly SQL MVP
"Dave Harper" <DaveHarper@.discussions.microsoft.com> wrote in message
news:DD934F0C-13B9-4E67-876E-DB027E285BAF@.microsoft.com...
> Yes and no...(I think)
> Even if there are open transactions; shouldn't sql be able to reclaim the
space that was before the LSN of those transactions? I understand that that
portion of the log can't be reclaimed, but shouldn't the older?
> The only other thing I can think of is would have I a transaction that say
starts now and runs for 12 hours, just holding a resource open and not
allowing that portion of the log to be 'checkpointed'?
> Would I just cancel the SPIDS submitting those transactions so that there
are NO transactions occuring? Also why would sql care if it is in simple
recovery mode?[vbcol=seagreen]
> Thanks for all you help.
> "Andrew J. Kelly" wrote:
message[vbcol=seagreen]
still[vbcol=seagreen]
200MB --[vbcol=seagreen]
so[vbcol=seagreen]
part[vbcol=seagreen]
truncate_only[vbcol=seagreen]

Log file won't shrink

We're having a problem with one log file which refuses to be shrunk.
First off we have a problem with the fact that the log keeps growing way too
much, something that I have to look into, but besides that, I've tried to
shrink it down as it will end up eating up all the available disk space,
eventually.
I heard that DBCC SHRINKFILE will create dummy transactions in order to get
the log file to recycle, so that it will shrink, but it doesn't seem to want
to do that.
I've tried performing BACKUP LOG with various options and then trying to
shrink the log file, all to no avail.
Any hints or suggestions welcome as to how I can force this overgrown log
file back down to a more reasonable size.
Michael MacGregor
Database Architect
Are you using the syntax:
DBCC SHRINKFILE (fileName, TRUNCATEONLY)

>From BOL:
TRUNCATEONLY
Causes any unused space in the files to be released to the operating
system and shrinks the file to the last allocated extent, reducing the
file size without moving any data. No attempt is made to relocate rows
to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
WITH
DBCC SHRINKFILE
(
{ 'file_name' | file_id }
{ [ , EMPTYFILE ]
| [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
}
)
[ WITH NO_INFOMSGS ]
Michael MacGregor wrote:
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way too
> much, something that I have to look into, but besides that, I've tried to
> shrink it down as it will end up eating up all the available disk space,
> eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to get
> the log file to recycle, so that it will shrink, but it doesn't seem to want
> to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect
|||Michael,
Is your log unrestricted? If it is then give it a maximum otherwise (under
SQL2005 and maybe SQL2000) it will keep on growing.
Chris
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uNI12wd$GHA.4292@.TK2MSFTNGP02.phx.gbl...
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way
> too much, something that I have to look into, but besides that, I've tried
> to shrink it down as it will end up eating up all the available disk
> space, eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to
> get the log file to recycle, so that it will shrink, but it doesn't seem
> to want to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect
>
|||Yes.
<tootsuite@.gmail.com> wrote in message
news:1162403350.700370.279630@.e64g2000cwd.googlegr oups.com...
> Are you using the syntax:
> DBCC SHRINKFILE (fileName, TRUNCATEONLY)
>
> TRUNCATEONLY
> Causes any unused space in the files to be released to the operating
> system and shrinks the file to the last allocated extent, reducing the
> file size without moving any data. No attempt is made to relocate rows
> to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
> WITH
> DBCC SHRINKFILE
> (
> { 'file_name' | file_id }
> { [ , EMPTYFILE ]
> | [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
> }
> )
> [ WITH NO_INFOMSGS ]
>
> Michael MacGregor wrote:
>
|||I'm actually not bothered by that, what is concerning me right now is that I
can't get it to shrink, the continual growth issue is not a concern right
now, as I believe I know what is causing that anyway and I have to deal with
that rather than restrict the log growth.
I have queries sys.databases and it is telling me that the
log_reuse_wait_desc is REPLICATION, but so far am going round in circles
trying to figure out why and what to do about it.
Michael MacGregor
Database Architect
|||Fixed it! There was a replication transaction still open.
Michael MacGregor
Database Architect
sql

Log file won't shrink

We're having a problem with one log file which refuses to be shrunk.
First off we have a problem with the fact that the log keeps growing way too
much, something that I have to look into, but besides that, I've tried to
shrink it down as it will end up eating up all the available disk space,
eventually.
I heard that DBCC SHRINKFILE will create dummy transactions in order to get
the log file to recycle, so that it will shrink, but it doesn't seem to want
to do that.
I've tried performing BACKUP LOG with various options and then trying to
shrink the log file, all to no avail.
Any hints or suggestions welcome as to how I can force this overgrown log
file back down to a more reasonable size.
Michael MacGregor
Database ArchitectAre you using the syntax:
DBCC SHRINKFILE (fileName, TRUNCATEONLY)

>From BOL:
TRUNCATEONLY
Causes any unused space in the files to be released to the operating
system and shrinks the file to the last allocated extent, reducing the
file size without moving any data. No attempt is made to relocate rows
to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
WITH
DBCC SHRINKFILE
(
{ 'file_name' | file_id }
{ [ , EMPTYFILE ]
| [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
}
)
[ WITH NO_INFOMSGS ]
Michael MacGregor wrote:
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way t
oo
> much, something that I have to look into, but besides that, I've tried to
> shrink it down as it will end up eating up all the available disk space,
> eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to ge
t
> the log file to recycle, so that it will shrink, but it doesn't seem to wa
nt
> to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect|||Michael,
Is your log unrestricted? If it is then give it a maximum otherwise (under
SQL2005 and maybe SQL2000) it will keep on growing.
Chris
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uNI12wd$GHA.4292@.TK2MSFTNGP02.phx.gbl...
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way
> too much, something that I have to look into, but besides that, I've tried
> to shrink it down as it will end up eating up all the available disk
> space, eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to
> get the log file to recycle, so that it will shrink, but it doesn't seem
> to want to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect
>|||Yes.
<tootsuite@.gmail.com> wrote in message
news:1162403350.700370.279630@.e64g2000cwd.googlegroups.com...
> Are you using the syntax:
> DBCC SHRINKFILE (fileName, TRUNCATEONLY)
>
> TRUNCATEONLY
> Causes any unused space in the files to be released to the operating
> system and shrinks the file to the last allocated extent, reducing the
> file size without moving any data. No attempt is made to relocate rows
> to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
> WITH
> DBCC SHRINKFILE
> (
> { 'file_name' | file_id }
> { [ , EMPTYFILE ]
> | [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY
} ] ]
> }
> )
> [ WITH NO_INFOMSGS ]
>
> Michael MacGregor wrote:
>|||I'm actually not bothered by that, what is concerning me right now is that I
can't get it to shrink, the continual growth issue is not a concern right
now, as I believe I know what is causing that anyway and I have to deal with
that rather than restrict the log growth.
I have queries sys.databases and it is telling me that the
log_reuse_wait_desc is REPLICATION, but so far am going round in circles
trying to figure out why and what to do about it.
Michael MacGregor
Database Architect|||Michael MacGregor wrote:
> I'm actually not bothered by that, what is concerning me right now is that
I
> can't get it to shrink, the continual growth issue is not a concern right
> now, as I believe I know what is causing that anyway and I have to deal wi
th
> that rather than restrict the log growth.
> I have queries sys.databases and it is telling me that the
> log_reuse_wait_desc is REPLICATION, but so far am going round in circles
> trying to figure out why and what to do about it.
> Michael MacGregor
> Database Architect
>
That would seem to be telling you that this database is involved in
replication, which would explain why the log won't truncate.
Transactions can't be flushed from the log if they haven't been
replicated yet.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I gathered that from the info in BOL, but I haven't figured out how to flush
that, or stop the replication.
Michael MacGregor
Database Architect|||Fixed it! There was a replication transaction still open.
Michael MacGregor
Database Architect

Log file won't shrink

We're having a problem with one log file which refuses to be shrunk.
First off we have a problem with the fact that the log keeps growing way too
much, something that I have to look into, but besides that, I've tried to
shrink it down as it will end up eating up all the available disk space,
eventually.
I heard that DBCC SHRINKFILE will create dummy transactions in order to get
the log file to recycle, so that it will shrink, but it doesn't seem to want
to do that.
I've tried performing BACKUP LOG with various options and then trying to
shrink the log file, all to no avail.
Any hints or suggestions welcome as to how I can force this overgrown log
file back down to a more reasonable size.
Michael MacGregor
Database ArchitectAre you using the syntax:
DBCC SHRINKFILE (fileName, TRUNCATEONLY)
>From BOL:
TRUNCATEONLY
Causes any unused space in the files to be released to the operating
system and shrinks the file to the last allocated extent, reducing the
file size without moving any data. No attempt is made to relocate rows
to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
WITH
DBCC SHRINKFILE
(
{ 'file_name' | file_id }
{ [ , EMPTYFILE ]
| [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
}
)
[ WITH NO_INFOMSGS ]
Michael MacGregor wrote:
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way too
> much, something that I have to look into, but besides that, I've tried to
> shrink it down as it will end up eating up all the available disk space,
> eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to get
> the log file to recycle, so that it will shrink, but it doesn't seem to want
> to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect|||Michael,
Is your log unrestricted? If it is then give it a maximum otherwise (under
SQL2005 and maybe SQL2000) it will keep on growing.
Chris
"Michael MacGregor" <nospam@.nospam.com> wrote in message
news:uNI12wd$GHA.4292@.TK2MSFTNGP02.phx.gbl...
> We're having a problem with one log file which refuses to be shrunk.
> First off we have a problem with the fact that the log keeps growing way
> too much, something that I have to look into, but besides that, I've tried
> to shrink it down as it will end up eating up all the available disk
> space, eventually.
> I heard that DBCC SHRINKFILE will create dummy transactions in order to
> get the log file to recycle, so that it will shrink, but it doesn't seem
> to want to do that.
> I've tried performing BACKUP LOG with various options and then trying to
> shrink the log file, all to no avail.
> Any hints or suggestions welcome as to how I can force this overgrown log
> file back down to a more reasonable size.
> Michael MacGregor
> Database Architect
>|||Yes.
<tootsuite@.gmail.com> wrote in message
news:1162403350.700370.279630@.e64g2000cwd.googlegroups.com...
> Are you using the syntax:
> DBCC SHRINKFILE (fileName, TRUNCATEONLY)
>>From BOL:
> TRUNCATEONLY
> Causes any unused space in the files to be released to the operating
> system and shrinks the file to the last allocated extent, reducing the
> file size without moving any data. No attempt is made to relocate rows
> to unallocated pages. target_size is ignored when TRUNCATEONLY is used.
> WITH
> DBCC SHRINKFILE
> (
> { 'file_name' | file_id }
> { [ , EMPTYFILE ]
> | [ [ , target_size ] [ , { NOTRUNCATE | TRUNCATEONLY } ] ]
> }
> )
> [ WITH NO_INFOMSGS ]
>
> Michael MacGregor wrote:
>> We're having a problem with one log file which refuses to be shrunk.
>> First off we have a problem with the fact that the log keeps growing way
>> too
>> much, something that I have to look into, but besides that, I've tried to
>> shrink it down as it will end up eating up all the available disk space,
>> eventually.
>> I heard that DBCC SHRINKFILE will create dummy transactions in order to
>> get
>> the log file to recycle, so that it will shrink, but it doesn't seem to
>> want
>> to do that.
>> I've tried performing BACKUP LOG with various options and then trying to
>> shrink the log file, all to no avail.
>> Any hints or suggestions welcome as to how I can force this overgrown log
>> file back down to a more reasonable size.
>> Michael MacGregor
>> Database Architect
>|||I'm actually not bothered by that, what is concerning me right now is that I
can't get it to shrink, the continual growth issue is not a concern right
now, as I believe I know what is causing that anyway and I have to deal with
that rather than restrict the log growth.
I have queries sys.databases and it is telling me that the
log_reuse_wait_desc is REPLICATION, but so far am going round in circles
trying to figure out why and what to do about it.
Michael MacGregor
Database Architect|||Michael MacGregor wrote:
> I'm actually not bothered by that, what is concerning me right now is that I
> can't get it to shrink, the continual growth issue is not a concern right
> now, as I believe I know what is causing that anyway and I have to deal with
> that rather than restrict the log growth.
> I have queries sys.databases and it is telling me that the
> log_reuse_wait_desc is REPLICATION, but so far am going round in circles
> trying to figure out why and what to do about it.
> Michael MacGregor
> Database Architect
>
That would seem to be telling you that this database is involved in
replication, which would explain why the log won't truncate.
Transactions can't be flushed from the log if they haven't been
replicated yet.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||I gathered that from the info in BOL, but I haven't figured out how to flush
that, or stop the replication.
Michael MacGregor
Database Architect|||Fixed it! There was a replication transaction still open.
Michael MacGregor
Database Architect

Friday, March 23, 2012

log file size and mirroring

How do I shrink a log file in a database that's been mirrored?

DBCC ShrinkFile(id) reports the size can drop considerably, but even after a CHECKPOINT, it doesn't shrink.

DBCC ShrinkFile('name') says it doesn't find the file name. The properties dialog for the database in SSMS doesn't list any files, even though sp_helpdb says they're there.

Must I disable mirroring, fix DBCC ShrinkSomething, then re-enable mirroring? Can I just pause mirroring?

There are 2 options available for you,

1.

USE XXX
GO
CHECKPOINT
GO
BACKUP LOG [XXX] TO [XXX_TLOG] WITH NOFORMAT, INIT, NAME = N'XXX-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
DBCC SHRINKFILE(XXX_Log, 1)
GO

2.

BACKUP LOG [dbname] TO DISK='Path'

Then do the shrink

dbcc shrinkfile ('TLOGFILENAME', yoursize) -- where yoursize is a number in MB

Since the CHECKPOINT option didnt work for you, try the 2nd option and revert if you have any concern

|||Thanks for responding, Deepak.

I'm sorry if my question was not clear. I've tried both of the techniques you suggest and the database log file doesn't shrink.

The log_reuse_wait_desc column in sys.databases says "NOTHING" for the invovled database.

Why doesn't SQL server release the log file space to the OS?
|||

May I ask a question related issue? Is the participal database should be pause before shrinking?

Regards,

Melih

|||

Deepak,

I tried to run query and I get message following:

Cannot shrink log file 2 (XXX_log) because all logical log files are in use.

Deepak Rangarajan wrote:

There are 2 options available for you,

1.

USE XXX
GO
CHECKPOINT
GO
BACKUP LOG [XXX] TO [XXX_TLOG] WITH NOFORMAT, INIT, NAME = N'XXX-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
DBCC SHRINKFILE(XXX_Log, 1)
GO

2.

BACKUP LOG [dbname] TO DISK='Path'

Then do the shrink

dbcc shrinkfile ('TLOGFILENAME', yoursize) -- where yoursize is a number in MB

Since the CHECKPOINT option didnt work for you, try the 2nd option and revert if you have any concern

log file size and mirroring

How do I shrink a log file in a database that's been mirrored?

DBCC ShrinkFile(id) reports the size can drop considerably, but even after a CHECKPOINT, it doesn't shrink.

DBCC ShrinkFile('name') says it doesn't find the file name. The properties dialog for the database in SSMS doesn't list any files, even though sp_helpdb says they're there.

Must I disable mirroring, fix DBCC ShrinkSomething, then re-enable mirroring? Can I just pause mirroring?

There are 2 options available for you,

1.

USE XXX
GO
CHECKPOINT
GO
BACKUP LOG [XXX] TO [XXX_TLOG] WITH NOFORMAT, INIT, NAME = N'XXX-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
DBCC SHRINKFILE(XXX_Log, 1)
GO

2.

BACKUP LOG [dbname] TO DISK='Path'

Then do the shrink

dbcc shrinkfile ('TLOGFILENAME', yoursize) -- where yoursize is a number in MB

Since the CHECKPOINT option didnt work for you, try the 2nd option and revert if you have any concern

|||Thanks for responding, Deepak.

I'm sorry if my question was not clear. I've tried both of the techniques you suggest and the database log file doesn't shrink.

The log_reuse_wait_desc column in sys.databases says "NOTHING" for the invovled database.

Why doesn't SQL server release the log file space to the OS?
|||

May I ask a question related issue? Is the participal database should be pause before shrinking?

Regards,

Melih

|||

Deepak,

I tried to run query and I get message following:

Cannot shrink log file 2 (XXX_log) because all logical log files are in use.

Deepak Rangarajan wrote:

There are 2 options available for you,

1.

USE XXX
GO
CHECKPOINT
GO
BACKUP LOG [XXX] TO [XXX_TLOG] WITH NOFORMAT, INIT, NAME = N'XXX-Transaction Log Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
DBCC SHRINKFILE(XXX_Log, 1)
GO

2.

BACKUP LOG [dbname] TO DISK='Path'

Then do the shrink

dbcc shrinkfile ('TLOGFILENAME', yoursize) -- where yoursize is a number in MB

Since the CHECKPOINT option didnt work for you, try the 2nd option and revert if you have any concern

sql

Wednesday, March 21, 2012

Log file Shrinking

how can we shrink the log file to the required size without affecting the live database ....
Thanks in advanceI hope it can help you:

--Truncating the transaction log
BACKUP LOG { database_name | @.database_name_var }
{
WITH
{ NO_LOG | TRUNCATE_ONLY } ]
}

NO_LOG | TRUNCATE_ONLY
Removes the inactive part of the log without making a backup copy of it and truncates the log by discarding all but the active log. This option frees space. Specifying a backup device is unnecessary because the log backup is not saved. NO_LOG and TRUNCATE_ONLY are synonyms.

Regards
Kris Zywczyk|||It is working.Thanks for this

Log File Shrink

BigSam wrote:
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive. I'
ve
> tried to shrink the file & it says it is successful, but I cannot shrink i
t
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam
I had a heap of trouble with the same problem one day. When I found
the solution, I saved the steps. Here they are:
1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
2) Backup Log <dbname> With Truncate_Only
3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
That should fix it.
MikeI'm unable to shrink my log file. The databse is about 2 GB & the log file
has grown to 11.5 GB. I've run transaction backups every 3 hours, but the lo
g
won't shrink. I need to reduce the size, to free up space on the drive. I've
tried to shrink the file & it says it is successful, but I cannot shrink it
enough. I've tried changing the recovery model to Simple & then shrinking th
e
log, but this doesn't work either.
Any suggestions will be appreciated.
BigSam|||BigSam wrote:
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive. I'
ve
> tried to shrink the file & it says it is successful, but I cannot shrink i
t
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam
I had a heap of trouble with the same problem one day. When I found
the solution, I saved the steps. Here they are:
1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
2) Backup Log <dbname> With Truncate_Only
3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
That should fix it.
Mike|||Sam,
If what Mike wrote doesn't help (and only as a last resort):
First, iiii Be sure to take a full backup of the database!!!!
Then, change the recovery mode to simple.
Next issue the syntax CHECKPOINT in Query Analyzer on that server then
issue DBCC Shrinkfile (<logfilename>, TruncateOnly).
Last, set your recovery mode back to Full.
SQLPoet
MikeR wrote:
> BigSam wrote:
> --
> I had a heap of trouble with the same problem one day. When I found
> the solution, I saved the steps. Here they are:
> 1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> 2) Backup Log <dbname> With Truncate_Only
> 3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> That should fix it.
> Mike|||Read about backup and especially recovery model in Books Online, Them this w
ill probably help:
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"BigSam" <BigSam@.discussions.microsoft.com> wrote in message
news:7C3F7F32-36EF-49C3-B83C-FCE89FDF4147@.microsoft.com...
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive. I'
ve
> tried to shrink the file & it says it is successful, but I cannot shrink i
t
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam|||Sam,
If what Mike wrote doesn't help (and only as a last resort):
First, iiii Be sure to take a full backup of the database!!!!
Then, change the recovery mode to simple.
Next issue the syntax CHECKPOINT in Query Analyzer on that server then
issue DBCC Shrinkfile (<logfilename>, TruncateOnly).
Last, set your recovery mode back to Full.
SQLPoet
MikeR wrote:
> BigSam wrote:
> --
> I had a heap of trouble with the same problem one day. When I found
> the solution, I saved the steps. Here they are:
> 1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> 2) Backup Log <dbname> With Truncate_Only
> 3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> That should fix it.
> Mike|||Read about backup and especially recovery model in Books Online, Them this w
ill probably help:
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"BigSam" <BigSam@.discussions.microsoft.com> wrote in message
news:7C3F7F32-36EF-49C3-B83C-FCE89FDF4147@.microsoft.com...
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive. I'
ve
> tried to shrink the file & it says it is successful, but I cannot shrink i
t
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam|||"BigSam" <BigSam@.discussions.microsoft.com> wrote in message
news:7C3F7F32-36EF-49C3-B83C-FCE89FDF4147@.microsoft.com...
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive.
I've
> tried to shrink the file & it says it is successful, but I cannot shrink
it
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
Do a DBCC OPENTRAN on the database and make sure there are no open
transactions.
But it'snot clear to me if youmean the log is 11.5 gb and FULL or 11.5GB on
disk, but only partially full.

> BigSamsql

Log File Shrink

I'm unable to shrink my log file. The databse is about 2 GB & the log file
has grown to 11.5 GB. I've run transaction backups every 3 hours, but the log
won't shrink. I need to reduce the size, to free up space on the drive. I've
tried to shrink the file & it says it is successful, but I cannot shrink it
enough. I've tried changing the recovery model to Simple & then shrinking the
log, but this doesn't work either.
Any suggestions will be appreciated.
BigSamBigSam wrote:
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the log
> won't shrink. I need to reduce the size, to free up space on the drive. I've
> tried to shrink the file & it says it is successful, but I cannot shrink it
> enough. I've tried changing the recovery model to Simple & then shrinking the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam
--
I had a heap of trouble with the same problem one day. When I found
the solution, I saved the steps. Here they are:
1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
2) Backup Log <dbname> With Truncate_Only
3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
That should fix it.
Mike|||Sam,
If what Mike wrote doesn't help (and only as a last resort):
First, iiii Be sure to take a full backup of the database!!!!
Then, change the recovery mode to simple.
Next issue the syntax CHECKPOINT in Query Analyzer on that server then
issue DBCC Shrinkfile (<logfilename>, TruncateOnly).
Last, set your recovery mode back to Full.
SQLPoet
MikeR wrote:
> BigSam wrote:
> > I'm unable to shrink my log file. The databse is about 2 GB & the log file
> > has grown to 11.5 GB. I've run transaction backups every 3 hours, but the log
> > won't shrink. I need to reduce the size, to free up space on the drive. I've
> > tried to shrink the file & it says it is successful, but I cannot shrink it
> > enough. I've tried changing the recovery model to Simple & then shrinking the
> > log, but this doesn't work either.
> > Any suggestions will be appreciated.
> >
> > BigSam
> --
> I had a heap of trouble with the same problem one day. When I found
> the solution, I saved the steps. Here they are:
> 1) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> 2) Backup Log <dbname> With Truncate_Only
> 3) DBCC Shrinkfile (<logfilename>, TruncateOnly)
> That should fix it.
> Mike|||Read about backup and especially recovery model in Books Online, Them this will probably help:
http://www.karaszi.com/SQLServer/info_dont_shrink.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"BigSam" <BigSam@.discussions.microsoft.com> wrote in message
news:7C3F7F32-36EF-49C3-B83C-FCE89FDF4147@.microsoft.com...
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the log
> won't shrink. I need to reduce the size, to free up space on the drive. I've
> tried to shrink the file & it says it is successful, but I cannot shrink it
> enough. I've tried changing the recovery model to Simple & then shrinking the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
> BigSam|||"BigSam" <BigSam@.discussions.microsoft.com> wrote in message
news:7C3F7F32-36EF-49C3-B83C-FCE89FDF4147@.microsoft.com...
> I'm unable to shrink my log file. The databse is about 2 GB & the log file
> has grown to 11.5 GB. I've run transaction backups every 3 hours, but the
log
> won't shrink. I need to reduce the size, to free up space on the drive.
I've
> tried to shrink the file & it says it is successful, but I cannot shrink
it
> enough. I've tried changing the recovery model to Simple & then shrinking
the
> log, but this doesn't work either.
> Any suggestions will be appreciated.
Do a DBCC OPENTRAN on the database and make sure there are no open
transactions.
But it'snot clear to me if youmean the log is 11.5 gb and FULL or 11.5GB on
disk, but only partially full.
> BigSam

Log file of sql server 2000 is too big, how to shrink or clear it?

Hi,
My DB file (.ldf) is only 3 Mb, while the log file's size is almost 30 Mb,
how can I shrink or clear this log file to make it small?
Thanks!30mb is not really big, to adjust size do the following.
Open up Enterprise Manager scroll down to the database in question.
Right click db - click on properties - choose the option tab.
In the recovery panel make sure it's set to Simple rather than Full.
Apply changes and exit db properties.
Then you can now manually shrink the database via the All Tasks menu.
Have fun|||Thank u very much, it works as I expected!
"Greentko" <greentko@.hotmail.com> wrote in message
news:eFK2h19sDHA.3236@.tk2msftngp13.phx.gbl...
> 30mb is not really big, to adjust size do the following.
> Open up Enterprise Manager scroll down to the database in question.
> Right click db - click on properties - choose the option tab.
> In the recovery panel make sure it's set to Simple rather than Full.
> Apply changes and exit db properties.
> Then you can now manually shrink the database via the All Tasks menu.
> Have fun
>|||As Greenko say, 30 MB is nothing. It might just grow back the same size next time you do some batch
operation. However:
Check out below KB articles:
INF: How to Shrink the SQL Server 7.0 Transaction Log
http://support.microsoft.com/default.aspx?scid=kb;en-us;256650
INF: Shrinking the Transaction Log in SQL Server 2000 with DBCC SHRINKFILE
http://support.microsoft.com/default.aspx?scid=kb;en-us;272318
Log File Grows too big
http://www.support.microsoft.com/?id=317375
Log file filling up
http://www.support.microsoft.com/?id=110139
Considerations for Autogrow and AutoShrink
http://www.support.microsoft.com/?id=315512
http://www.mssqlserver.com/faq/logs-shrinklog.asp
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"VVIPI" <vvipi@.hotmail.com> wrote in message news:uUwMbW8sDHA.628@.tk2msftngp13.phx.gbl...
> Hi,
> My DB file (.ldf) is only 3 Mb, while the log file's size is almost 30 Mb,
> how can I shrink or clear this log file to make it small?
> Thanks!
>
>

LOG FILE ISSUE - NewBie

I have some Log files that are getting extremely large as I teach myself the importing/Exporting/Tranformation 's and such. I need to shrink the Log file to a manageable size. The data file is 16gig and the log file is 16gig. Help..dbcc shrinkfile(...) Look it up in BOL|||Consider also:

1. Backup the database and then make log file backups. Run a log file backup after doing an import.

2. Or, set your recovery model to SIMPLE (SQL 2000) or Trunc. Log on Checkpoint (SQL 7).

Regards,

hmscott

Monday, March 19, 2012

Log file is full

I am using Simple Recover model for my database

Initial size of log file is 1 MB and auto growth is set to by 10%, unrestricted growth.

auto shrink property is set TRUE

i m using SSIS package to copy some data from one table to another ( in same database)

my package fails saying "The log file for database 'WebInterfaceData' is full. Back up the transaction log for the database to free up some log space."

i dont see ne reason y it is fail as i have set up autogrowth to incease by 10%

FYI. there nothing to deal with SSIS as when I try to run simple SQL statement in Management studio it also fails complaining about same error after package execution

can ne one help me in this regard?

thanx

Anas

How large is the transaction log? Run the query below to find out:

SELECT name AS 'File Name' , physical_name AS 'Physical Name', size/128 AS 'Total Size in MB',
size/128.0 - CAST(FILEPROPERTY(name, 'SpaceUsed') AS int)/128.0 AS 'Available Space In MB', *
FROM sys.database_files;

It sounds like you might have some long running transaction that is not letting the log get checkpointed, so that it can be truncated.

Does the problem go away (for a while at least) if you stop and start SQL Server?

|||

have u configured maxsize ?

select *from sysfiles

sp_helpfile

post the result

Madhu

|||

Obviously check the space on the disk that the logfile is on (I would assume that it is not full).

The other thing to watch out for is a disk quota of some description on the service account being used for SQL Server. This looks to SQL Server the same as a disk full error.

You might like to look in the logs for a System Error 112 (ERROR_DISK_FULL) which will be a symptom of either of these problems.

|||

Madhu K Nair wrote:

have u configured maxsize ?

select *from sysfiles

sp_helpfile

post the result

Madhu

the result of query is that and max size is set to -1 (means no max size)

1 1 47312 -1 10 1081346 0 WebInterfaceData_Data D:\SQL\MSSQL\data\WebInterfaceData_Data.MDF

2 0 2560 -1 10 1081410 0 WebInterfaceData_Log D:\SQL\MSSQL\data\WebInterfaceData_Log.LDF

Plus there is no issue like disk space

thanx,

Anas

Log File growing urgent Please

Hei,
Log file is growing very fast (Log file size is now more then 3GB and data
file size is not more then 1GB) and i want to shrink log file using this
command
use modbt
go
DBCC SHRINKFILE (modbt, 20)
go
OR
DBCC SHRINKFILE (modbt_Log, 20)
but getting error
Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'modbt_log' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
I run sp_helpfile and get result
Name fileid Filename Filegroup Size Maxzie
growth usege
1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited 10%
data
2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
10% log
I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one using
database that time. STATUS '0' for more then 300 line.
When i run DBCC SHRINKFILE (Axc_log, 20) then got
DbId Field CurrentSize MinimumSize Used Pages EstimatedPages
1: 7 2 446992 63 446992 56
Can any one help me what will be problem? I have backup plan full but i did
not check and it was not working so this happened with my database. Now it is
working please help me.
Nina Paul
Paul
BACKUP LOG file and then DBCC SHRINKFILE command
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9FBC8F5E-38B8-4115-8760-E7A334E62A06@.microsoft.com...
> Hei,
> Log file is growing very fast (Log file size is now more then 3GB and data
> file size is not more then 1GB) and i want to shrink log file using this
> command
> use modbt
> go
> DBCC SHRINKFILE (modbt, 20)
> go
> OR
> DBCC SHRINKFILE (modbt_Log, 20)
> but getting error
> Server: Msg 8985, Level 16, State 1, Line 1
> Could not locate file 'modbt_log' in sysfiles.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> I run sp_helpfile and get result
> Name fileid Filename Filegroup Size Maxzie
> growth usege
> 1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited
> 10%
> data
> 2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
> 10% log
> I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one
> using
> database that time. STATUS '0' for more then 300 line.
> When i run DBCC SHRINKFILE (Axc_log, 20) then got
> DbId Field CurrentSize MinimumSize Used Pages
> EstimatedPages
> 1: 7 2 446992 63 446992
> 56
>
> Can any one help me what will be problem? I have backup plan full but i
> did
> not check and it was not working so this happened with my database. Now it
> is
> working please help me.
> Nina Paul

Log File growing urgent Please

Hei,
Log file is growing very fast (Log file size is now more then 3GB and data
file size is not more then 1GB) and i want to shrink log file using this
command
use modbt
go
DBCC SHRINKFILE (modbt, 20)
go
OR
DBCC SHRINKFILE (modbt_Log, 20)
but getting error
Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'modbt_log' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
I run sp_helpfile and get result
Name fileid Filename Filegroup Size Maxzie
growth usege
1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited 10%
data
2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
10% log
I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one using
database that time. STATUS '0' for more then 300 line.
When i run DBCC SHRINKFILE (Axc_log, 20) then got
DbId Field CurrentSize MinimumSize Used Pages EstimatedPages
1: 7 2 446992 63 446992 56
Can any one help me what will be problem? I have backup plan full but i did
not check and it was not working so this happened with my database. Now it i
s
working please help me.
Nina PaulPaul
BACKUP LOG file and then DBCC SHRINKFILE command
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9FBC8F5E-38B8-4115-8760-E7A334E62A06@.microsoft.com...
> Hei,
> Log file is growing very fast (Log file size is now more then 3GB and data
> file size is not more then 1GB) and i want to shrink log file using this
> command
> use modbt
> go
> DBCC SHRINKFILE (modbt, 20)
> go
> OR
> DBCC SHRINKFILE (modbt_Log, 20)
> but getting error
> Server: Msg 8985, Level 16, State 1, Line 1
> Could not locate file 'modbt_log' in sysfiles.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> I run sp_helpfile and get result
> Name fileid Filename Filegroup Size Maxzie
> growth usege
> 1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited
> 10%
> data
> 2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
> 10% log
> I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one
> using
> database that time. STATUS '0' for more then 300 line.
> When i run DBCC SHRINKFILE (Axc_log, 20) then got
> DbId Field CurrentSize MinimumSize Used Pages
> EstimatedPages
> 1: 7 2 446992 63 446992
> 56
>
> Can any one help me what will be problem? I have backup plan full but i
> did
> not check and it was not working so this happened with my database. Now it
> is
> working please help me.
> Nina Paul

Log File growing urgent Please

Hei,
Log file is growing very fast (Log file size is now more then 3GB and data
file size is not more then 1GB) and i want to shrink log file using this
command
use modbt
go
DBCC SHRINKFILE (modbt, 20)
go
OR
DBCC SHRINKFILE (modbt_Log, 20)
but getting error
Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'modbt_log' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your
system administrator.
I run sp_helpfile and get result
Name fileid Filename Filegroup Size Maxzie
growth usege
1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited 10%
data
2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
10% log
I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one using
database that time. STATUS '0' for more then 300 line.
When i run DBCC SHRINKFILE (Axc_log, 20) then got
DbId Field CurrentSize MinimumSize Used Pages EstimatedPages
1: 7 2 446992 63 446992 56
Can any one help me what will be problem? I have backup plan full but i did
not check and it was not working so this happened with my database. Now it is
working please help me.
Nina PaulPaul
BACKUP LOG file and then DBCC SHRINKFILE command
"Paul" <Paul@.discussions.microsoft.com> wrote in message
news:9FBC8F5E-38B8-4115-8760-E7A334E62A06@.microsoft.com...
> Hei,
> Log file is growing very fast (Log file size is now more then 3GB and data
> file size is not more then 1GB) and i want to shrink log file using this
> command
> use modbt
> go
> DBCC SHRINKFILE (modbt, 20)
> go
> OR
> DBCC SHRINKFILE (modbt_Log, 20)
> but getting error
> Server: Msg 8985, Level 16, State 1, Line 1
> Could not locate file 'modbt_log' in sysfiles.
> DBCC execution completed. If DBCC printed error messages, contact your
> system administrator.
> I run sp_helpfile and get result
> Name fileid Filename Filegroup Size Maxzie
> growth usege
> 1 Axc_Data 1 D:\....\Modbt.mdf Primary 850688KB unlimited
> 10%
> data
> 2 Axc_log 2 E:\....\Modbt.mdf Null 3575936KB unlimited
> 10% log
> I run DBCC LOGINFO('modbt') and get STATUS '2' for 40 line but no one
> using
> database that time. STATUS '0' for more then 300 line.
> When i run DBCC SHRINKFILE (Axc_log, 20) then got
> DbId Field CurrentSize MinimumSize Used Pages
> EstimatedPages
> 1: 7 2 446992 63 446992
> 56
>
> Can any one help me what will be problem? I have backup plan full but i
> did
> not check and it was not working so this happened with my database. Now it
> is
> working please help me.
> Nina Paul

Log File Full

My production database is very big in size and due to contious transactions, my log file becomes full frequently. I manually shrink log file when it becomes large. But i believe shrinking many times is not a good practise in terms of performance. So what should i do? Can anyone suggest a better approach.

How much frequency are you taking backup of transaction log ?

For example, if you are taking transaction log backup every 30 minutes, change it to every 15 minutes.

Thanks

Naras.

|||

Yes, you rightly said that shrinking is not a good practice. You should control the growth of Transaction log and if space is not there in the current drive, you should shift TL to a better place. You can control the growth by taking backup of transaction log more frequently. When you shrink the transaciton log the backup chain breaks. so the first thing you do should be full backup. If you dont want point in time restore you can change the recovery model to simple which will restirct the gwoth of TL to a certain limit.

How to stop the transaction log of a SQL Server database from growing unexpectedly

http://support.microsoft.com/kb/873235.

Madhu

|||I take trn log backup every 2 hours. As i want point in time restore, i need to take tl back up atleast 2 hr.|||But if i don't shrink it grows beyond 2 GB in week. I need a poin in time restore so i had to keep full recovery model.|||

what is the frequency of TL backup of this database.

Madhu

|||Every 2 hr TL Backup, daily Diff backup and weekly Full backup.|||

You can still achieve a point in time restore, even if you take transaction log backup every 30/60/90/120 minutes.

Thanks

Naras.

|||

schedule TL backup more frequently... say every 15 min... this is the better approach

Madhu

|||

http://www.sql-server-performance.com/faq/sqlviewfaq.aspx?faqid=263

http://www.karaszi.com/SQLServer/info_dont_shrink.asp

Addition to Madhu's references.

Monday, March 12, 2012

Log file dosen't shrink

Hi,
In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
trying to shrink it and it doesn't, Any suggestions?
What do you do to shrink it? First of all you need to backup the log file to
truncate it and then you can shrink it. You can look up further info by
looking for Shrinking The Transaction Log in Books On Line.
Regards
Steen
Moshe wrote:
> Hi,
> In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
> trying to shrink it and it doesn't, Any suggestions?
|||Backup the log and then try the shrinkfile. You can check
the active sections of the log using dbcc loginfo(YourDB) .
The status indicates which virtual log files are active
where the value for status = 2. If there are active
transactions at the end of the log, you may have problems
shrinking. Generally, backing up the log and then shrinking
will work.
Check the following article for more information:
INF: Shrinking the Transaction Log in SQL Server 2000 with
DBCC SHRINKFILE
http://support.microsoft.com/?id=272318
-Sue
On Wed, 31 Aug 2005 14:15:10 +0200, <Moshe> wrote:

>Hi,
>In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
>trying to shrink it and it doesn't, Any suggestions?
>
|||Thanks Steen
"Steen Persson (DK)" <spe@.REMOVEdatea.dk> wrote in message
news:%23hQwvYirFHA.460@.TK2MSFTNGP15.phx.gbl...
> What do you do to shrink it? First of all you need to backup the log file
to
> truncate it and then you can shrink it. You can look up further info by
> looking for Shrinking The Transaction Log in Books On Line.
> Regards
> Steen
>
> Moshe wrote:
>
|||Hi,
Steps you can do to shrink the transaction log file:-
1. Backup the transaction log using the below command.
backup log <dbname> to disk='c:\backup\dbname.trn'
2. Shrink the database log file
dbcc shrinkfile('logical_ldf_name','sIZE_IN_mb_TO_SHRIN K')
Thanks
Hari
SQL Server MVP
<Moshe> wrote in message news:uNuLj0hrFHA.2600@.TK2MSFTNGP10.phx.gbl...
> Hi,
> In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
> trying to shrink it and it doesn't, Any suggestions?
>

Log file dosen't shrink

Hi,
In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
trying to shrink it and it doesn't, Any suggestions?What do you do to shrink it? First of all you need to backup the log file to
truncate it and then you can shrink it. You can look up further info by
looking for Shrinking The Transaction Log in Books On Line.
Regards
Steen
Moshe wrote:
> Hi,
> In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
> trying to shrink it and it doesn't, Any suggestions?|||Backup the log and then try the shrinkfile. You can check
the active sections of the log using dbcc loginfo(YourDB) .
The status indicates which virtual log files are active
where the value for status = 2. If there are active
transactions at the end of the log, you may have problems
shrinking. Generally, backing up the log and then shrinking
will work.
Check the following article for more information:
INF: Shrinking the Transaction Log in SQL Server 2000 with
DBCC SHRINKFILE
http://support.microsoft.com/?id=272318
-Sue
On Wed, 31 Aug 2005 14:15:10 +0200, <Moshe> wrote:
>Hi,
>In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
>trying to shrink it and it doesn't, Any suggestions?
>|||Thanks Steen
"Steen Persson (DK)" <spe@.REMOVEdatea.dk> wrote in message
news:%23hQwvYirFHA.460@.TK2MSFTNGP15.phx.gbl...
> What do you do to shrink it? First of all you need to backup the log file
to
> truncate it and then you can shrink it. You can look up further info by
> looking for Shrinking The Transaction Log in Books On Line.
> Regards
> Steen
>
> Moshe wrote:
> > Hi,
> > In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
> > trying to shrink it and it doesn't, Any suggestions?
>|||Hi,
Steps you can do to shrink the transaction log file:-
1. Backup the transaction log using the below command.
backup log <dbname> to disk='c:\backup\dbname.trn'
2. Shrink the database log file
dbcc shrinkfile('logical_ldf_name','sIZE_IN_mb_TO_SHRINK')
Thanks
Hari
SQL Server MVP
<Moshe> wrote in message news:uNuLj0hrFHA.2600@.TK2MSFTNGP10.phx.gbl...
> Hi,
> In SQL 2k I have a log file of 277.99 MB with space used 57 MB and I'm
> trying to shrink it and it doesn't, Any suggestions?
>