SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


DBCC shrinkfile error - Msg 8985


DBCC shrinkfile error - Msg 8985

Author
Message
chandu72
chandu72
SSC-Enthusiastic
SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)

Group: General Forum Members
Points: 107 Visits: 1

Hi

I am getting following error when I try to shrink the transaction log:

DBCC SHRINKFILE (wslogdb50_Log, 2000)

Server: Msg 8985, Level 16, State 1, Line 1
Could not locate file 'wslogdb50_Log' in sysfiles.
DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Any ideas?

Regards

Chandu





Nicholas Cain
Nicholas Cain
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7162 Visits: 6200

Check that you are using the database that you wish to shrink the file of.

What's the output from SELECT NAME FROM SYSFILES ?





Shamless self promotion - read my blog http://sirsql.net
chandu72
chandu72
SSC-Enthusiastic
SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)

Group: General Forum Members
Points: 107 Visits: 1

Hi

Thanks for the prompt response.

I get following output for SELECT NAME FROM SYSFILES:

wslogdb50

wslogdb50_Log.LDF

I am getting "Incorrect Syntax error" when i include .ldf in the DBCC shrinkfile command.

Regards

Chandu





Nicholas Cain
Nicholas Cain
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7162 Visits: 6200
Try shrinking it using the fileid (SELECT NAME, FILEID FROM SYSFILES), use the same syntax, just replace the filename with the fileid.



Shamless self promotion - read my blog http://sirsql.net
chandu72
chandu72
SSC-Enthusiastic
SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)

Group: General Forum Members
Points: 107 Visits: 1

Hi

The statement seems to have completed without any error. But, I am getting following message:

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

(1 row(s) affected)

DBCC execution completed. If DBCC printed error messages, contact your system administrator.

Current Size 1257512 Used pages 1257512

The log file increased to 10GB. I need to reduce it ASAP as we are running out of space. Any other alternative? Starting and stopping sql server?

Regards

Chandu





Nicholas Cain
Nicholas Cain
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7162 Visits: 6200

Run the following, replace DBNAME with your database name and FILEID with the file id.

BACKUP LOG DBNAME WITH NO_LOG
GO
USE DBNAME
GO
DBCC SHRINKFILE (FILEID, 128, TRUNCATEONLY)
GO





Shamless self promotion - read my blog http://sirsql.net
chandu72
chandu72
SSC-Enthusiastic
SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)

Group: General Forum Members
Points: 107 Visits: 1

Thanks once again for your help.

What is 128?

I have already run following statement:

backup log wslogdb50 with truncate_only

Regards

Chandu





Nicholas Cain
Nicholas Cain
SSCertifiable
SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)SSCertifiable (7.2K reputation)

Group: General Forum Members
Points: 7162 Visits: 6200
128 is the number of pages to shrink the file to. I usually use that if I want to shrink the file but still leave some space in it.



Shamless self promotion - read my blog http://sirsql.net
chandu72
chandu72
SSC-Enthusiastic
SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)SSC-Enthusiastic (107 reputation)

Group: General Forum Members
Points: 107 Visits: 1

Excellent !! It worked.

Thanks very much for your help.

Regards

Chandu





Bapi Raju
Bapi Raju
Grasshopper
Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)Grasshopper (19 reputation)

Group: General Forum Members
Points: 19 Visits: 1

HI Nicholas,

I am facing the same problem.

I am unable to understand the what your talking about.

Try shrinking it using the fileid (SELECT NAME, FILEID FROM SYSFILES), use the same syntax, just replace the filename with the fileid.

Please let me know how can i reduce the file size of the database log.

Thanks

Bapi.


Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search