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

  • 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

    [font="Courier New"]Error 21335: [SQL-DMO] The new DB File size must be larger than the current size.[/font]

    Thanks for any kind of help

  • 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.

    Jared
    CE - Microsoft

  • 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

  • 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) A socialist is someone who will give you the shirt off *someone else's* back.

  • This Worked Perfectly for me

    Thanks a ton!

  • Worked excellent for me as well on a copy of a crotchety old SQL2000 DB.

  • 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) A socialist is someone who will give you the shirt off *someone else's* back.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply