Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Error 21335: [SQL-DMO] The new DB File size must be larger than the current size. Expand / Collapse
Author
Message
Posted Thursday, July 19, 2012 1:09 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 3:05 PM
Points: 248, Visits: 1,029
Trying to Reduce database initial file size..

The allocated Space is 30 GB and it is using only 1 GB So,i want to reduce the intial database size, but it throwing the following error


Error 21335: [SQL-DMO] The new DB File size must be larger than the current size.

Thanks for any kind of help
Post #1332504
Posted Thursday, July 19, 2012 2:40 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: 2 days ago @ 10:58 AM
Points: 2,696, Visits: 3,402
Is this a production database? If not, I would create a new one with the proper file size and then move the data there. Else, you have to shrink the database file before you can set the initial file size.

Thanks,

Jared
SQL Know-It-All

How to post data/code on a forum to get the best help - Jeff Moden
Post #1332566
Posted Thursday, July 19, 2012 2:52 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 3:05 PM
Points: 248, Visits: 1,029
yes this is Production database.
I tried Shrinking database, but not successfull.


please suggest me

Am i missing any simple thing here

thanks for the reply
Post #1332579
Posted Thursday, July 19, 2012 3:23 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 3:07 PM
Points: 2,194, Visits: 3,304
You have to use DBCC SHRINKFILE to reduce a file below its initial allocation.

USE <your_db_name>

-- get the file#s / names of all the db's files
EXEC sp_helpfile

Then choose the file# or filename you want to shrink. For example, to shrink the primary file to 2GB:

DBCC SHRINKFILE ( 1, 2000 )



SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1332601
Posted Thursday, July 19, 2012 3:38 PM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Yesterday @ 3:05 PM
Points: 248, Visits: 1,029
This Worked Perfectly for me
Thanks a ton!
Post #1332610
Posted Wednesday, October 23, 2013 11:35 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, December 23, 2013 11:59 AM
Points: 1, Visits: 32
Worked excellent for me as well on a copy of a crotchety old SQL2000 DB.
Post #1507771
Posted Wednesday, October 23, 2013 12:48 PM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 3:07 PM
Points: 2,194, Visits: 3,304
Great, glad it helped!

Btw, use DBCC commands such as those above to do file shrinks and other such db maintenance tasks, not the SSMS gui, which can be flaky for such things.


SQL DBA,SQL Server MVP('07, '08, '09)

Carl Sagan said: "There is no such thing as a dumb question." Sagan obviously never watched a congressional hearing!
Post #1507796
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse