July 19, 2012 at 1:09 pm
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
July 19, 2012 at 2:40 pm
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
July 19, 2012 at 2:52 pm
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
July 19, 2012 at 3:23 pm
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.
July 19, 2012 at 3:38 pm
This Worked Perfectly for me
Thanks a ton!
October 23, 2013 at 11:35 am
Worked excellent for me as well on a copy of a crotchety old SQL2000 DB.
October 23, 2013 at 12:48 pm
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