error 21335 the new DBFile size must be larger than the current size

Posted on 2010-01-11
Medium Priority
Last Modified: 2012-05-08

I want to reduce the log file size from current space allocated 7000 mb to 3500 MB my DB size is 17GB. I tried to give space allocated is 3500 but it poped out error like
Error 21335 The new DBFile size must be larger than the current size.

Can you help?

Question by:yrcdba7
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 15

Expert Comment

by:Faiga Diegel
ID: 26285261
You have to make sure that the log file is not less than 3.5 GB. You wont be able to reduce it to 3500 MB if the log file size is more than 3.5 GB

Author Comment

ID: 26287135

My log file used 100 MB, space allocated 7GB, I want to reduce space allocated to 3.5 GB.
LVL 13

Expert Comment

ID: 26288076
It is likely the case that it was initially setup at a certain level (7GB) and you are unable to shrink it past it's initially set value. You can try with the DBCC SHRINKFILE command specifyin the size in MBs for the new logfile.

Depending on how you setup the log file you won't be able to shrink it as small as you like, basically the smallest you can get to is the size of the Virtual Log Files.

Try it with the shrink command. Please note that shrinking data and log files is not a normally recommended practice. It is best to pre-allocate to the right size you expect to need and leave it at that point. There are times, however, where perhaps your initial estimates are wrong or you are in a dev environment where shrinking is necessary.

LVL 13

Accepted Solution

MikeWalsh earned 2000 total points
ID: 26288155
See these 3 Books Online articles for a better understanding:

DBCC SHRINKFILE: http://msdn.microsoft.com/en-us/library/ms189493%28SQL.90%29.aspx

Shrinking the Transaction Log: http://msdn.microsoft.com/en-us/library/ms178037%28SQL.90%29.aspx

Transaction Log Physical Architecture: http://msdn.microsoft.com/en-us/library/ms179355%28SQL.90%29.aspx

Run this command in your existing database: DBCC LOGINFO()

how many rows are returned? Of those rows, which row has/have the status of 2, out of curiosity?

If you have shrunk your log to the smallest it can go (i.e. you only have the initial two VLFs left, based on how you initially set it up) your options are a bit difficult/restricted. The best bet is really a new database and move the data into it with the log file setup to the proper size to begin with, unfortunately.


Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to set up a backup for SQL Server using a Maintenance Plan and how to schedule the job into SQL Server Agent.
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question