473,406 Members | 2,273 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Errors on DBCC SHRINKFILE(2)

Hi,
When I use dbcc shrinkfile to shrink LOG file, following error occurs:

DBCC SHRINKFILE(2)
----------------------------------------------------------------------------
-----------
Cannot shrink log file 2 (myDB_log) because all logical log files are in
use.
(1 row(s) affected)

I have only one transaction log file in my Database, who can tell me what't
the matter?

If my current log file is in use, how can I find who is using it and stop
using then do the shrink operation?

Thanks.

Scarab
Feb 13 '06 #1
5 8007
The message means that all of there are open transactions in all of
*logical* log files. Each physical log file is made up of multiple virtual
log files and the physical log cannot be shrunk when there all of these
virtual logs are occupied with open transactions.

You can identify the oldest open transaction with:

USE MyDatabase
DBCC OPENTRAN
GO

You should be able to shrink once the transaction completes. See 'Shrinking
the transaction log' <architec.chm::/8_ar_da2_1uzr.htm> in the Books Online
for details.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Scarab" <yw@lucent.com> wrote in message
news:ds********@netnews.net.lucent.com...
Hi,
When I use dbcc shrinkfile to shrink LOG file, following error occurs:

DBCC SHRINKFILE(2)
----------------------------------------------------------------------------
-----------
Cannot shrink log file 2 (myDB_log) because all logical log files are in
use.
(1 row(s) affected)

I have only one transaction log file in my Database, who can tell me
what't
the matter?

If my current log file is in use, how can I find who is using it and stop
using then do the shrink operation?

Thanks.

Scarab

Feb 13 '06 #2
Thanks for your reply, It is really a great help to me.
I think it is strange because after I restart SQL Server, this error still
exists, so I run
DBCC CHECKDB, there is no error messages, but after a while, the file can be
shrinked normally.
My question is: how can I view the virtual log files which make up a
physical log file? Once I find them, I
can kill the session and release the file.
Thank.
Feb 13 '06 #3

"Scarab" <yw@lucent.com> wrote in message
news:ds********@netnews.net.lucent.com...
Hi,
When I use dbcc shrinkfile to shrink LOG file, following error occurs:

DBCC SHRINKFILE(2)
-------------------------------------------------------------------------- -- -----------
Cannot shrink log file 2 (myDB_log) because all logical log files are in
use.
(1 row(s) affected)

I have only one transaction log file in my Database, who can tell me what't the matter?

If my current log file is in use, how can I find who is using it and stop
using then do the shrink operation?

Thanks.

Scarab


Thanks for your reply, It is really a great help to me.
I think it is strange because after I restart SQL Server, this error still
exists, so I run
DBCC CHECKDB, there is no error messages, but after a while, the file can be
shrinked normally.
My question is: how can I view the virtual log files which make up a
physical log file? Once I find them, I
can kill the session and release the file.
Thank.
Feb 13 '06 #4
Scarab (yw@lucent.com) writes:
Thanks for your reply, It is really a great help to me.
I think it is strange because after I restart SQL Server, this error still
exists, so I run
DBCC CHECKDB, there is no error messages, but after a while, the file
can be shrinked normally.
My question is: how can I view the virtual log files which make up a
physical log file? Once I find them, I
can kill the session and release the file.


I don't know the answers to your questions, but maybe you should think
twice before you shrink at all. Have you read
http://www.karaszi.com/SQLServer/info_dont_shrink.asp?

--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Feb 13 '06 #5
The undocumented DBCC LOGINFO can display virtual log stats.

Also, outstanding replicated transactions can prevent log
truncation/shrinking.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Scarab" <yw@lucent.com> wrote in message
news:ds********@netnews.net.lucent.com...
Thanks for your reply, It is really a great help to me.
I think it is strange because after I restart SQL Server, this error still
exists, so I run
DBCC CHECKDB, there is no error messages, but after a while, the file can
be
shrinked normally.
My question is: how can I view the virtual log files which make up a
physical log file? Once I find them, I
can kill the session and release the file.
Thank.

Feb 13 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Rene | last post by:
Suddenly in one database we have a lot of errors, it seams some things are corrupted. I tried to start maintanance / database repair, but this fails too. When selecting in Query Analyzer a range...
2
by: David Schwartz | last post by:
We are having quite a time since moving a large database to a new server (actually built new server, renamed as old to make seamless for users, etc.) Import 104 million row database (5 column)...
4
by: Morgan Leppink | last post by:
Hey all - We are running SQL 2000 with ALL available service packs, etc. applied. We just built a brand new database server, which has dual 2Ghz XEONs, 2GB memory, and the following disk...
1
by: Kalvin | last post by:
I keep seeing this return from running a DBCC OpenTran: Transaction information for database 'Live_App'. Oldest active transaction: SPID (server process ID) : 92 UID (user ID) : 1 Name ...
0
by: Auday Alwash | last post by:
Hi, A month ago, we were running out of disk space on a drive that stores the data file for a SQL Server 7 database. So I added a new drive and created a new data file on the primary filegroup...
13
by: Guillaume | last post by:
I have a table where I store around 1 million rows for 7 days. I run a DBCC SHOWCONTIG every week and I noticed that the number of Rows and the Average Free Bytes are stable but the number of...
7
by: deebeeay | last post by:
Hi, I need to shrink a database file and was wondering whether it is required to run a full backup after the shrink operation. In SQL Server 7.0 shrinkfile was a non-logged operation so would...
1
by: dls1 | last post by:
I ran a dbcc shrinkfile after deleting data in order to take thte db down in size and it has been running for 2 days. Can I canel the command? Will the file be partially shrunk? Last year when we did...
0
by: SanjibDatta | last post by:
Hi, Is any ways DBCC SHRINKFILE can give errors while using for truncating the size of transaction log? Thanks
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.